Skip to content

super() erroneously flagged as incorrect when cls function parameter is generic #7690

Closed
@wadetregaskis-linkedin

Description

@wadetregaskis-linkedin
from typing import Type, TypeVar

T = TypeVar('T', bound='BaseClass')

class BaseClass:
    pass

class SubClass(BaseClass):
    @classmethod
    def foo(cls: Type[T]) -> None:
        super().bar()

mypy 0.730 newly (vs 0.720) reports the false error:

error: Argument 2 for "super" not an instance of argument 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions