OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // SharedOptions=--supermixin | 4 // SharedOptions=--supermixin |
5 | 5 |
6 // Validate the following test from section 12 ("Mixins") of the spec: | 6 // Validate the following test from section 12 ("Mixins") of the spec: |
7 // | 7 // |
8 // "Let M_A be a mixin derived from a class M with direct superclass | 8 // "Let M_A be a mixin derived from a class M with direct superclass |
9 // S_static. | 9 // S_static. |
10 // | 10 // |
11 // Let A be an application of M_A. It is a static warning if the | 11 // Let A be an application of M_A. It is a static warning if the |
12 // superclass of A is not a subtype of S_static." | 12 // superclass of A is not a subtype of S_static." |
13 | 13 |
14 // In this test, M is declared as `class M extends ... with G {}`, so | 14 // In this test, M is declared as `class M extends ... with G {}`, so |
15 // `S_static` is the unnamed mixin application `... with G`. Since this | 15 // `S_static` is the unnamed mixin application `... with G`. Since this |
16 // unnamed mixin application can't be derived from, all the cases should yield | 16 // unnamed mixin application can't be derived from, all the cases should yield |
17 // a warning. | 17 // a warning. |
18 | 18 |
19 class B {} | 19 class B {} |
20 class C {} | 20 class C {} |
21 class D {} | 21 class D {} |
22 class E extends B with C implements D {} | 22 class E extends B with C implements D {} |
23 class F extends E {} | 23 class F extends E {} |
24 class G {} | 24 class G {} |
25 class A = E with M; | 25 class A = E with M; |
26 class M | 26 class M |
27 extends B with G /// 01: static type warning | 27 extends B with G //# 01: static type warning |
28 extends C with G /// 02: static type warning | 28 extends C with G //# 02: static type warning |
29 extends D with G /// 03: static type warning | 29 extends D with G //# 03: static type warning |
30 extends E with G /// 04: static type warning | 30 extends E with G //# 04: static type warning |
31 extends F with G /// 05: static type warning | 31 extends F with G //# 05: static type warning |
32 {} | 32 {} |
33 | 33 |
34 main() { | 34 main() { |
35 new A(); | 35 new A(); |
36 } | 36 } |
OLD | NEW |