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_of_mixin_test.dart

Issue 1650783002: Add tests demonstrating bug #25605. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « tests/language/language_dart2js.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) 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
3 // BSD-style license that can be found in the LICENSE file.
4 // SharedOptions=--supermixin
5
6 // Validate the following text from section 12 ("Mixins") of the spec:
7 //
8 // "A mixin application of the form S with M; defines a class C ...
9 // ... C declares the same instance members as M ..."
10 //
11 // This means that if M is itself a mixin application, then things
12 // mixed into M are accessible through C. But if M simply *extends* a
13 // mixin application (e.g. because M is declared as `class M extends X
14 // with Y { ... }`) then things mixed into the mixin application that
15 // M extends are not accessible through C.
16
17 class A { a() => null; }
18 class B { b() => null; }
19 class C { c() => null; }
20 class D { d() => null; }
21
22 // Note: by a slight abuse of syntax, `class M1 = A with B, C;` effectively
23 // means `class M1 = (A with B) with C;`, therefore M1 declares c(), but it
24 // merely inherits a() and b().
25 class M1 = A with B, C; // declares c()
26
27 class M2 extends M1 { m2() => null; }
28 class M3 extends A with B, C { m3() => null; }
29 class T1 = D with M1; // declares c()
30 class T2 = D with M2; // declares m2()
31 class T3 = D with M3; // declares m3()
32 class T4 extends D with M1 {} // extends a class which declares c()
33 class T5 extends D with M2 {} // extends a class which declares m2()
34 class T6 extends D with M3 {} // extends a class which declares m3()
35
36 main() {
37 new T1().a(); /// 01: static type warning, runtime error
38 new T1().b(); /// 02: static type warning, runtime error
39 new T1().c(); /// 03: ok
40 new T2().a(); /// 04: static type warning, runtime error
41 new T2().b(); /// 05: static type warning, runtime error
42 new T2().c(); /// 06: static type warning, runtime error
43 new T2().m2(); /// 07: ok
44 new T3().a(); /// 08: static type warning, runtime error
45 new T3().b(); /// 09: static type warning, runtime error
46 new T3().c(); /// 10: static type warning, runtime error
47 new T3().m3(); /// 11: ok
48 new T4().a(); /// 12: static type warning, runtime error
49 new T4().b(); /// 13: static type warning, runtime error
50 new T4().c(); /// 14: ok
51 new T5().a(); /// 15: static type warning, runtime error
52 new T5().b(); /// 16: static type warning, runtime error
53 new T5().c(); /// 17: static type warning, runtime error
54 new T5().m2(); /// 18: ok
55 new T6().a(); /// 19: static type warning, runtime error
56 new T6().b(); /// 20: static type warning, runtime error
57 new T6().c(); /// 21: static type warning, runtime error
58 new T6().m3(); /// 22: ok
59 }
OLDNEW
« no previous file with comments | « tests/language/language_dart2js.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698