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 | 4 |
5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 class OneArg<A> { | 7 class OneArg<A> { |
8 OneArg<A> get foo => new OneArg<A>(); | 8 OneArg<A> get foo => new OneArg<A>(); |
9 OneArg<A> get bar { | 9 OneArg<A> get bar { |
10 return new OneArg<A>(); | 10 return new OneArg<A>(); |
11 } | 11 } |
12 } | 12 } |
13 | 13 |
14 class TwoArgs<A,B> { | 14 class TwoArgs<A, B> { |
15 TwoArgs<A,B> get foo => new TwoArgs<A,B>(); | 15 TwoArgs<A, B> get foo => new TwoArgs<A, B>(); |
16 TwoArgs<A,B> get bar { | 16 TwoArgs<A, B> get bar { |
17 return new TwoArgs<A,B>(); | 17 return new TwoArgs<A, B>(); |
18 } | 18 } |
19 | |
20 } | 19 } |
21 | 20 |
22 void main() { | 21 void main() { |
23 Expect.isTrue(new OneArg<String>().foo is OneArg); | 22 Expect.isTrue(new OneArg<String>().foo is OneArg); |
24 Expect.isTrue(new OneArg<String>().bar is OneArg); | 23 Expect.isTrue(new OneArg<String>().bar is OneArg); |
25 Expect.isTrue(new TwoArgs<String, int>().foo is TwoArgs); | 24 Expect.isTrue(new TwoArgs<String, int>().foo is TwoArgs); |
26 Expect.isTrue(new TwoArgs<String, int>().bar is TwoArgs); | 25 Expect.isTrue(new TwoArgs<String, int>().bar is TwoArgs); |
27 | 26 |
28 // TODO(karlklose): Please remove the return when dart2js can handle | 27 // TODO(karlklose): Please remove the return when dart2js can handle |
29 // the type tests after it. | 28 // the type tests after it. |
30 return; | 29 return; |
31 Expect.isTrue(new OneArg<String>().foo is OneArg<String>); | 30 Expect.isTrue(new OneArg<String>().foo is OneArg<String>); |
32 Expect.isTrue(new OneArg<String>().bar is OneArg<String>); | 31 Expect.isTrue(new OneArg<String>().bar is OneArg<String>); |
33 Expect.isTrue(new TwoArgs<String, int>().foo is TwoArgs<String, int>); | 32 Expect.isTrue(new TwoArgs<String, int>().foo is TwoArgs<String, int>); |
34 Expect.isTrue(new TwoArgs<String, int>().bar is TwoArgs<String, int>); | 33 Expect.isTrue(new TwoArgs<String, int>().bar is TwoArgs<String, int>); |
35 } | 34 } |
OLD | NEW |