| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Dart test for a closure result type test that cannot be eliminated at compile | 4 // Dart test for a closure result type test that cannot be eliminated at compile |
| 5 // time. | 5 // time. |
| 6 | 6 |
| 7 library closure_type_test; | 7 library closure_type_test; |
| 8 import "package:expect/expect.dart"; | |
| 9 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 10 | 9 |
| 11 class Math { | 10 class Math { |
| 12 static int sqrt(x) => math.sqrt(x); | 11 static int sqrt(x) => math.sqrt(x); |
| 13 } | 12 } |
| 14 | 13 |
| 15 isCheckedMode() { | 14 isCheckedMode() { |
| 16 try { | 15 try { |
| 17 var i = 1; | 16 var i = 1; |
| 18 String s = i; | 17 String s = i; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 37 } on TypeError catch (error) { | 36 } on TypeError catch (error) { |
| 38 got_type_error = true; | 37 got_type_error = true; |
| 39 } | 38 } |
| 40 // Type error expected in checked mode only. | 39 // Type error expected in checked mode only. |
| 41 Expect.isTrue(got_type_error == isCheckedMode()); | 40 Expect.isTrue(got_type_error == isCheckedMode()); |
| 42 } | 41 } |
| 43 | 42 |
| 44 root(x) => Math.sqrt(x); | 43 root(x) => Math.sqrt(x); |
| 45 | 44 |
| 46 main() => test(root, 4); | 45 main() => test(root, 4); |
| OLD | NEW |