blob: f1030db1fa11fb7ab0ac0eb9ca68862c8b3124e1 [file] [log] [blame]
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
return new self::A::•(field);
}
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
}