-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
(🐞) false narrowing with reassignment in loop #11612
Labels
Comments
This can be fixed by: a: int | None = None
for b in [1, 2]:
if a is None:
a = b
continue
print("hi") # ok The other question is: why |
It is, if you put Perhaps it is inferring as |
KotlinIsland
changed the title
false unreachable with conditional reassignment then continue in loop
(🐞) false unreachable with conditional reassignment then continue in loop
Oct 31, 2023
KotlinIsland
changed the title
(🐞) false unreachable with conditional reassignment then continue in loop
(🐞) false unreachable with reassignment in loop
Oct 31, 2023
@sobolevn It's not just the inference, I've updated the OP with a much better example. |
KotlinIsland
changed the title
(🐞) false unreachable with reassignment in loop
(🐞) false narrowing with reassignment in loop
Oct 31, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Oct 31, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Oct 31, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 1, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 4, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 10, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 10, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 11, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 12, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 13, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 13, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 13, 2023
KotlinIsland
added a commit
to KotlinIsland/basedmypy
that referenced
this issue
Nov 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also:
The text was updated successfully, but these errors were encountered: