OLD | NEW |
(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 import "mixin_lib_extends_field_lib.dart" as L; |
| 6 |
| 7 class S { |
| 8 var foo = "S-foo"; |
| 9 } |
| 10 |
| 11 class C extends S with L.M1 { } |
| 12 class D extends S with L.M1, L.M2 { } |
| 13 class E extends S with L.M2, L.M1 { } |
| 14 |
| 15 class F extends E { |
| 16 var fez = "F-fez"; |
| 17 } |
| 18 |
| 19 main() { |
| 20 var c = new C(); |
| 21 var d = new D(); |
| 22 var e = new E(); |
| 23 var f = new F(); |
| 24 |
| 25 Expect.equals("S-foo", c.foo); |
| 26 Expect.equals("S-foo", d.foo); |
| 27 Expect.equals("S-foo", e.foo); |
| 28 Expect.equals("S-foo", f.foo); |
| 29 |
| 30 Expect.equals("M1-bar", c.bar); |
| 31 Expect.equals("M1-bar", d.bar); |
| 32 Expect.equals("M1-bar", e.bar); |
| 33 Expect.equals("M1-bar", f.bar); |
| 34 |
| 35 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); |
| 36 Expect.equals("M2-baz", d.baz); |
| 37 Expect.equals("M2-baz", e.baz); |
| 38 Expect.equals("M2-baz", f.baz); |
| 39 |
| 40 Expect.throws(() => c.fez, (error) => error is NoSuchMethodError); |
| 41 Expect.throws(() => d.fez, (error) => error is NoSuchMethodError); |
| 42 Expect.throws(() => e.fez, (error) => error is NoSuchMethodError); |
| 43 Expect.equals("F-fez", f.fez); |
| 44 |
| 45 c.foo = "S-foo-c"; |
| 46 Expect.equals("S-foo-c", c.foo); |
| 47 Expect.equals("S-foo", d.foo); |
| 48 Expect.equals("S-foo", e.foo); |
| 49 Expect.equals("S-foo", f.foo); |
| 50 |
| 51 d.foo = "S-foo-d"; |
| 52 Expect.equals("S-foo-c", c.foo); |
| 53 Expect.equals("S-foo-d", d.foo); |
| 54 Expect.equals("S-foo", e.foo); |
| 55 Expect.equals("S-foo", f.foo); |
| 56 |
| 57 e.foo = "S-foo-e"; |
| 58 Expect.equals("S-foo-c", c.foo); |
| 59 Expect.equals("S-foo-d", d.foo); |
| 60 Expect.equals("S-foo-e", e.foo); |
| 61 Expect.equals("S-foo", f.foo); |
| 62 |
| 63 f.foo = "S-foo-f"; |
| 64 Expect.equals("S-foo-c", c.foo); |
| 65 Expect.equals("S-foo-d", d.foo); |
| 66 Expect.equals("S-foo-e", e.foo); |
| 67 Expect.equals("S-foo-f", f.foo); |
| 68 |
| 69 Expect.throws(() => c.bar = 0, (error) => error is NoSuchMethodError); |
| 70 Expect.throws(() => d.bar = 0, (error) => error is NoSuchMethodError); |
| 71 Expect.throws(() => e.bar = 0, (error) => error is NoSuchMethodError); |
| 72 Expect.throws(() => f.bar = 0, (error) => error is NoSuchMethodError); |
| 73 Expect.equals("M1-bar", c.bar); |
| 74 Expect.equals("M1-bar", d.bar); |
| 75 Expect.equals("M1-bar", e.bar); |
| 76 Expect.equals("M1-bar", f.bar); |
| 77 |
| 78 Expect.throws(() => c.baz = 0, (error) => error is NoSuchMethodError); |
| 79 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); |
| 80 Expect.equals("M2-baz", d.baz); |
| 81 Expect.equals("M2-baz", e.baz); |
| 82 Expect.equals("M2-baz", f.baz); |
| 83 |
| 84 d.baz = "M2-baz-d"; |
| 85 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); |
| 86 Expect.equals("M2-baz-d", d.baz); |
| 87 Expect.equals("M2-baz", e.baz); |
| 88 Expect.equals("M2-baz", f.baz); |
| 89 Expect.equals("M2-baz", f.baz); |
| 90 |
| 91 e.baz = "M2-baz-e"; |
| 92 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); |
| 93 Expect.equals("M2-baz-d", d.baz); |
| 94 Expect.equals("M2-baz-e", e.baz); |
| 95 Expect.equals("M2-baz", f.baz); |
| 96 |
| 97 f.baz = "M2-baz-f"; |
| 98 Expect.throws(() => c.baz, (error) => error is NoSuchMethodError); |
| 99 Expect.equals("M2-baz-d", d.baz); |
| 100 Expect.equals("M2-baz-e", e.baz); |
| 101 Expect.equals("M2-baz-f", f.baz); |
| 102 |
| 103 Expect.throws(() => c.fez = 0, (error) => error is NoSuchMethodError); |
| 104 Expect.throws(() => d.fez = 0, (error) => error is NoSuchMethodError); |
| 105 Expect.throws(() => e.fez = 0, (error) => error is NoSuchMethodError); |
| 106 |
| 107 f.fez = "F-fez-f"; |
| 108 Expect.throws(() => c.fez, (error) => error is NoSuchMethodError); |
| 109 Expect.throws(() => d.fez, (error) => error is NoSuchMethodError); |
| 110 Expect.throws(() => e.fez, (error) => error is NoSuchMethodError); |
| 111 Expect.equals("F-fez-f", f.fez); |
| 112 } |
OLD | NEW |