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