Closed as not planned
Description
After #18831 this example started generating an error, which looks like a regression:
import typing
A = typing.TypeVar('A')
class Attribute(typing.Generic[A]):
@typing.overload
def __get__(self, instance: None, owner: typing.Any) -> Attribute[A]: ...
@typing.overload
def __get__(self, instance: object, owner: typing.Any) -> A: ...
def __get__(self, instance, owner): ...
class PathArg(typing.Protocol):
path: Attribute[str]
def f(arg: PathArg) -> None:
# No error expected
s: str = arg.path # error: Expression has type "Attribute[str]", variable has type "str'
If PathArg
is a regular class, there is no error.
cc @ilevkivskyi as the author of the PR