-
Notifications
You must be signed in to change notification settings - Fork 28
#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
Conversation
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.
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 |
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.
'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.
final
and 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; |
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.
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); | ||
} |
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.
Cool! The parser could get confused about these situations, e.g., it could crash, and we should test this.
Updated. Please rereview |
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.
LGTM
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]>
No description provided.