-
Notifications
You must be signed in to change notification settings - Fork 28
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
#2641. Check that it is still an error to declare more than one class member named _
#2669
Conversation
…one class member named `_`
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!
I suggested a small extension, in order to ensure that name clashes involving superinterfaces is covered as well.
I also noticed something that looks like a duplication of some test cases. I'm not quite sure how much duplication we have (or if there's actually a reason to have both that I didn't see), but PTAL.
// [cfe] unspecified | ||
} | ||
|
||
class C5 { |
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.
Perhaps create a variant?: C5Base
could have the instance member and we could have class C5 extends C5Base
or class C5 implements C5Base
. The point would be to verify that the error is detected also in the case where the instance member isn't in the same lexical scope.
static void set _(int v) {} // Ok | ||
} | ||
|
||
class C5 { |
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.
Same here: We could change a couple of these cases such that the instance member is in a superinterface.
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} |
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.
Isn't this a duplicate of something like C5
in LanguageFeatures/Wildcards/unchanged_A05_t06.dart?
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.
Perhaps the easiest way to avoid duplicates would be to have instance/static clashes in their own tests (like this one) and omit the instance/static clashes in those other tests (like A05_t06)? I'm not quite sure which approach is easier, but it does look like the current system will generate some duplicates.
(In some cases, e.g., augmenting declarations, it does make sense to test different orderings of elements; but in general we'll just have to assume that it has already been tested "somewhere else" that different textual orderings of declarations will give rise to the same name clash errors, otherwise everything will explode ;-).
A very good advices! Thank you! Implemented, PTAL |
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.
Thanks, LGTM!
2024-05-16 sgrekhov22@gmail.com dart-lang/co19#2641. Rename `unchanged` -> `other_declarations` (dart-lang/co19#2670) 2024-05-16 sgrekhov22@gmail.com dart-lang/co19#2641. Check that it is still an error to declare more than one class member named `_` (dart-lang/co19#2669) 2024-05-15 sgrekhov22@gmail.com dart-lang/co19#2641. Add tests for multiple top-level declarations named `_` (dart-lang/co19#2667) 2024-05-15 sgrekhov22@gmail.com dart-lang/co19#2641. Add tests for unchanged type declarations named `_` (dart-lang/co19#2666) 2024-05-14 sgrekhov22@gmail.com dart-lang/co19#2641. Add tests for unchanged declarations named `_` (dart-lang/co19#2665) 2024-05-14 sgrekhov22@gmail.com dart-lang/co19#2641. Add tests for multiple declarations named `_` (dart-lang/co19#2656) 2024-05-14 sgrekhov22@gmail.com Fixes dart-lang/co19#2661. Fix numerous typos in augmented_expression_A01_t09 (dart-lang/co19#2664) 2024-05-14 sgrekhov22@gmail.com Fixes dart-lang/co19#2659. Make unique extension members names in augmenting_types_A05_t04 (dart-lang/co19#2662) 2024-05-14 sgrekhov22@gmail.com Fixes dart-lang/co19#2660. Fix typos in augmented_expression_A01_t05 (dart-lang/co19#2663) 2024-05-14 sgrekhov22@gmail.com dart-lang/co19#2641. Add wildcard initializer tests (dart-lang/co19#2658) 2024-05-13 sgrekhov22@gmail.com dart-lang/co19#2119. Remove some accidental comments (dart-lang/co19#2657) Change-Id: I665f56c1039b14354019a32b94183f6d9c9bc5c7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367020 Reviewed-by: Erik Ernst <eernst@google.com> Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Alexander Thomas <athom@google.com>
No description provided.