Skip to content
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

[SR-9677] Using break with unresolved label inside loops produces misleading diagnostic #52120

Closed
robinkunde opened this issue Jan 16, 2019 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers

Comments

@robinkunde
Copy link
Contributor

Previous ID SR-9677
Radar None
Original Reporter @robinkunde
Type Bug
Status Resolved
Resolution Done
Environment

Xcode 10

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, StarterBug
Assignee None
Priority Medium

md5: f24c7556260564d05696018dadd1d367

Issue Description:

In 4.2 and master, code like

while true {
  break label
}

produces the following misleading error.

@belkadan
Copy link
Contributor

Huh. I know we have a special diagnostic for this normally, but it's not getting applied, all the way back to Swift 4.0. Thanks for filing.

@belkadan
Copy link
Contributor

I take it back, apparently we don't have a special diagnostic. That means fixing this is easy enough that someone could do it as a Starter Bug: find where we emit the existing error (called break_outside_loop) and add a test for whether the break was written with a label.

This applies to continue as well.

@robinkunde
Copy link
Contributor Author

I actually filed a PR for it as well. #21915

Happy to work on continue as well if the PR works out.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants