| 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 /*@target=Map::[]=*/ [3] = 'z'; | 10 x /*@target=Map::[]=*/ [3] = 'z'; |
| 11 /*@promotedType=none*/ x /*@target=Map::[]=*/ [ | 11 x /*@target=Map::[]=*/ [ |
| 12 /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w'; | 12 /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w'; |
| 13 /*@promotedType=none*/ x /*@target=Map::[]=*/ [ | 13 x /*@target=Map::[]=*/ [ |
| 14 /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u'; | 14 /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 4.0] = 'u'; |
| 15 /*@promotedType=none*/ x /*@target=Map::[]=*/ [ | 15 x /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42; |
| 16 3] = /*error:INVALID_ASSIGNMENT*/ 42; | 16 Map<num, String> y = x; |
| 17 Map<num, String> y = /*@promotedType=none*/ x; | |
| 18 } | 17 } |
| 19 | 18 |
| 20 test2() { | 19 test2() { |
| 21 var /*@type=Map<num, Pattern>*/ x = /*@typeArgs=num, Pattern*/ { | 20 var /*@type=Map<num, Pattern>*/ x = /*@typeArgs=num, Pattern*/ { |
| 22 1: 'x', | 21 1: 'x', |
| 23 2: 'y', | 22 2: 'y', |
| 24 3.0: new RegExp('.') | 23 3.0: new RegExp('.') |
| 25 }; | 24 }; |
| 26 /*@promotedType=none*/ x /*@target=Map::[]=*/ [3] = 'z'; | 25 x /*@target=Map::[]=*/ [3] = 'z'; |
| 27 /*@promotedType=none*/ x /*@target=Map::[]=*/ [ | 26 x /*@target=Map::[]=*/ [ |
| 28 /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w'; | 27 /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ 'hi'] = 'w'; |
| 29 /*@promotedType=none*/ x /*@target=Map::[]=*/ [4.0] = 'u'; | 28 x /*@target=Map::[]=*/ [4.0] = 'u'; |
| 30 /*@promotedType=none*/ x /*@target=Map::[]=*/ [ | 29 x /*@target=Map::[]=*/ [3] = /*error:INVALID_ASSIGNMENT*/ 42; |
| 31 3] = /*error:INVALID_ASSIGNMENT*/ 42; | |
| 32 Pattern p = null; | 30 Pattern p = null; |
| 33 /*@promotedType=none*/ x /*@target=Map::[]=*/ [2] = /*@promotedType=none*/ p; | 31 x /*@target=Map::[]=*/ [2] = p; |
| 34 Map<int, String> y = /*info:ASSIGNMENT_CAST*/ /*@promotedType=none*/ x; | 32 Map<int, String> y = /*info:ASSIGNMENT_CAST*/ x; |
| 35 } | 33 } |
| OLD | NEW |