Skip to content

False positive on code involving typevar with default #9246

Open

Description

import typing

T = typing.TypeVar("T", bound="Base", default="Foo")


class Base: ...


class Foo(Base): ...


class Bar(typing.Generic[T]):
    def __init__(self, foo: T) -> None:
        self.foo = foo

    @property
    def foo_(self) -> T:
        return self.foo  # error

But mypy works correctly mypy playground

This is probably a regression because there was no error on version 1.1.383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions