Skip to content

Access to generic instance variable through class is ambiguous #7089

@nanne-aben

Description

@nanne-aben

Describe the bug
As of v1.1.348, I'm getting the following error:

error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)

Code or Screenshots
Minimal example:

from typing import Generic, Type, TypeVar

T = TypeVar("T")


class Bar:
    pass


class Foo(Generic[T]):
    bar: Type[T]


Foo[Bar].bar

I don't understand why this is ambiguous though. I'd think that it is pretty clear that the type of Foo[Bar].bar is Type[Bar]. Happy to learn if that's not the case though!

In context, the error can be seen in the ci/cd logs of kaiko-ai/typedspark#281, if you're interested.

VS Code extension or command-line
From the command line, v1.1.348. Previous versions did not raise this error.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    as designedNot a bug, working as intendedbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions