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
I have a type variable with a default set. For some reason, this seems to be causing mypy to refuse to allow that variable to be Never in constructor calls, but it's not explicitly banned: it just seems to silently revert it to the default, causing weird errors.
I believe the above code should pass type-checking with no errors, as Never is a legal parameterization?
Actual Behavior
main.py:12: error: Incompatible types in assignment (expression has type "WithDefault[int]", variable has type "WithDefault[Never]") [assignment]
main.py:14: error: Incompatible types in assignment (expression has type "WithDefault[int]", variable has type "WithDefault[Never]") [assignment]
Found 2 errors in 1 file (checked 1 source file)
Playing around, I can get all kinds of weird errors that seem to come down to mypy somehow reverting Never to the default bound in construction calls.
Your Environment
Mypy version used: 1.19.0
Mypy command-line flags: None
Mypy configuration options from mypy.ini (and other config files): None
Activity
Use explicit Never for type inference (#21497)