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 int getInt() => 0; |
| 9 num getNum() => 0; |
| 10 double getDouble() => 0.0; |
| 11 |
| 12 void test1(int t) { |
| 13 var /*@type=int*/ v1 = t = getInt(); |
| 14 var /*@type=num*/ v2 = t = getNum(); |
| 15 var /*@type=int*/ v4 = t ??= getInt(); |
| 16 var /*@type=num*/ v5 = t ??= getNum(); |
| 17 var /*@type=int*/ v7 = t += getInt(); |
| 18 var /*@type=num*/ v8 = t += getNum(); |
| 19 var /*@type=int*/ v10 = ++t; |
| 20 var /*@type=int*/ v11 = t++; |
| 21 } |
| 22 |
| 23 void test2(num t) { |
| 24 var /*@type=int*/ v1 = t = getInt(); |
| 25 var /*@type=num*/ v2 = t = getNum(); |
| 26 var /*@type=double*/ v3 = t = getDouble(); |
| 27 var /*@type=num*/ v4 = t ??= getInt(); |
| 28 var /*@type=num*/ v5 = t ??= getNum(); |
| 29 var /*@type=num*/ v6 = t ??= getDouble(); |
| 30 var /*@type=num*/ v7 = t += getInt(); |
| 31 var /*@type=num*/ v8 = t += getNum(); |
| 32 var /*@type=num*/ v9 = t += getDouble(); |
| 33 var /*@type=num*/ v10 = ++t; |
| 34 var /*@type=num*/ v11 = t++; |
| 35 } |
| 36 |
| 37 void test3(double t) { |
| 38 var /*@type=num*/ v2 = t = getNum(); |
| 39 var /*@type=double*/ v3 = t = getDouble(); |
| 40 var /*@type=num*/ v5 = t ??= getNum(); |
| 41 var /*@type=double*/ v6 = t ??= getDouble(); |
| 42 var /*@type=double*/ v7 = t += getInt(); |
| 43 var /*@type=double*/ v8 = t += getNum(); |
| 44 var /*@type=double*/ v9 = t += getDouble(); |
| 45 var /*@type=double*/ v10 = ++t; |
| 46 var /*@type=double*/ v11 = t++; |
| 47 } |
| 48 |
| 49 main() {} |
OLD | NEW |