-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
branch with generic type narrowed to <nothing>
treated as reachable
#11976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
<nothing>
treated as reachable<nothing>
treated as reachable
it still happens when not using foo: list[str]
if isinstance(foo, list):
print(1)
else:
print(1) # no error here but it's unreachable |
@sobolevn That is not true, a a = 1
if False:
reveal_type(a) # error: Statement is unreachable
if False:
reveal_type(a) # type: ignore[unreachable] |
Please, see #11443 |
this seems to be fixed now, though perhaps a test should be added so it doesn't break again |
Yes, this bug appears to have been fixed. This doesn't repro with mypy 1.5. |
https://mypy-play.net/?mypy=master&python=3.10&flags=show-error-codes%2Callow-redefinition%2Cstrict%2Ccheck-untyped-defs%2Cdisallow-any-decorated%2Cdisallow-any-expr%2Cdisallow-any-explicit%2Cdisallow-any-generics%2Cdisallow-any-unimported%2Cdisallow-incomplete-defs%2Cdisallow-subclassing-any%2Cdisallow-untyped-calls%2Cdisallow-untyped-decorators%2Cdisallow-untyped-defs%2Cno-implicit-optional%2Cno-implicit-reexport%2Cstrict-equality%2Cwarn-incomplete-stub%2Cwarn-redundant-casts%2Cwarn-return-any%2Cwarn-unreachable%2Cwarn-unused-configs%2Cwarn-unused-ignores&gist=491d109a359283211d39cd01c908de91
The text was updated successfully, but these errors were encountered: