Skip to content

#1959. Grammar tests added #2031

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 2 commits into from
Apr 28, 2023
Merged

#1959. Grammar tests added #2031

merged 2 commits into from
Apr 28, 2023

Conversation

sgrekhov
Copy link
Contributor

No description provided.

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

Looks good! There is one issue about the classification of "keywords". And I think we have to be tough on duplication. So I commented on that.

///
/// @description Check that it is a compile-time error if any of
/// keywords/built-in identifiers `abstract`, `final`, `interface`, `mixin`, or
/// `class` is used as an identifier
Copy link
Member

Choose a reason for hiding this comment

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

'keyword' is not specified, that's just a loose word which can be used when we want to give a hint that we are talking about a special word (and it could include hide and other words which are actually just plain identifiers, but occur somewhere in the grammar).

abstract, interface, mixin, are built-in identifiers.
finaland class are reserved words.

So final and class cannot be an identifier at all, but abstract/interface/mixin can be the names of everything except types.

There is no need to test the treatment of reserved words, they have been unchanged for many years, and they have been tested before this feature. Similarly, there is no need to test abstract or mixin, that's been done earlier.

So we should test interface as a built-in identifier, it's a new thing that we are actually using that word in the grammar.

That's a small test, but that's OK. ;-)

var sealed = 2;
var interface = 3;
var abstract = 4;
var mixin = 5;
Copy link
Member

Choose a reason for hiding this comment

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

Again, to avoid duplication that accumulates over time, I think we should omit the tests dealing with abstract and mixin.

print(C5);
print(C6);
print(C7);
}
Copy link
Member

Choose a reason for hiding this comment

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

Cool! The parser could get confused about these situations, e.g., it could crash, and we should test this.

@sgrekhov
Copy link
Contributor Author

Updated. Please rereview

@sgrekhov sgrekhov requested a review from eernstg April 28, 2023 13:18
Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

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

LGTM

@eernstg eernstg merged commit be5c6fa into dart-lang:master Apr 28, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request May 4, 2023
2023-05-04 [email protected] Fixes dart-lang/co19#2034. Fix roll failures, add issues numbers (dart-lang/co19#2035)
2023-05-03 [email protected] dart-lang/co19#1401. Async for-in tests for patterns (dart-lang/co19#2032)
2023-04-28 [email protected] dart-lang/co19#1959. Grammar tests added (dart-lang/co19#2031)
2023-04-28 [email protected] dart-lang/co19#1959. Versioning tests added (dart-lang/co19#2029)

Change-Id: Ic29913ebd7260c4069e6baa27a797219ce12d956
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301440
Reviewed-by: Alexander Thomas <[email protected]>
@sgrekhov sgrekhov deleted the co19-1959-8 branch July 18, 2023 11:31
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.

2 participants