Skip to content

Use a token name for diagnostics to generate diagnostic messages #737

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
merged 3 commits into from
Sep 20, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Sep 8, 2022

This allows us to generate improved error messages:

- Expected '' in class
+ Expected identifier in class

@ahoppen ahoppen requested review from rintaro and bnbarham September 8, 2022 09:07
@ahoppen ahoppen marked this pull request as ready for review September 8, 2022 09:07
@ahoppen
Copy link
Member Author

ahoppen commented Sep 8, 2022

@swift-ci Please test

@@ -612,8 +611,7 @@ final class DeclarationTests: XCTestCase {
diagnostics: [
DiagnosticSpec(locationMarker: "MISSING_COLON", message: "Expected ':' in function parameter"),
DiagnosticSpec(locationMarker: "MISSING_RPAREN", message: "Expected ')' to end parameter clause"),
// FIXME: We should issues something like "Expected identifier in declaration"
DiagnosticSpec(locationMarker: "MISSING_IDENTIFIER", message: "Expected '' in struct"),
DiagnosticSpec(locationMarker: "MISSING_IDENTIFIER", message: "Expected identifier in struct"),
Copy link
Contributor

Choose a reason for hiding this comment

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

"in struct" sounds a little weird to me, but the change to give them names looks good to me 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

This will be changed to Expected name of struct in one of my future PRs. I can’t find it right now, so it looks like I haven’t put it up yet.

@ahoppen
Copy link
Member Author

ahoppen commented Sep 9, 2022

@swift-ci Please test

@ahoppen ahoppen force-pushed the ahoppen/token-name-for-diagnostics branch from f657b60 to fbd3d19 Compare September 9, 2022 05:21
@ahoppen
Copy link
Member Author

ahoppen commented Sep 9, 2022

@swift-ci Please test

@ahoppen ahoppen force-pushed the ahoppen/token-name-for-diagnostics branch from fbd3d19 to 39e2b9a Compare September 20, 2022 13:33
@ahoppen
Copy link
Member Author

ahoppen commented Sep 20, 2022

@swift-ci Please test

@ahoppen ahoppen merged commit 13b2b57 into swiftlang:main Sep 20, 2022
@ahoppen ahoppen deleted the ahoppen/token-name-for-diagnostics branch September 20, 2022 19:40
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.

2 participants