OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 // VMOptions=--optimization_counter_threshold=10 --no-use-osr |
| 5 |
| 6 import "package:expect/expect.dart"; |
| 7 |
| 8 class X { |
| 9 operator * (other) => "NaNNaNNaNNaNBatman"; |
| 10 } |
| 11 |
| 12 foo(x) => (x * 1.0) is double; |
| 13 |
| 14 bar(x) { |
| 15 try { |
| 16 int i = (x * 1); |
| 17 return true; |
| 18 } catch (e) { |
| 19 return false; |
| 20 } |
| 21 } |
| 22 |
| 23 baz(x) => (x * 1) == x; |
| 24 |
| 25 main() { |
| 26 for (var i = 0; i < 100; i++) { |
| 27 Expect.isTrue(foo(1.0)); |
| 28 assert(() { |
| 29 Expect.isTrue(bar(-1 << 63)); |
| 30 return true; |
| 31 }); |
| 32 Expect.isTrue(baz(-1 << 63)); |
| 33 } |
| 34 Expect.isFalse(foo(new X())); |
| 35 assert(() { |
| 36 Expect.isFalse(bar(new X())); |
| 37 return true; |
| 38 }); |
| 39 Expect.isFalse(baz(new X())); |
| 40 } |
| 41 |
OLD | NEW |