| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/general/redirecting_factory_default_value.dart:10:35: Error: Can't have a default value here because any default values of 'A' would be used instead. |
| // Try removing the default value. |
| // factory A.redirect([int field = 87]) = A; |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class A extends core::Object { |
| final field core::int field; |
| static final field dynamic _redirecting# = <dynamic>[self::A::redirect]/*isLegacy*/; |
| constructor •([core::int field = #C1]) → self::A |
| : self::A::field = field, super core::Object::•() |
| ; |
| static factory redirect([core::int field]) → self::A |
| let Never #redirecting_factory = self::A::• in invalid-expression; |
| } |
| static method main() → dynamic { |
| self::expect(42, new self::A::•().{self::A::field}{core::int}); |
| self::expect(123, new self::A::•(123).{self::A::field}{core::int}); |
| self::expect(42, new self::A::•().{self::A::field}{core::int}); |
| self::expect(123, new self::A::•(123).{self::A::field}{core::int}); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) |
| throw "Expected ${expected}, actual ${actual}"; |
| } |
| |
| constants { |
| #C1 = 42 |
| } |