| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 // Test that optimized '-' and slow path '-' produce the same error. | 7 // Test that optimized '-' and slow path '-' produce the same error. |
| 8 | 8 |
| 9 @NoInline() | 9 @NoInline() |
| 10 @AssumeDynamic() | 10 @AssumeDynamic() |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 static f3() { | 47 static f3() { |
| 48 return (confuse(1) as int) - confuse(null); | 48 return (confuse(1) as int) - confuse(null); |
| 49 } | 49 } |
| 50 | 50 |
| 51 static f4() { | 51 static f4() { |
| 52 return (confuse(1) as int) - null; | 52 return (confuse(1) as int) - null; |
| 53 } | 53 } |
| 54 | 54 |
| 55 static f5() { | 55 static f5() { |
| 56 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 56 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
| 57 return a - confuse(null); | 57 return a - confuse(null); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static f6() { | 60 static f6() { |
| 61 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 61 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
| 62 return a - null; | 62 return a - null; |
| 63 } | 63 } |
| 64 | 64 |
| 65 static f7() { | 65 static f7() { |
| 66 return 1 - null; | 66 return 1 - null; |
| 67 } | 67 } |
| 68 | 68 |
| 69 static test() { | 69 static test() { |
| 70 check('IntMinusNull', f1, f2, f3, f4, f5, f6, f7); | 70 check('IntMinusNull', f1, f2, f3, f4, f5, f6, f7); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 class IntMinusString { | 74 class IntMinusString { |
| 75 static f1() { | 75 static f1() { |
| 76 return confuse(1) - confuse('a'); | 76 return confuse(1) - confuse('a'); |
| 77 } | 77 } |
| 78 | 78 |
| 79 static f2() { | 79 static f2() { |
| 80 return confuse(1) - 'a'; | 80 return confuse(1) - 'a'; |
| 81 } | 81 } |
| 82 | 82 |
| 83 static f3() { | 83 static f3() { |
| 84 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 84 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
| 85 return a - confuse('a'); | 85 return a - confuse('a'); |
| 86 } | 86 } |
| 87 | 87 |
| 88 static f4() { | 88 static f4() { |
| 89 return (confuse(1) as int) - confuse('a'); | 89 return (confuse(1) as int) - confuse('a'); |
| 90 } | 90 } |
| 91 | 91 |
| 92 static f5() { | 92 static f5() { |
| 93 return (confuse(1) as int) - 'a'; | 93 return (confuse(1) as int) - 'a'; |
| 94 } | 94 } |
| 95 | 95 |
| 96 static f6() { | 96 static f6() { |
| 97 var a = confuse(true) ? 1 : 2; // Small int with unknown value. | 97 var a = confuse(true) ? 1 : 2; // Small int with unknown value. |
| 98 return a - 'a'; | 98 return a - 'a'; |
| 99 } | 99 } |
| 100 | 100 |
| 101 static f7() { | 101 static f7() { |
| 102 return 1 - 'a'; | 102 return 1 - 'a'; |
| 103 } | 103 } |
| 104 | 104 |
| 105 static test() { | 105 static test() { |
| 106 check('IntMinusString', f1, f2, f3, f4, f5, f6, f7); | 106 check('IntMinusString', f1, f2, f3, f4, f5, f6, f7); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 main() { | 110 main() { |
| 111 IntMinusNull.test(); | 111 IntMinusNull.test(); |
| 112 IntMinusString.test(); | 112 IntMinusString.test(); |
| 113 } | 113 } |
| OLD | NEW |