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
But mypy loses the type information for test.a in the context of b.py
$ mypy test/__init__.py test/a.py test/b.py
test/b.py:7: error: Revealed type is 'Any'
test/__init__.py:7: error: Revealed type is 'builtins.int'
What's odd is if I reorder the files to explicitly pass in b.py first, things work -
$ mypy test/b.py test/a.py test/__init__.py
test/__init__.py:7: error: Revealed type is 'builtins.int'
test/b.py:7: error: Revealed type is 'builtins.int'
The text was updated successfully, but these errors were encountered:
This adds supports for some cases of importing an imported name
within an import cycle. Originally they could result in false positives
or false negatives.
The idea is to use a new node type ImportedName in semantic
analysis pass 1 to represent an indirect reference to a name in another
module. It will get resolved in semantic analysis pass 2.
ImportedName is not yet used everywhere where it could make
sense and this doesn't fix all related issues with import cycles.
Also did a bit of refactoring of type semantic analysis to avoid passing
multiple callback functions.
Fixes#4049.
Fixes#4429.
Fixes#4682.
Inspired by (and borrowed test cases from) #4495 by @carljm.
Supersedes #4495
This adds supports for some cases of importing an imported name
within an import cycle. Originally they could result in false positives
or false negatives.
The idea is to use a new node type ImportedName in semantic
analysis pass 1 to represent an indirect reference to a name in another
module. It will get resolved in semantic analysis pass 2.
ImportedName is not yet used everywhere where it could make
sense and this doesn't fix all related issues with import cycles.
Also did a bit of refactoring of type semantic analysis to avoid passing
multiple callback functions.
Fixespython#4049.
Fixespython#4429.
Fixespython#4682.
Inspired by (and borrowed test cases from) python#4495 by @carljm.
Supersedes python#4495
Example:
test/__init__.py
:test/a.py
:test/b.py
:test/__main__.py
Python will execute the above code just fine:
$ python3 -m test 42
But
mypy
loses the type information fortest.a
in the context ofb.py
What's odd is if I reorder the files to explicitly pass in
b.py
first, things work -The text was updated successfully, but these errors were encountered: