Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: tests/language/mixin_illegal_super_use_test.dart

Issue 1635763003: Restore old supermixin functionality to shared language tests. Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 M { 7 class M {
8 } 8 }
9 9
10 class P0 { 10 class P0 {
11 foo() { 11 foo() {
12 super.toString(); 12 super.toString(); /// 01: compile-time error
13 super.foo(); /// 02: compile-time error
14 super.bar = 100; /// 03: compile-time error
13 15
14 void inner() { 16 void inner() {
15 super.toString(); 17 super.toString(); /// 04: compile-time error
18 super.foo(); /// 05: compile-time error
19 super.bar = 100; /// 06: compile-time error
16 } 20 }
17 inner(); 21 inner();
18 22
19 (() { 23 (() {
20 super.toString(); 24 super.toString(); /// 07: compile-time error
25 super.foo(); /// 08: compile-time error
26 super.bar = 100; /// 09: compile-time error
21 })(); 27 })();
22 28
23 return 42; 29 return 42;
24 } 30 }
25 } 31 }
26 32
27 class P1 { 33 class P1 {
28 bar() { 34 bar() {
29 super.toString(); 35 super.toString(); /// 10: compile-time error
30 return 87; 36 return 87;
31 } 37 }
32 38
33 // The test method is strategically placed here to try to force the 39 // The test method is strategically placed here to try to force the
34 // P1 class and its bar method to be resolved before resolving the 40 // P1 class and its bar method to be resolved before resolving the
35 // mixin applications. 41 // mixin applications.
36 test() { 42 test() {
37 new C(); 43 new C();
38 var d = new D(); 44 var d = new D();
39 var e = new E(); 45 var e = new E();
40 var f = new F(); 46 var f = new F();
41 Expect.equals(42, d.foo()); 47 Expect.equals(42, d.foo());
42 Expect.equals(87, e.bar()); 48 Expect.equals(87, e.bar());
43 Expect.equals(99, f.baz()); 49 Expect.equals(99, f.baz());
44 } 50 }
45 } 51 }
46 52
47 class P2 { 53 class P2 {
48 baz() { 54 baz() {
49 super.toString(); 55 super.toString(); /// 11: compile-time error
50 return 99; 56 return 99;
51 } 57 }
52 } 58 }
53 59
54 class C = Object with M; 60 class C = Object with M;
55 class D = Object with P0; 61 class D = Object with P0;
56 class E = Object with M, P1; 62 class E = Object with M, P1;
57 class F = Object with P2, M; 63 class F = Object with P2, M;
58 64
59 main() { 65 main() {
60 var p1 = new P1(); 66 var p1 = new P1();
61 var p2 = new P2(); 67 var p2 = new P2();
62 Expect.equals(87, p1.bar()); 68 Expect.equals(87, p1.bar());
63 p1.test(); 69 p1.test();
64 Expect.equals(99, p2.baz()); 70 Expect.equals(99, p2.baz());
65 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698