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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 class Magnitude<T> { | 7 class Magnitude<T> { |
8 get t => T; | 8 get t => T; |
9 } | 9 } |
| 10 |
10 class Real extends Magnitude<Real> {} | 11 class Real extends Magnitude<Real> {} |
11 | 12 |
12 class FBound<F extends FBound<F>> { | 13 class FBound<F extends FBound<F>> { |
13 get f => F; | 14 get f => F; |
14 } | 15 } |
| 16 |
15 class Bar extends FBound<Bar> {} | 17 class Bar extends FBound<Bar> {} |
16 | 18 |
17 main() { | 19 main() { |
18 var r = new Real(); | 20 var r = new Real(); |
19 Expect.equals(r.runtimeType, Real); | 21 Expect.equals(r.runtimeType, Real); |
20 Expect.equals(r.t, Real); | 22 Expect.equals(r.t, Real); |
21 Expect.equals(r.runtimeType, r.t); | 23 Expect.equals(r.runtimeType, r.t); |
22 | 24 |
23 var b = new Bar(); | 25 var b = new Bar(); |
24 Expect.equals(b.runtimeType, Bar); | 26 Expect.equals(b.runtimeType, Bar); |
25 Expect.equals(b.f, Bar); | 27 Expect.equals(b.f, Bar); |
26 Expect.equals(b.runtimeType, b.f); | 28 Expect.equals(b.runtimeType, b.f); |
27 } | 29 } |
OLD | NEW |