Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Don't leak local variables between switch branches #1450

Merged
merged 2 commits into from
Sep 22, 2024

Conversation

liblit
Copy link
Contributor

@liblit liblit commented Sep 22, 2024

Declaring and initializing a local variable in one switch branch, then using that same local variable in a different switch branch, is legal but confusing. Even more so if the first switch branch returns rather than falling through. Let's just not do that.

Declaring and initializing a local variable in one `switch` branch, then
using that same local variable in a different `switch` branch, is legal
but confusing.  Even more so if the first switch branch returns rather
than falling through.  Let's just not do that.
@liblit liblit added the cleanup API cleanup and refactoring label Sep 22, 2024
@liblit liblit requested a review from msridhar September 22, 2024 21:48
@liblit liblit self-assigned this Sep 22, 2024
@liblit liblit enabled auto-merge (rebase) September 22, 2024 21:49
@liblit liblit merged commit 38c41b7 into wala:master Sep 22, 2024
10 checks passed
@liblit liblit deleted the no-leak-locals-between-cases branch September 22, 2024 22:00
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
cleanup API cleanup and refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants