Skip to content

Improve recovery of misplaced attributes on statements #1282

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

Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jan 26, 2023

Fixes #714
rdar://99594971

@ahoppen ahoppen requested a review from bnbarham January 26, 2023 16:32
@ahoppen
Copy link
Member Author

ahoppen commented Jan 26, 2023

@swift-ci Please test

@@ -950,7 +950,7 @@ final class SwitchTests: XCTestCase {
}
""",
diagnostics: [
DiagnosticSpec(message: "expected label in switch case")
DiagnosticSpec(message: "unexpected code '@moreGarbage' in switch case")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we parse any single attribute rather than just @unknown?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we do. That’s what the syntax tree currently allows.

@ahoppen
Copy link
Member Author

ahoppen commented Jan 26, 2023

@swift-ci Please test Linux

@ahoppen ahoppen merged commit c17f6b0 into swiftlang:main Jan 27, 2023
@ahoppen ahoppen deleted the ahoppen/misplaced-attribute-recovery branch January 27, 2023 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If an attribute is put on a statement, the entire statement is classified as unexpected
2 participants