Skip to content
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

Merged
merged 2 commits into from
May 16, 2024

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!

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 {
Copy link
Member

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 {
Copy link
Member

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
}
Copy link
Member

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?

Copy link
Member

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 ;-).

@sgrekhov
Copy link
Contributor Author

A very good advices! Thank you! Implemented, PTAL

@sgrekhov sgrekhov requested a review from eernstg May 16, 2024 11:10
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.

Thanks, LGTM!

@eernstg eernstg merged commit 15158f7 into dart-lang:master May 16, 2024
2 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request May 17, 2024
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>
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.

None yet

2 participants