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
{{ message }}
Repository navigation
"Can't determine type" error in import cycles with named tuples and typed dicts #5658
Consider this test case which currently fails with Cannot determine type of "tp":
[case testNamedTupleImportCycle]
import b
[file a.py]
class C:
pass
from b import tp
reveal_type(tp) # Cannot determine type of 'tp'
tp('x') # Cannot determine type of 'tp'
[file b.py]
from a import C
from typing import NamedTuple
tp = NamedTuple('tp', [('x', int)])
[out]
Note however that such code will anyway fail at runtime, and it works if one imports under if MYPY: (see #2015). I think therefore it is relatively low priority.
Activity
ilevkivskyi commentedon Sep 24, 2019
This works correctly on master (likely fixed by the new semantic analyzer).