@@ -293,7 +293,7 @@ since the new syntax is either not allowed by the existing grammar, or it is rej
293
293
context expression runtime type and const-ness
294
294
*/
295
295
var v1 = {}; // LinkedHashMap<dynamic, dynamic>
296
- var v2 = <int, int>{}; // LinkedMap <int, int>
296
+ var v2 = <int, int>{}; // LinkedHashMap <int, int>
297
297
var v3 = <int>{}; // LinkedHashSet<int>
298
298
var v4 = {1: 1}; // LinkedHashMap<int, int>
299
299
var v5 = {1}; // LinkedHashSet<int>
@@ -307,19 +307,19 @@ LinkedHashSet<int> v11 = {}; // LinkedHashSet<int>
307
307
308
308
const v12 = {}; // const Map<dynamic, dynamic>
309
309
const v13 = {1}; // const Set<int>
310
- const Set v14 = {} // const Set<dynamic>
311
- Set v15 = const {4} // const Set<dynamic>
310
+ const Set v14 = {}; // const Set<dynamic>
311
+ Set v15 = const {4}; // const Set<dynamic>
312
312
313
313
// Compile-time error, overrides `==`.
314
314
// const _ = {Duration(seconds: 1)};
315
315
// const _ = {2.3};
316
316
317
317
var v16 = {1, 2, 3, 2, 1}; // LinkedHashSet<int>
318
- var l16 = x .toList(); // -> <int>[1, 2, 3]
318
+ var l16 = v16 .toList(); // -> <int>[1, 2, 3]
319
319
// Compile-time error, contains equal elements
320
320
// const _ = {1, 2, 3, 2, 1};
321
321
322
- var l18 = const {1, 2} // const Set<int>
322
+ var l18 = const {1, 2}; // const Set<int>
323
323
324
324
// Class overriding `==`.
325
325
class C {
@@ -332,17 +332,17 @@ class C {
332
332
}
333
333
334
334
// First equal object wins.
335
- var v19 = {C(1, "a"), C(2, "a"), C("1" , b")}; // LinkedHashSet<C>
335
+ var v19 = {C(1, "a"), C(2, "a"), C(1 , b")}; // LinkedHashSet<C>
336
336
print(v19); // {C(1, "a"), C(2, "a")}
337
337
338
338
const v20 = {1, 2, 3}; // const Set<int>
339
339
const v21 = {3, 2, 1}; // const Set<int>
340
340
print(identical(v20, v21)); // -> false
341
341
342
342
// Type can be computed from element types.
343
- var v23 = {1, 2.5} // LinkedHashSet<num>
344
- var v24 = {1, false} // LinkedHashSet<Object>
345
- const v26 = {1, false} // const Set<Object>
343
+ var v23 = {1, 2.5}; // LinkedHashSet<num>
344
+ var v24 = {1, false}; // LinkedHashSet<Object>
345
+ const v26 = {1, false}; // const Set<Object>
346
346
```
347
347
348
348
### With Spreads
@@ -352,8 +352,8 @@ var s2 = {...{1}}; // Set<int>
352
352
var s3 = {...{1: 1}}; // Map<int, int>
353
353
var s4 = {...{}}; // Map<dynamic, dynamic>
354
354
dynamic d = null; // or any value.
355
- var s5 = {...{1}, ...?d} // Set<dynamic>
356
- var s6 = {...{1: 1}, ...?d} // Map<dynamic, dynamic>
355
+ var s5 = {...{1}, ...?d}; // Set<dynamic>
356
+ var s6 = {...{1: 1}, ...?d}; // Map<dynamic, dynamic>
357
357
// var s7 = {...?d}; // Compile-time error, ambiguous
358
358
// var s8 = {...{1}, ...{1: 1}}; // Compile-time error, incompatible
359
359
```
0 commit comments