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
Say I have function that maybe returns None and I check the result:
deff() ->int|None: ...
iff() isNone: ...
I rewrite the function so that it never returns None:
deff() ->int: ...
iff() isNone: ...
Now the is None check makes no sense -- it will always fail. This is a mistake introduced in refactoring and it should be flagged. (And similar for is not None checks)
In Rust I don't think this kind of error is possible:
fnf() -> Option<u8>;iff().is_none(){}// okayfng() -> u8;ifg().is_none(){}// no good
The text was updated successfully, but these errors were encountered:
Forgot to add, this affects Mypy 1.14.1 with Python 3.14, using --strict setting. (Not sure if --warn-unreachable is included in that, but if it isn't it should be.)
Switching the tag from feature to bug is fine with me :)
mypy --strict --warn-unreachable does not raise any warnings, but it should. So this is a FALSE NEGATIVE bug. Or a new feature, whatever, but in any case this situation should be flagged.
Say I have function that maybe returns
None
and I check the result:I rewrite the function so that it never returns
None
:Now the
is None
check makes no sense -- it will always fail. This is a mistake introduced in refactoring and it should be flagged. (And similar foris not None
checks)In Rust I don't think this kind of error is possible:
The text was updated successfully, but these errors were encountered: