| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /*@testedFeatures=inference*/ |
| 6 library test; |
| 7 |
| 8 test1() { |
| 9 var /*@type=Map<int, String>*/ x = /*@typeArgs=int, String*/ {1: 'x', 2: 'y'}; |
| 10 /*@promotedType=none*/ x[3] = 'z'; |
| 11 /*@promotedType=none*/ x[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w'; |
| 12 /*@promotedType=none*/ x[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u'; |
| 13 /*@promotedType=none*/ x[3] = /*error:INVALID_ASSIGNMENT*/ 42; |
| 14 Map<num, String> y = /*@promotedType=none*/ x; |
| 15 } |
| 16 |
| 17 test2() { |
| 18 var /*@type=Map<num, Pattern>*/ x = /*@typeArgs=num, Pattern*/ { |
| 19 1: 'x', |
| 20 2: 'y', |
| 21 3.0: new RegExp('.') |
| 22 }; |
| 23 /*@promotedType=none*/ x[3] = 'z'; |
| 24 /*@promotedType=none*/ x[/*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w'; |
| 25 /*@promotedType=none*/ x[4.0] = 'u'; |
| 26 /*@promotedType=none*/ x[3] = /*error:INVALID_ASSIGNMENT*/ 42; |
| 27 Pattern p = null; |
| 28 /*@promotedType=none*/ x[2] = /*@promotedType=none*/ p; |
| 29 Map<int, String> y = /*info:ASSIGNMENT_CAST*/ /*@promotedType=none*/ x; |
| 30 } |
| OLD | NEW |