Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,9 @@ def parse_all(self, states: list[State], post_parse: bool = True) -> None:

parallel_states = []
for state in states:
if not self.fscache.exists(state.xpath, real_only=True):
if not self.fscache.exists(state.xpath, real_only=True) or (
self.shadow_map and self.maybe_swap_for_shadow_path(state.xpath) != state.xpath
):
state.source = state.get_source()
if state.tree is not None:
# The file was already parsed.
Expand Down
29 changes: 29 additions & 0 deletions test-data/unit/cmdline.test
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,35 @@ variable has type "bytes")
b: bytes = 1
^

[case testShadowFileWithNativeParser]
# cmd: mypy --native-parser --shadow-file source.py shadow.py source.py
[file source.py]
x: int = 1
reveal_type(x)
[file shadow.py]
x: str = "y"
reveal_type(x)
[out]
source.py:2: note: Revealed type is "str"
== Return code: 0

[case testShadowFileWithNativeParserParallel]
# cmd: mypy --native-parser --shadow-file a.py a_shadow.py main.py a.py b.py
[file main.py]
import a
import b
[file a.py]
x: int = 1
reveal_type(x)
[file b.py]
y: int = 2
[file a_shadow.py]
x: str = "y"
reveal_type(x)
[out]
a.py:2: note: Revealed type is "str"
== Return code: 0

[case testConfigWarnUnusedSection1]
# cmd: mypy foo.py quux.py spam/eggs.py
[file mypy.ini]
Expand Down
Loading