Skip to content

Invalid test: LanguageFeatures/Set-literals/non_constant_set_literals_A02_t01.dart #216

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

Closed
bwilkerson opened this issue Jan 8, 2019 · 2 comments
Assignees

Comments

@bwilkerson
Copy link
Member

On line 47 a constant set is created that contains duplicate elements, but the line is not marked as expecting an error. Either the duplicate elements should be removed or the line should be annotated.

@sgrekhov sgrekhov self-assigned this Jan 9, 2019
@sgrekhov
Copy link
Contributor

sgrekhov commented Jan 9, 2019

@bwilkerson, according to the feature specification

Let e1 … en be the constant element expressions of s in source order, and let v1 … vn be their respective constant values. Evaluation of s creates an unmodifiable object implementing Set with v1 … vn as elements, except that if any of v1 … vn are equal, only the first value of such equal values is included.

So, according to the above, I believe, that it is not an error. If there are duplicating elements, then, only the first one of them should be taken.

@lrhn
Copy link
Member

lrhn commented Jan 9, 2019

I've removed that sentence now. It's obsolete because two lines above that is says:

It is a compile-time error if any two of the values are equal according to ==.

(There are also rules disallowing the elements from overriding Object.operator==.)

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

No branches or pull requests

3 participants