Skip to content

[Parse] Move standalone_dollar_identifier diagnosis to Parser. #34534

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 1 commit into from
Nov 4, 2020

Conversation

mininny
Copy link
Contributor

@mininny mininny commented Nov 1, 2020

The compiler can't make up its mind as to whether $ is an identifier:

$ echo 'operator $' | swiftc -
<stdin>:1:10: error: '$' is not an identifier; use backticks to escape it
operator $
         ^
         `$`
<stdin>:1:10: error: '$' is considered an identifier and must not appear within an operator name
operator $
         ^

The first error should probably not be emitted in this context.

This PR moves dollar identifier diagnosis to Parser, and fixes the diagnosis for identifier_within_operator_name.

This is my first time committing to Swift repository, so if there are any issues, I'd appreciate any feedbacks! :)

Resolves SR-13092.

Copy link
Member

@rintaro rintaro left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! I think this is a good idea.

@mininny mininny force-pushed the fix-dollar-identifier branch 2 times, most recently from 165ba15 to dbf374f Compare November 2, 2020 21:41
@mininny
Copy link
Contributor Author

mininny commented Nov 2, 2020

Thank you @rintaro! I resolved all your comments.

@mininny mininny requested a review from rintaro November 2, 2020 21:44
@varungandhi-apple
Copy link
Contributor

Very small request: could you add "Resolves SR-13092." to the commit message and "// SR-13092" next to the test case you added? That would be helpful information in case anyone looks at the change in the future.

@mininny mininny force-pushed the fix-dollar-identifier branch from dbf374f to edbdbdb Compare November 2, 2020 23:56
@mininny
Copy link
Contributor Author

mininny commented Nov 2, 2020

@varungandhi-apple Done! :)

@varungandhi-apple
Copy link
Contributor

@swift-ci please smoke test

@rintaro
Copy link
Member

rintaro commented Nov 3, 2020

@swift-ci Please smoke test Linux

@mininny mininny force-pushed the fix-dollar-identifier branch from edbdbdb to 191676f Compare November 3, 2020 13:31
@mininny
Copy link
Contributor Author

mininny commented Nov 3, 2020

Fixed the comment! :) I'm not sure why the Linux test wasn't passing..

@xwu
Copy link
Collaborator

xwu commented Nov 3, 2020

@swift-ci please smoke test

Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis left a comment

Choose a reason for hiding this comment

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

Just one optional suggestion

@mininny mininny force-pushed the fix-dollar-identifier branch from 191676f to 028594b Compare November 4, 2020 12:27
@rintaro
Copy link
Member

rintaro commented Nov 4, 2020

@swift-ci Please smoke test

@rintaro rintaro merged commit 5b8e514 into swiftlang:main Nov 4, 2020
@rintaro
Copy link
Member

rintaro commented Nov 4, 2020

Thank you Minhyuk!

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.

5 participants