@@ -118,6 +118,7 @@ or if *T* is not a compile-time constant type. It is a compile-time error if any
118118override ` Object.operator== ` unless they are instances of ` int ` or ` String ` , objects implementing ` Symbol ` originally created by
119119a symbol literal or a constant invocation of the ` Symbol ` constructor, or objects implementing ` Type ` originally created by
120120a constant type literal expression.
121+ It is a compile-time error if any two of the values are equal according to ` == ` .
121122
122123Let * e<sub >1</sub >* … * e<sub >n</sub >* be the constant element expressions of * s* in source order,
123124and let * v* <sub >1</sub > … * v<sub >n</sub >* be their respective constant values.
@@ -315,9 +316,9 @@ Set v15 = const {4} // const Set<dynamic>
315316
316317var v16 = {1, 2, 3, 2, 1}; // LinkedHashSet<int>
317318var l16 = x.toList(); // -> <int>[1, 2, 3]
318- const v17 = {1, 2, 3, 2, 1}; // const Set<int>
319- var l17 = x.toList(); // -> <int>[ 1, 2, 3]
320- // v17.add(42); // throws, immutable
319+ // Compile-time error, contains equal elements
320+ // const _ = { 1, 2, 3, 2, 1};
321+
321322var l18 = const {1, 2} // const Set<int>
322323
323324// Class overriding `==`.
@@ -336,9 +337,7 @@ print(v19); // {C(1, "a"), C(2, "a")}
336337
337338const v20 = {1, 2, 3}; // const Set<int>
338339const v21 = {3, 2, 1}; // const Set<int>
339- const v22 = {1, 1, 2, 3, 2, 1}; // const Set<int>
340340print(identical(v20, v21)); // -> false
341- print(identical(v20, v22)); // -> true
342341
343342// Type can be computed from element types.
344343var v23 = {1, 2.5} // LinkedHashSet<num>
0 commit comments