Skip to content

Multiple inheritance with Generic leads to [misc] error #18268

Description

@Lancetnik

Bug Report

If we creates multiple generic parents with the same generic attribute, mypy raises an error about incompatible definition

To Reproduce

fromtypingimportGeneric, TypeVarT=TypeVar("T")
classA(Generic[T]):
x: TclassB(Generic[T]):
x: TclassC(A[str], B[str]):
pass

Raises error: Definition of "x" in base class "A" is incompatible with definition in base class "B" [misc]

Expected Behavior

The example should has no error, like in the final types case

classA:
x: strclassB:
x: strclassC(A, B):
pass

Actual Behavior

Raises an error

Your Environment

mypy==1.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions