You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from __future__ importannotationsclassA:
classB[T]:
def__get__(self, instance: A, owner: type[A]) ->T:
returnNonef=B[int]()
a=A()
v=a.fprint("OK")
produces the following output:
test.py: note: In member "__get__" of class "B":
test.py:5:59: error: A functionreturning TypeVar should receive at least one argument containing the same TypeVar [type-var]
def __get__(self, instance: A, owner: type[A]) -> T:
^
test.py:6:20: error: Incompatible return value type (got "None", expected "T") [return-value]
return None
^~~~
test.py: note: At top level:
test.py:10:5: error: Need type annotation for"v" [var-annotated]
v = a.f
^~~
Found 3 errors in 1 file (checked 1 source file)
The following code:
produces the following output:
Here the first error
[type-var]
is due to #17596.The second error
[return-value]
is legitimate and appears here because of synthetic nature of this test, extracted from much more complicated code.The third error
[var-annotated]
is the essence of this issue.It looks like a false positive to me.
The text was updated successfully, but these errors were encountered: