Skip to content

Improve diagnostic message if unexpected tokens are found at the start of a layout node #736

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 Sep 8, 2022

This helps us produce better error messages once we implement recovery in front of declarations.

Unfortunately, we don’t have a test case that exercises the new paths yet.

Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

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

Doug and I added some more tests that are messing with you here :)

…t of a layout node

This helps us produce better error messages once we implement recovery in front of declarations.
@ahoppen ahoppen force-pushed the ahoppen/unexpected-at-start-of-layout branch from a633470 to e605486 Compare September 8, 2022 19:48
@ahoppen
Copy link
Member Author

ahoppen commented Sep 8, 2022

@swift-ci Please test

@CodaFi CodaFi merged commit 8d5b3b6 into swiftlang:main Sep 8, 2022
Comment on lines +19 to +24
/// Return a name of this syntax node that can be used to describe it in
/// diagnostics.
/// Nodes that mostly exist for the syntax tree's structure and don't have a
/// correspondence in the source code that's meeingful to the user by default
/// use the name of the parent node that encloses it. Pass `false` to `inherit`
/// to prevent this name inheritance.
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is already merged, but FWIW there's meeingful + that sentence is a little hard to parse. Maybe:

Return the name of this syntax node to be used to describe it in diagnostics. If the node itself has no diagnostic name (eg. it exists for the syntax tree's structure), use the name of the enclosing parent node by default. Pass inherit: false to prevent this behavior, in which case nil will be returned instead.

Copy link
Member Author

@ahoppen ahoppen Sep 9, 2022

Choose a reason for hiding this comment

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

Thanks for the suggestion. I put up a PR to incorporate the new description #760

@ahoppen ahoppen deleted the ahoppen/unexpected-at-start-of-layout branch September 9, 2022 13:15
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.

3 participants