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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // Test for F-Bounded Quantification. | 7 // Test for F-Bounded Quantification. |
8 | 8 |
9 class FBound<F extends FBound<F>> {} | 9 class FBound<F extends FBound<F>> {} |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 } catch (e) { | 25 } catch (e) { |
26 return true; | 26 return true; |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 main() { | 30 main() { |
31 FBound<Bar> fb = new FBound<Bar>(); | 31 FBound<Bar> fb = new FBound<Bar>(); |
32 { | 32 { |
33 bool got_type_error = false; | 33 bool got_type_error = false; |
34 try { | 34 try { |
35 FBound<SubBar> fsb = new FBound<SubBar>(); /// 01: static type warning | 35 FBound<SubBar> fsb = new FBound<SubBar>(); //# 01: static type warning |
36 } on TypeError catch (error) { | 36 } on TypeError catch (error) { |
37 got_type_error = true; | 37 got_type_error = true; |
38 } | 38 } |
39 // Type error in checked mode only. | 39 // Type error in checked mode only. |
40 Expect.isTrue(got_type_error == isCheckedMode()); /// 01: continued | 40 Expect.isTrue(got_type_error == isCheckedMode()); //# 01: continued |
41 } | 41 } |
42 FBound<Baz<Bar>> fbb = new FBound<Baz<Bar>>(); | 42 FBound<Baz<Bar>> fbb = new FBound<Baz<Bar>>(); |
43 { | 43 { |
44 bool got_type_error = false; | 44 bool got_type_error = false; |
45 try { | 45 try { |
46 FBound<SubBaz<Bar>> fsb = new FBound<SubBaz<Bar>>(); /// 02: static type
warning | 46 FBound<SubBaz<Bar>> fsb = new FBound<SubBaz<Bar>>(); //# 02: static type
warning |
47 } on TypeError catch (error) { | 47 } on TypeError catch (error) { |
48 got_type_error = true; | 48 got_type_error = true; |
49 } | 49 } |
50 // Type error in checked mode only. | 50 // Type error in checked mode only. |
51 Expect.isTrue(got_type_error == isCheckedMode()); /// 02: continued | 51 Expect.isTrue(got_type_error == isCheckedMode()); //# 02: continued |
52 } | 52 } |
53 } | 53 } |
OLD | NEW |