OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 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 | 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 var result; | 7 class A { |
| 8 final a; |
8 | 9 |
9 class A { | 10 const A(this.a); |
10 noSuchMethod(im) { | |
11 result = 42; | |
12 } | |
13 } | 11 } |
14 | 12 |
15 class B extends A { | 13 class B extends A { |
16 noSuchMethod(im) { | 14 final b; |
17 result = 87; | |
18 } | |
19 | 15 |
20 set foo(v) => super.foo = v; /// 01: static type warning | 16 const B(a, this.b) : super(a); |
21 } | 17 } |
22 | 18 |
23 main() { | 19 @NoInline() |
24 new B().foo = 0; /// 01: continued | 20 foo() => const B(1, 2); |
25 Expect.equals(42, result); /// 01: continued | 21 |
| 22 @NoInline() |
| 23 bar() => const B(2, 2); |
| 24 |
| 25 void main() { |
| 26 Expect.notEquals(foo(), bar()); |
| 27 Expect.notEquals(foo().a, bar().a); |
| 28 Expect.equals(foo().b, bar().b); |
26 } | 29 } |
OLD | NEW |