Skip to content
Merged
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
6 changes: 3 additions & 3 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2057,9 +2057,9 @@ def finish_passes(self) -> None:
manager.options.dump_deps):
manager.all_types.update(self.type_map())

if self.options.incremental:
self._patch_indirect_dependencies(self.type_checker().module_refs,
self.type_map())
# We should always patch indirect dependencies, even in full (non-incremental) builds,
# because the cache still may be written, and it must be correct.
self._patch_indirect_dependencies(self.type_checker().module_refs, self.type_map())

if self.options.dump_inference_stats:
dump_type_stats(self.tree, self.xpath, inferred=True,
Expand Down
3 changes: 2 additions & 1 deletion mypy/test/testcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def run_case_once(self, testcase: DataDrivenTestCase,
options.show_traceback = True
if 'optional' in testcase.file:
options.strict_optional = True
if incremental_step:
if incremental_step and options.incremental:
# Don't overwrite # flags: --no-incremental in incremental test cases
options.incremental = True
else:
options.incremental = False
Expand Down
18 changes: 18 additions & 0 deletions test-data/unit/check-incremental.test
Original file line number Diff line number Diff line change
Expand Up @@ -4410,3 +4410,21 @@ tmp/b.py:4: note: Expected:
tmp/b.py:4: note: def __iter__(self) -> Iterator[int]
tmp/b.py:4: note: Got:
tmp/b.py:4: note: def __iter__(self) -> Iterator[str]

[case testIndirectDepsAlwaysPatched-writescache]
# flags: --no-incremental
# flags2: --incremental
from b import C
def f() -> None:
x: int = C().x
[file b.py]
from c import C
[file c.pyi]
class C:
x: int
[file c.pyi.2]
class C:
x: str
[out]
[out2]
main:5: error: Incompatible types in assignment (expression has type "str", variable has type "int")