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