Skip to content

Conversation

@modulovalue
Copy link
Contributor

This change adds a semantic predicate to the metadatum rule that checks whether there is whitespace between the constructor designation and the opening parenthesis of arguments.

Without this fix:

  • "@foo () f() {}" parses "()" as metadata arguments (incorrect)

With this fix:

  • "@foo() f() {}" parses "()" as metadata arguments (no whitespace)
  • "@foo () f() {}" parses "@foo" as metadata, "()" as record return type

The isNoSkip() function compares character positions to detect if any tokens (whitespace, comments) were skipped between the previous and current visible tokens.

Bug: #62384

This change adds a semantic predicate to the metadatum rule that checks
whether there is whitespace between the constructor designation and the
opening parenthesis of arguments.

Without this fix:
- "@foo () f() {}" parses "()" as metadata arguments (incorrect)

With this fix:
- "@foo() f() {}" parses "()" as metadata arguments (no whitespace)
- "@foo () f() {}" parses "@foo" as metadata, "()" as record return type

The isNoSkip() function compares character positions to detect if any
tokens (whitespace, comments) were skipped between the previous and
current visible tokens.

Bug: dart-lang#62384
@copybara-service
Copy link

Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at:

https://dart-review.googlesource.com/c/sdk/+/471863

Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly.

Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR).

@mraleph
Copy link
Member

mraleph commented Jan 23, 2026

Is this something we want to land @eernstg ?

@eernstg
Copy link
Member

eernstg commented Jan 23, 2026

Yes, I just haven't gotten around to it yet.

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