-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Can't use label for while loop #12643
Comments
Code examples: fn main() {
'eggs: loop {
'ham: for _ in range(0, 0) {
if 1 + 1 == 2 {
break 'eggs;
} else {
continue 'ham;
}
}
}
} Compiles fine. But with a fn main() {
'eggs: while 1 + 1 == 2 {
break 'eggs;
}
} It doesn't compile:
|
Should it? The AST node definition for while loop is |
That's only because |
nominating. I believe that, if necessary, we can add support for labelled whiles after 1.0 backwards compatibly. But I have to admit, it is super-surprising that Therefore, I am recommending that we tag this as "P-high", but not add it to the 1.0 milestone. |
Sounds like we should support this. @pnkfelix +1 for your tagging recommendation. |
P-high, but not 1.0 (we can add it backwards compatibly). |
I've done some work on this (initial commit: Pythoner6@7e9a2fe). Once I have time to rebase and re-run the tests, I'll be submitting a pull request. |
Fixes #12643 > Say! > I like labelled breaks/continues! I will use them with a `for` loop. And I will use with a `loop` loop. Say! I will use them ANYWHERE! … _even_ in a `while` loop. Because they're now supported there.
fix: Fix completions for locals not working properly inside macro calls
I will use them with a
for
loop.And I will use with a
loop
loop.Say! I will use them ANYWHERE!
… except in a
while
loop.Because they're not supported there.
The text was updated successfully, but these errors were encountered: