Skip to content

False positive: Access to generic instance variable through class is ambiguous #8083

@thomasLeMeur

Description

@thomasLeMeur

Describe the bug
Since v1.1.348, false-positives can occur on Access to generic instance variable through class is ambiguous error with inheritance.

This bug report follows #7089 issue and this comment

Code or Screenshots

from typing import Generic, TypeVar

T = TypeVar("T")

class Base(Generic[T]):      some_attr: T
class StringBase(Base[str]): some_attr = "foo"
class IntBase(Base[int]):    some_attr = 0

assert StringBase.some_attr == "foo" # `Access to generic instance variable through class is ambiguous`
assert IntBase.some_attr    == 0     # `Access to generic instance variable through class is ambiguous`

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions