| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // From Dart Language Specification, 0.12 M1, "7.6.2 Factories": It is | 5 // From Dart Language Specification, 0.12 M1, "7.6.2 Factories": It is |
| 6 // a compile-time error if a redirecting factory constructor does not | 6 // a compile-time error if a redirecting factory constructor does not |
| 7 // redirect to a non-redirecting factory constructor or to a | 7 // redirect to a non-redirecting factory constructor or to a |
| 8 // generative constructor in a finite number of steps. | 8 // generative constructor in a finite number of steps. |
| 9 | 9 |
| 10 // TODO(ahe): The above specification will probably change to | 10 // TODO(ahe): The above specification will probably change to |
| 11 // something like: "It is a compile-time error if a redirecting | 11 // something like: "It is a compile-time error if a redirecting |
| 12 // factory constructor redirects to itself, either directly or | 12 // factory constructor redirects to itself, either directly or |
| 13 // indirectly via a sequence of redirections." | 13 // indirectly via a sequence of redirections." |
| 14 | 14 |
| 15 class Foo extends Bar { | 15 class Foo extends Bar { |
| 16 factory Foo() = Bar; /// 01: static type warning, dynamic type error | 16 factory Foo() = Bar; //# 01: static type warning, dynamic type error |
| 17 } | 17 } |
| 18 | 18 |
| 19 class Bar { | 19 class Bar { |
| 20 factory Bar() = Foo; /// 02: compile-time error | 20 factory Bar() = Foo; //# 02: compile-time error |
| 21 } | 21 } |
| 22 | 22 |
| 23 main() { | 23 main() { |
| 24 new Foo(); | 24 new Foo(); |
| 25 } | 25 } |
| OLD | NEW |