-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Type narrowing is not allowed if variable is reassigned after the use site inside if block #1764
Comments
We'd have to do flow analysis to properly reason about this. That might be worthwhile (and would allow us to detect unreachable code, unassigned variables, etc. as well), but we need to consider the impact on complexity and performance. |
btw, there is already a PR for control flow analysis: #1287 |
Control flow looks really nice 👍 |
So what is the proposal? |
I've opened a PR #6959 that will fix this. |
I think that this can be closed, #8010 |
Current implementation is very conservative when looking for assignments during application of type narrowing.
variable is reassigned after the usage of narrowed type but type narrowing still not kicked in
The text was updated successfully, but these errors were encountered: