OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, 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 bug 18257: Properly infer types for forwarding |
| 6 // factory constructors with optional parameters with default values. |
| 7 |
| 8 main() { |
| 9 A a = new A.a1(); |
| 10 a.test(); |
| 11 } |
| 12 |
| 13 class A { |
| 14 final bool condition; |
| 15 |
| 16 A({this.condition: true}); |
| 17 |
| 18 factory A.a1({condition}) = _A1.boo; |
| 19 |
| 20 test() { |
| 21 if(condition != true) { |
| 22 throw "FAILED"; |
| 23 } |
| 24 } |
| 25 } |
| 26 |
| 27 class _A1 extends A { |
| 28 _A1.boo({condition: true}): |
| 29 super(condition: condition); |
| 30 } |
| 31 |
OLD | NEW |