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 int getInt() => 0; | 8 int getInt() => 0; |
9 num getNum() => 0; | 9 num getNum() => 0; |
10 double getDouble() => 0.0; | 10 double getDouble() => 0.0; |
11 | 11 |
12 abstract class Base<T, U> { | 12 abstract class Base<T, U> { |
13 T operator [](String s); | 13 T operator [](String s) => /*@target=Base::getValue*/ getValue(s); |
14 void operator []=(String s, U v); | 14 void operator []=(String s, U v) => /*@target=Base::setValue*/ setValue(s, v); |
| 15 |
| 16 T getValue(String s); |
| 17 void setValue(String s, U v); |
15 } | 18 } |
16 | 19 |
17 abstract class Test1 extends Base<int, int> { | 20 abstract class Test1 extends Base<int, int> { |
18 void test() { | 21 void test() { |
19 var /*@type=int*/ v1 = super /*@target=Base::[]=*/ ['x'] = getInt(); | 22 var /*@type=int*/ v1 = super /*@target=Base::[]=*/ ['x'] = getInt(); |
20 var /*@type=num*/ v2 = super /*@target=Base::[]=*/ ['x'] = getNum(); | 23 var /*@type=num*/ v2 = super /*@target=Base::[]=*/ ['x'] = getNum(); |
21 var /*@type=int*/ v4 = super /*@target=Base::[]=*/ ['x'] ??= getInt(); | 24 var /*@type=int*/ v4 = super /*@target=Base::[]=*/ ['x'] ??= getInt(); |
22 var /*@type=num*/ v5 = super /*@target=Base::[]=*/ ['x'] ??= getNum(); | 25 var /*@type=num*/ v5 = super /*@target=Base::[]=*/ ['x'] ??= getNum(); |
23 var /*@type=int*/ v7 = super /*@target=Base::[]=*/ ['x'] += getInt(); | 26 var /*@type=int*/ v7 = super /*@target=Base::[]=*/ ['x'] += getInt(); |
24 var /*@type=num*/ v8 = super /*@target=Base::[]=*/ ['x'] += getNum(); | 27 var /*@type=num*/ v8 = super /*@target=Base::[]=*/ ['x'] += getNum(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 var /*@type=double*/ v6 = super /*@target=Base::[]=*/ ['x'] ??= getDouble(); | 140 var /*@type=double*/ v6 = super /*@target=Base::[]=*/ ['x'] ??= getDouble(); |
138 var /*@type=double*/ v7 = super /*@target=Base::[]=*/ ['x'] += getInt(); | 141 var /*@type=double*/ v7 = super /*@target=Base::[]=*/ ['x'] += getInt(); |
139 var /*@type=double*/ v8 = super /*@target=Base::[]=*/ ['x'] += getNum(); | 142 var /*@type=double*/ v8 = super /*@target=Base::[]=*/ ['x'] += getNum(); |
140 var /*@type=double*/ v9 = super /*@target=Base::[]=*/ ['x'] += getDouble(); | 143 var /*@type=double*/ v9 = super /*@target=Base::[]=*/ ['x'] += getDouble(); |
141 var /*@type=double*/ v10 = ++super /*@target=Base::[]=*/ ['x']; | 144 var /*@type=double*/ v10 = ++super /*@target=Base::[]=*/ ['x']; |
142 var /*@type=double*/ v11 = super /*@target=Base::[]=*/ ['x']++; | 145 var /*@type=double*/ v11 = super /*@target=Base::[]=*/ ['x']++; |
143 } | 146 } |
144 } | 147 } |
145 | 148 |
146 main() {} | 149 main() {} |
OLD | NEW |