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 class Base { |
| 13 int intProp; |
| 14 num numProp; |
| 15 double doubleProp; |
| 16 } |
| 17 |
| 18 class Test1 extends Base { |
| 19 void test() { |
| 20 var /*@type=int*/ v1 = super. /*@target=Base::intProp*/ intProp = getInt(); |
| 21 var /*@type=num*/ v2 = super. /*@target=Base::intProp*/ intProp = getNum(); |
| 22 var /*@type=int*/ v4 = |
| 23 super. /*@target=Base::intProp*/ intProp ??= getInt(); |
| 24 var /*@type=num*/ v5 = |
| 25 super. /*@target=Base::intProp*/ intProp ??= getNum(); |
| 26 var /*@type=int*/ v7 = super. /*@target=Base::intProp*/ intProp += getInt(); |
| 27 var /*@type=num*/ v8 = super. /*@target=Base::intProp*/ intProp += getNum(); |
| 28 var /*@type=int*/ v10 = ++super. /*@target=Base::intProp*/ intProp; |
| 29 var /*@type=int*/ v11 = super. /*@target=Base::intProp*/ intProp++; |
| 30 } |
| 31 } |
| 32 |
| 33 class Test2 extends Base { |
| 34 void test() { |
| 35 var /*@type=int*/ v1 = super. /*@target=Base::numProp*/ numProp = getInt(); |
| 36 var /*@type=num*/ v2 = super. /*@target=Base::numProp*/ numProp = getNum(); |
| 37 var /*@type=double*/ v3 = |
| 38 super. /*@target=Base::numProp*/ numProp = getDouble(); |
| 39 var /*@type=num*/ v4 = |
| 40 super. /*@target=Base::numProp*/ numProp ??= getInt(); |
| 41 var /*@type=num*/ v5 = |
| 42 super. /*@target=Base::numProp*/ numProp ??= getNum(); |
| 43 var /*@type=num*/ v6 = |
| 44 super. /*@target=Base::numProp*/ numProp ??= getDouble(); |
| 45 var /*@type=num*/ v7 = super. /*@target=Base::numProp*/ numProp += getInt(); |
| 46 var /*@type=num*/ v8 = super. /*@target=Base::numProp*/ numProp += getNum(); |
| 47 var /*@type=num*/ v9 = |
| 48 super. /*@target=Base::numProp*/ numProp += getDouble(); |
| 49 var /*@type=num*/ v10 = ++super. /*@target=Base::numProp*/ numProp; |
| 50 var /*@type=num*/ v11 = super. /*@target=Base::numProp*/ numProp++; |
| 51 } |
| 52 } |
| 53 |
| 54 class Test3 extends Base { |
| 55 void test3() { |
| 56 var /*@type=num*/ v2 = |
| 57 super. /*@target=Base::doubleProp*/ doubleProp = getNum(); |
| 58 var /*@type=double*/ v3 = |
| 59 super. /*@target=Base::doubleProp*/ doubleProp = getDouble(); |
| 60 var /*@type=num*/ v5 = |
| 61 super. /*@target=Base::doubleProp*/ doubleProp ??= getNum(); |
| 62 var /*@type=double*/ v6 = |
| 63 super. /*@target=Base::doubleProp*/ doubleProp ??= getDouble(); |
| 64 var /*@type=double*/ v7 = |
| 65 super. /*@target=Base::doubleProp*/ doubleProp += getInt(); |
| 66 var /*@type=double*/ v8 = |
| 67 super. /*@target=Base::doubleProp*/ doubleProp += getNum(); |
| 68 var /*@type=double*/ v9 = |
| 69 super. /*@target=Base::doubleProp*/ doubleProp += getDouble(); |
| 70 var /*@type=double*/ v10 = ++super. /*@target=Base::doubleProp*/ doubleProp; |
| 71 var /*@type=double*/ v11 = super. /*@target=Base::doubleProp*/ doubleProp++; |
| 72 } |
| 73 } |
| 74 |
| 75 main() {} |
OLD | NEW |