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 that we report a compile-time error when a type parameter conflicts | 5 // Test that we report a compile-time error when a type parameter conflicts |
6 // with an instance or static member with the same name. | 6 // with an instance or static member with the same name. |
7 | 7 |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 | 9 |
10 class G1<T> { | 10 class G1<T> { |
11 var T; // /// 01: compile-time error | 11 var T; // //# 01: compile-time error |
12 } | 12 } |
13 class G2<T> { | 13 class G2<T> { |
14 get T {} // /// 02: compile-time error | 14 get T {} // //# 02: compile-time error |
15 } | 15 } |
16 class G3<T> { | 16 class G3<T> { |
17 T() {} // /// 03: compile-time error | 17 T() {} // //# 03: compile-time error |
18 } | 18 } |
19 class G4<T> { | 19 class G4<T> { |
20 static var T; // /// 04: compile-time error | 20 static var T; // //# 04: compile-time error |
21 } | 21 } |
22 class G5<T> { | 22 class G5<T> { |
23 static get T {} // /// 05: compile-time error | 23 static get T {} // //# 05: compile-time error |
24 } | 24 } |
25 class G6<T> { | 25 class G6<T> { |
26 static T() {} // /// 06: compile-time error | 26 static T() {} // //# 06: compile-time error |
27 } | 27 } |
28 | 28 |
29 main() { | 29 main() { |
30 new G1<int>(); | 30 new G1<int>(); |
31 new G2<int>(); | 31 new G2<int>(); |
32 new G3<int>(); | 32 new G3<int>(); |
33 new G4<int>(); | 33 new G4<int>(); |
34 new G5<int>(); | 34 new G5<int>(); |
35 new G6<int>(); | 35 new G6<int>(); |
36 } | 36 } |
OLD | NEW |