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 S {} | 7 class S {} |
8 | 8 |
9 class M1<X> { | 9 class M1<X> { |
10 m1() => X; | 10 m1() => X; |
11 } | 11 } |
12 | 12 |
13 class M2<Y> { | 13 class M2<Y> { |
14 m2() => Y; | 14 m2() => Y; |
15 } | 15 } |
16 | 16 |
17 class A<T> extends S with M1<T> , M2<T> { } | 17 class A<T> extends S with M1<T>, M2<T> {} |
18 | 18 |
19 main() { | 19 main() { |
20 var a = new A<int>(); | 20 var a = new A<int>(); |
21 // Getting "int" when calling toString() on the int type is not required. | 21 // Getting "int" when calling toString() on the int type is not required. |
22 // However, we want to keep the original names for the most common core types | 22 // However, we want to keep the original names for the most common core types |
23 // so we make sure to handle these specifically in the compiler. | 23 // so we make sure to handle these specifically in the compiler. |
24 Expect.equals("int", a.m1().toString()); | 24 Expect.equals("int", a.m1().toString()); |
25 Expect.equals("int", a.m2().toString()); | 25 Expect.equals("int", a.m2().toString()); |
26 a = new A<String>(); | 26 a = new A<String>(); |
27 Expect.equals("String", a.m1().toString()); | 27 Expect.equals("String", a.m1().toString()); |
28 Expect.equals("String", a.m2().toString()); | 28 Expect.equals("String", a.m2().toString()); |
29 } | 29 } |
OLD | NEW |