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-165] Bad diagnostic for repeat {} without while. #42787

Closed
michelf opened this issue Dec 9, 2015 · 1 comment
Closed

[SR-165] Bad diagnostic for repeat {} without while. #42787

michelf opened this issue Dec 9, 2015 · 1 comment
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@michelf
Copy link

michelf commented Dec 9, 2015

Previous ID SR-165
Radar None
Original Reporter @michelf
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @gregomni
Priority Medium

md5: f844f71b184764f9a879e063b1e9571e

Issue Description:

Writing a loop like this:

repeat {
}

...will trigger a diagnostic message for the missing "while", but that message has no location:
"<unknown>:0: error: expected 'while' after body of 'repeat' statement"

In Xcode, that means the first message you see is located at the end of the scope repeat is located in, and it says: "Consecutive declarations on a line must be separated by ';'". This makes no sense to the user unless the <unknown>:0 message is seen.

I would argue that this is the most intuitive infinite loop syntax ever, so if illegal the compiler should complain properly.

@gregomni
Copy link
Collaborator

Pull request with fix in #754

@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
Projects
None yet
Development

No branches or pull requests

2 participants