Bug Report
When a file has been previously analyzed, and errors were found, and that result was cached,
(A clear and concise description of what the bug is.)
To Reproduce
Similar to
|
[case testIncrementalWithSilentImports] |
, but with an extra
cmd3/
out3 equal to the first.
Create two files:
# a.py
import b
b.foo(1, 2)
and
# b.py
def foo(a: int, b: int) -> str:
return a + b
Then, run the following three commands (in this order):
mypy --follow-imports=silent a.py
mypy --follow-imports=silent b.py
mypy --follow-imports=silent a.py (same as first command)
(A more 'minimal' example would be to not run mypy --follow-imports=silent a.py first, which still exhibits the bug, but I think running 'a', 'b', 'a' more clearly shows the bug).
Expected Behavior*
Only run 2 (the one directly analyzing b.py) produces output.
# mypy --follow-imports=silent a.py
Success: no issues found in 1 source file
# mypy --follow-imports=silent b.py
b.py:2: error: Incompatible return value type (got "int", expected "str") [return-value]
Found 1 error in 1 file (checked 1 source file)
# mypy --follow-imports=silent a.py
Success: no issues found in 1 source file
Actual Behavior
# mypy --follow-imports=silent a.py
Success: no issues found in 1 source file
# mypy --follow-imports=silent b.py
b.py:2: error: Incompatible return value type (got "int", expected "str") [return-value]
Found 1 error in 1 file (checked 1 source file)
# mypy --follow-imports=silent a.py
b.py:2: error: Incompatible return value type (got "int", expected "str") [return-value]
Found 1 error in 1 file (checked 1 source file)
Note how the third run (which uses --follow-imports=silent) is not silent about errors in not explicitly listed files, while the first was.
Your Environment
- Mypy version used: 1.19.1 (but reproducible on master)
- Mypy command-line flags:
--follow-imports=silent
- Mypy configuration options from
mypy.ini (and other config files): None.
- Python version used: 3.13.11
Bug Report
When a file has been previously analyzed, and errors were found, and that result was cached,
(A clear and concise description of what the bug is.)
To Reproduce
Similar to
mypy/test-data/unit/check-incremental.test
Line 2451 in 704aee6
cmd3/out3equal to the first.Create two files:
and
Then, run the following three commands (in this order):
mypy --follow-imports=silent a.pymypy --follow-imports=silent b.pymypy --follow-imports=silent a.py(same as first command)(A more 'minimal' example would be to not run
mypy --follow-imports=silent a.pyfirst, which still exhibits the bug, but I think running 'a', 'b', 'a' more clearly shows the bug).Expected Behavior*
Only run 2 (the one directly analyzing
b.py) produces output.Actual Behavior
Note how the third run (which uses
--follow-imports=silent) is not silent about errors in not explicitly listed files, while the first was.Your Environment
--follow-imports=silentmypy.ini(and other config files): None.