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

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

Issue 12033049: Disallow mixing in classes that use 'super'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Analyzer passes the tests. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class M {
6 }
7
8 class P0 {
9 foo() {
10 super.toString(); /// 01: compile-time error
11 super.foo(); /// 02: compile-time error
12 super.bar = 100; /// 03: compile-time error
13
14 void inner() {
15 super.toString(); /// 04: compile-time error
16 super.foo(); /// 05: compile-time error
17 super.bar = 100; /// 06: compile-time error
18 }
19 inner();
20
21 (() {
22 super.toString(); /// 07: compile-time error
23 super.foo(); /// 08: compile-time error
24 super.bar = 100; /// 09: compile-time error
25 })();
26
27 return 42;
28 }
29 }
30
31 class P1 {
32 bar() {
33 super.toString(); /// 10: compile-time error
34 return 87;
35 }
36
37 // The test method is strategically placed here to try to force the
38 // P1 class and its bar method to be resolved before resolve the
Johnni Winther 2013/01/24 08:19:09 resolve => resolving
39 // mixin applications.
40 test() {
41 new C();
42 var d = new D();
43 var e = new E();
44 var f = new F();
45 Expect.equals(42, d.foo());
46 Expect.equals(87, e.bar());
47 Expect.equals(99, f.baz());
48 }
49 }
50
51 class P2 {
52 baz() {
53 super.toString(); /// 11: compile-time error
54 return 99;
55 }
56 }
57
58 typedef C = Object with M;
59 typedef D = Object with P0;
60 typedef E = Object with M, P1;
61 typedef F = Object with P2, M;
62
63 main() {
64 var p1 = new P1();
65 var p2 = new P2();
66 Expect.equals(87, p1.bar());
67 p1.test();
68 Expect.equals(99, p2.baz());
69 }
OLDNEW
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698