| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Test for F-Bounded Quantification. | 5 // Test for F-Bounded Quantification. |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 | 8 |
| 9 class A<T extends B<T>> { | 9 class A<T extends B<T>> { |
| 10 } | 10 } |
| 11 | 11 |
| 12 class B<T extends A<T>> { | 12 class B<T extends A<T>> { |
| 13 } | 13 } |
| 14 | 14 |
| 15 isCheckedMode() { | 15 isCheckedMode() { |
| 16 try { | 16 try { |
| 17 var i = 1; | 17 var i = 1; |
| 18 String s = i; | 18 String s = i; |
| 19 return false; | 19 return false; |
| 20 } catch (e) { | 20 } catch (e) { |
| 21 return true; | 21 return true; |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 | 24 |
| 25 main() { | 25 main() { |
| 26 bool got_type_error = false; | 26 bool got_type_error = false; |
| 27 try { | 27 try { |
| 28 // Getting "int" when calling toString() on the int type is not required. |
| 29 // However, we want to keep the original names for the most common core |
| 30 // types so we make sure to handle these specifically in the compiler. |
| 28 Expect.equals("A<B<int>>", new A<B<int>>().runtimeType.toString()); | 31 Expect.equals("A<B<int>>", new A<B<int>>().runtimeType.toString()); |
| 29 } on TypeError catch (error) { | 32 } on TypeError catch (error) { |
| 30 got_type_error = true; | 33 got_type_error = true; |
| 31 } | 34 } |
| 32 // Type error expected in checked mode only. | 35 // Type error expected in checked mode only. |
| 33 Expect.isTrue(got_type_error == isCheckedMode()); | 36 Expect.isTrue(got_type_error == isCheckedMode()); |
| 34 } | 37 } |
| 35 | 38 |
| OLD | NEW |