-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Fix 21062 - Confusing error when using a keyword as an identifier for… #14627
Conversation
|
Thanks for your pull request and interest in making D better, @dkorpel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#14627" |
5b49d3e to
d124ecb
Compare
| static foreach (link; Links) | ||
| { | ||
| @("extern("~link~")") | ||
| unittest | ||
| { | ||
| auto t = parseModule("test.d", "first_token extern("~link~")"); | ||
|
|
||
| scope visitor = new LinkVisitor; | ||
| t.module_.accept(visitor); | ||
|
|
||
| assert(visitor.l.linnum == 1); | ||
| assert(visitor.l.charnum == 13); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why it's testing the location on a broken AST, the following tests look more sensible (except the 'first_token' part).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem related to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this PR, when the parser sees a keyword used as an identifier, it skips over it (nextToken()) to prevent further broken error messages. This broken test relied on the fact that after encountering a declaration named extern with type first_token, it would continue with parsing the extern declaration anyways.
… a declaration