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-13092] operator $ produces two contradictory error messages #55538

Closed
mikeash opened this issue Jun 26, 2020 · 8 comments
Closed

[SR-13092] operator $ produces two contradictory error messages #55538

mikeash opened this issue Jun 26, 2020 · 8 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers parser Area → compiler: The legacy C++ parser

Comments

@mikeash
Copy link
Contributor

mikeash commented Jun 26, 2020

Previous ID SR-13092
Radar rdar://problem/64947428
Original Reporter @mikeash
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Parser, StarterBug
Assignee mininny (JIRA)
Priority Medium

md5: dfebb9f4735d36505b75363ef7f7ec86

Issue Description:

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.

@typesanitizer
Copy link

@swift-ci create

@typesanitizer
Copy link

According to the reference:

> Custom operators can begin with one of the ASCII characters /, =, -, +, !, *, %, <, >, &, |, ^, ?, or ~, or one of the Unicode characters defined in the grammar below

The fix here should make the first diagnostic go away. The PR should update test/Parse/dollar_identifier.swift with this test case.

@theblixguy
Copy link
Collaborator

One of these errors (I can’t remember which one...) is coming from the Lexer. I think it needs to be moved into the Parser.

@swift-ci
Copy link
Collaborator

swift-ci commented Aug 4, 2020

Comment by Vuk (JIRA)

I'd like to take this on if it is still available. theindigamer (JIRA User)

@typesanitizer
Copy link

Sure thing. Please feel free to assign the Jira to yourself, look at our README for building instructions and ask me any questions about building/running tests/fixing the bug etc.

Note that you will need a recent version of CMake (3.18.1 or higher, available via homebrew for macOS) and Xcode beta if you are using Xcode.

@swift-ci
Copy link
Collaborator

swift-ci commented Nov 1, 2020

Comment by Minhyuk Kim (JIRA)

I didn't see any progress on this issue, so I picked it up and created a PR. 🙂 theindigamer (JIRA User)

@mikeash
Copy link
Contributor Author

mikeash commented Dec 3, 2020

@mikeash
Copy link
Contributor Author

mikeash commented Dec 3, 2020

Hmm, I guess it doesn't like emjois. Oh well. Yay!

@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 good first issue Good for newcomers parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

4 participants