OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class A { | 5 class A { |
6 operator negate() => this; | 6 operator negate() => this; |
7 toString() => "5"; | 7 toString() => "5"; |
8 abs() => "correct"; | 8 abs() => "correct"; |
9 } | 9 } |
10 | 10 |
11 // This triggered a bug in Dart2Js: the speculative type optimization assigned | 11 // This triggered a bug in Dart2Js: the speculative type optimization assigned |
12 // type "number" to 'a' and then to '-a'. In the bailout version the type for | 12 // type "number" to 'a' and then to '-a'. In the bailout version the type for |
13 // 'a' was removed, but the type for '-a' was kept. | 13 // 'a' was removed, but the type for '-a' was kept. |
14 foo(a) => -(-a); | 14 foo(a) => -(-a); |
15 | 15 |
16 main() { | 16 main() { |
17 Expect.equals("correct", foo(new A()).abs()); | 17 Expect.equals("correct", foo(new A()).abs()); |
18 } | 18 } |
OLD | NEW |