Closed
Description
T = TypeVar('T')
class X(Generic[T]):
A = X[T]
def f(self, x: int = 1) -> X[T]: ...
a: X[T]
b: A = a # ok
def g(self) -> None:
a: X[T]
b: X.A = a # ok
def g(x: X[T]) -> None:
p: X[T] = x.f() # ok
q: X.A = x.f() # fail
I think it should pass, unless qualified aliases are not allowed (in which case it should fail in X.g()
). In addition, the error is confusing: Incompatible types in assignment (expression has type m.X[T], variable has type m.X[T])
.