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
The report any-exprs.txt generated by mypy --any-exprs-report changes its output, even if the AST has not changed in any way.
To Reproduce
This is a minimal example:
Error = (
int
| int
)
mypy reports
Name Anys Exprs Coverage
-------------------------------
t 2 4 50.00%
-------------------------------
Total 2 4 50.00%
On the other hand, this example produces no errors
OK = int | int
Again the table, for completeness.
Name Anys Exprs Coverage
-------------------------------
s 0 2 100.00%
-------------------------------
Total 0 2 100.00%
The underlying reason is that mypy counts expressions set as TYPE_UNANALYZED as Anys expression. This is very surprising to me. The specific expression is assigned TYPE_UNANALYZED in StatisticsVisitor.type.
Expected Behavior
The invocation mypy --any-exprs-report matches the number of errors encountered by running mypy --disallow-any-exprs. Or at the very least clear up the documentation:
Causes mypy to generate a text file report documenting how many
expressions of type ``Any`` are present within your codebase.
Bug Report
The report
any-exprs.txt
generated bymypy --any-exprs-report
changes its output, even if the AST has not changed in any way.To Reproduce
This is a minimal example:
mypy
reportsOn the other hand, this example produces no errors
Again the table, for completeness.
The underlying reason is that
mypy
counts expressions set asTYPE_UNANALYZED
asAnys
expression. This is very surprising to me. The specific expression is assignedTYPE_UNANALYZED
inStatisticsVisitor.type
.Expected Behavior
The invocation
mypy --any-exprs-report
matches the number of errors encountered by runningmypy --disallow-any-exprs
. Or at the very least clear up the documentation:Your Environment
I don't think this matters, but:
mypy 1.14.0 (compiled: yes)
mypy 1.15.0+dev.d79d89e3ff31ed67a41b0663da9ec8e037d41fa0 (compiled: no)
--any-exprs-report
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: