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

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

Issue 1232613005: Allow super calls in mixins (for now behind a --supermixin flag). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
(Empty)
1 // Copyright (c) 2015, 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 // VMOptions=--supermixin
5
6 import "package:expect/expect.dart";
7
8 class MS<T> {
9 foo() {
10 return "MS<$T>.foo\n";
11 }
12 }
13
14 class M<T> extends MS<List<T>> {
15 foo() {
16 return super.foo() + "M<$T>.foo\n";
17 }
18 }
19
20 class NS<T> {
21 foo() {
22 return "NS<$T>.foo\n";
23 }
24 }
25
26 class N<T> extends NS<List<T>> {
27 foo() {
28 return super.foo() + "N<$T>.foo\n";
29 }
30 }
31
32 class S<T> {
33 foo() {
34 return "S<$T>.foo\n";
35 }
36 }
37
38 class SM<U, V> = S<List<U>> with M<Map<U, V>>;
39
40 class MNA1<U, V, W> extends S<List<U>> with M<Map<U, V>>, N<W> {
41 foo() {
42 return super.foo() + "MNA1<$U, $V, $W>.foo\n";
43 }
44 }
45
46 class MNA2<U, V, W> extends SM<U, V> with N<W> {
47 foo() {
48 return super.foo() + "MNA2<$U, $V, $W>.foo\n";
49 }
50 }
51
52 class MNA3<U, V, W> extends S<List<U>> with SM<U, V>, N<W> {
53 foo() {
54 return super.foo() + "MNA3<$U, $V, $W>.foo\n";
55 }
56 }
57
58 main(){
59 Expect.equals("MS<List<double>>.foo\n"
60 "M<double>.foo\n",
61 new M<double>().foo());
62 Expect.equals("S<List<int>>.foo\n"
63 "M<Map<int, String>>.foo\n",
64 new SM<int, String>().foo());
65 Expect.equals("S<List<int>>.foo\n"
66 "M<Map<int, String>>.foo\n"
67 "N<bool>.foo\n"
68 "MNA1<int, String, bool>.foo\n",
69 new MNA1<int, String, bool>().foo());
70 Expect.equals("S<List<int>>.foo\n"
71 "M<Map<int, String>>.foo\n"
72 "N<bool>.foo\n"
73 "MNA2<int, String, bool>.foo\n",
74 new MNA2<int, String, bool>().foo());
75 Expect.equals("S<List<int>>.foo\n"
76 "M<Map<int, String>>.foo\n"
77 "N<bool>.foo\n"
78 "MNA3<int, String, bool>.foo\n",
79 new MNA3<int, String, bool>().foo());
80 }
81
OLDNEW
« tests/language/mixin_super_bound_test.dart ('K') | « tests/language/mixin_super_bound_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698