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 main() { |
| 9 num n = 1; |
| 10 int i = 1; |
| 11 double d = 1.0; |
| 12 |
| 13 // (double, double) -> double |
| 14 var /*@type=double*/ ddPlus = d /*@target=double::+*/ + d; |
| 15 var /*@type=double*/ ddMinus = d /*@target=double::-*/ - d; |
| 16 var /*@type=double*/ ddTimes = d /*@target=double::**/ * d; |
| 17 var /*@type=double*/ ddMod = d /*@target=double::%*/ % d; |
| 18 |
| 19 // (double, int) -> double |
| 20 var /*@type=double*/ diPlus = d /*@target=double::+*/ + i; |
| 21 var /*@type=double*/ diMinus = d /*@target=double::-*/ - i; |
| 22 var /*@type=double*/ diTimes = d /*@target=double::**/ * i; |
| 23 var /*@type=double*/ diMod = d /*@target=double::%*/ % i; |
| 24 |
| 25 // (double, num) -> double |
| 26 var /*@type=double*/ dnPlus = d /*@target=double::+*/ + n; |
| 27 var /*@type=double*/ dnMinus = d /*@target=double::-*/ - n; |
| 28 var /*@type=double*/ dnTimes = d /*@target=double::**/ * n; |
| 29 var /*@type=double*/ dnMod = d /*@target=double::%*/ % n; |
| 30 |
| 31 // (int, double) -> double |
| 32 var /*@type=double*/ idPlus = i /*@target=num::+*/ + d; |
| 33 var /*@type=double*/ idMinus = i /*@target=num::-*/ - d; |
| 34 var /*@type=double*/ idTimes = i /*@target=num::**/ * d; |
| 35 var /*@type=double*/ idMod = i /*@target=num::%*/ % d; |
| 36 |
| 37 // (int, int) -> int |
| 38 var /*@type=int*/ iiPlus = i /*@target=num::+*/ + i; |
| 39 var /*@type=int*/ iiMinus = i /*@target=num::-*/ - i; |
| 40 var /*@type=int*/ iiTimes = i /*@target=num::**/ * i; |
| 41 var /*@type=int*/ iiMod = i /*@target=num::%*/ % i; |
| 42 |
| 43 // (int, num) -> num |
| 44 var /*@type=num*/ inPlus = i /*@target=num::+*/ + n; |
| 45 var /*@type=num*/ inMinus = i /*@target=num::-*/ - n; |
| 46 var /*@type=num*/ inTimes = i /*@target=num::**/ * n; |
| 47 var /*@type=num*/ inMod = i /*@target=num::%*/ % n; |
| 48 |
| 49 // (num, double) -> num |
| 50 var /*@type=num*/ ndPlus = n /*@target=num::+*/ + d; |
| 51 var /*@type=num*/ ndMinus = n /*@target=num::-*/ - d; |
| 52 var /*@type=num*/ ndTimes = n /*@target=num::**/ * d; |
| 53 var /*@type=num*/ ndMod = n /*@target=num::%*/ % d; |
| 54 |
| 55 // (num, int) -> num |
| 56 var /*@type=num*/ niPlus = n /*@target=num::+*/ + i; |
| 57 var /*@type=num*/ niMinus = n /*@target=num::-*/ - i; |
| 58 var /*@type=num*/ niTimes = n /*@target=num::**/ * i; |
| 59 var /*@type=num*/ niMod = n /*@target=num::%*/ % i; |
| 60 |
| 61 // (num, num) -> num |
| 62 var /*@type=num*/ nnPlus = n /*@target=num::+*/ + n; |
| 63 var /*@type=num*/ nnMinus = n /*@target=num::-*/ - n; |
| 64 var /*@type=num*/ nnTimes = n /*@target=num::**/ * n; |
| 65 var /*@type=num*/ nnMod = n /*@target=num::%*/ % n; |
| 66 } |
OLD | NEW |