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
In the situation with a forward reference to type variable, first and second run in fine grained mode give different results:
[case testForwardTypeVar]
import a
[file a.py]
from typing import Generic, TypeVar
import b
def f() -> None:
class C(Generic[T]): pass
x: C[int]
T = TypeVar('T')
[file b.py]
y = 0
[file b.py.2]
y = ''
[out]
a.py:5: error: Free type variable expected in Generic[...]
a.py:6: error: "C" expects no type arguments, but 1 given
==
The errors don't appear in the second run. A possible solution is to allow forward references to type variables, although it is quite hard.
A general comment about fine grained mode is that it will be probably hard to support detection of invalid forward references (see for example #2400), the error would depend on the order of targets in file.
The text was updated successfully, but these errors were encountered:
This is similar to #4615
In the situation with a forward reference to type variable, first and second run in fine grained mode give different results:
The errors don't appear in the second run. A possible solution is to allow forward references to type variables, although it is quite hard.
A general comment about fine grained mode is that it will be probably hard to support detection of invalid forward references (see for example #2400), the error would depend on the order of targets in file.
The text was updated successfully, but these errors were encountered: