Skip to content

Error when using tuple base class not detected #867

Closed
@JukkaL

Description

@JukkaL

Assume m.pyi like this:

from typing import Tuple
a = ... # type: A
class A(Tuple[int, str]): ...

Now this error isn't caught by mypy:

from m import a
a[0]()

This is caused by the class definition being after the type reference in m.pyi. Apparently tuple item types don't get propagated because the class hasn't been semantically analyzed yet when binding the type.

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