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 // Regression test for dart2js's inferrer that used to not propagate |
| 6 // types given to generative constructors in super constructor calls. |
| 7 |
| 8 import "package:expect/expect.dart"; |
| 9 |
| 10 class A { |
| 11 final field; |
| 12 A.full(this.field); |
| 13 } |
| 14 |
| 15 class B extends A { |
| 16 // The following super call used to not be analyzed properly. |
| 17 B.full(field) : super.full(field); |
| 18 } |
| 19 |
| 20 main() { |
| 21 // Call [A.full] with an int to have the inferrer think [field] is |
| 22 // always an int. |
| 23 Expect.equals(84, new A.full(42).field + 42); |
| 24 Expect.throws(() => new B.full(null).field + 42, |
| 25 (e) => e is NoSuchMethodError); |
| 26 } |
OLD | NEW |