40d52d54af
This CL enables the same checks in the redirecting factories of extension types as in redirecting factories of classes. Additionally, this CL marks all of those erroneous constructors, in classes and in extension type declarations, as erroneous. Change-Id: Ic270324f05b6a8424c1ab9fbe9fe4f1d0b22a3fc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425860 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
222 lines
11 KiB
Plaintext
222 lines
11 KiB
Plaintext
library;
|
|
//
|
|
// Problems in library:
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:9:16: Error: 'x' was already initialized by this constructor.
|
|
// this.x = 42 {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:16:16: Error: 'x' was already initialized by this constructor.
|
|
// this.x = 42 {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:22:16: Error: 'x' is a final instance variable that was initialized at the declaration.
|
|
// : this.x = 41,
|
|
// ^
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:20:13: Context: 'x' was initialized here.
|
|
// final int x = 2;
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:23:16: Error: 'x' was already initialized by this constructor.
|
|
// this.x = 42 {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:30:16: Error: A redirecting constructor can't have other initializers.
|
|
// : this.x = 41,
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:32:16: Error: A redirecting constructor can't have other initializers.
|
|
// this.y = 42 {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:43:16: Error: A redirecting constructor can't have other initializers.
|
|
// this.x = 1,
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:44:16: Error: A redirecting constructor can't have other initializers.
|
|
// this.y = 2 {}
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:49:16: Error: A redirecting constructor can't have other initializers.
|
|
// : this.x = 1,
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:51:16: Error: A redirecting constructor can't have other initializers.
|
|
// this.y = 2;
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:53:9: Error: A redirecting constructor can't have a 'super' initializer.
|
|
// : super(),
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:55:16: Error: Can't have initializers after 'super'.
|
|
// this.x = 1,
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:56:16: Error: Can't have initializers after 'super'.
|
|
// this.y = 2;
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:58:16: Error: A redirecting constructor can't have other initializers.
|
|
// : this.x = 1,
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:59:16: Error: A redirecting constructor can't have other initializers.
|
|
// this.y = 2,
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:62:9: Error: A redirecting constructor can't have other initializers.
|
|
// : assert(true),
|
|
// ^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:66:9: Error: A redirecting constructor can't have other initializers.
|
|
// assert(true);
|
|
// ^^^^^^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:72:9: Error: A redirecting constructor can't have a 'super' initializer.
|
|
// super() {}
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:78:9: Error: A redirecting constructor can't have a 'super' initializer.
|
|
// : super(),
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:80:9: Error: Can't have more than one 'super' initializer.
|
|
// super() {}
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:87:14: Error: A redirecting constructor can't have more than one redirection.
|
|
// this.named();
|
|
// ^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:94:9: Error: Can't have more than one 'super' initializer.
|
|
// super() {}
|
|
// ^^^^^
|
|
//
|
|
// pkg/front_end/testcases/general/initialization_errors.dart:101:16: Error: Can't have initializers after 'super'.
|
|
// this.x = 42 {}
|
|
// ^
|
|
//
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
class A extends core::Object {
|
|
field core::int x;
|
|
constructor •() → self::A
|
|
: self::A::x = 41, final dynamic #t1 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:9:16: Error: 'x' was already initialized by this constructor.
|
|
this.x = 42 {}
|
|
^", super core::Object::•() {}
|
|
}
|
|
class B extends core::Object {
|
|
final field core::int x;
|
|
constructor •() → self::B
|
|
: self::B::x = 41, final dynamic #t2 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:16:16: Error: 'x' was already initialized by this constructor.
|
|
this.x = 42 {}
|
|
^", super core::Object::•() {}
|
|
}
|
|
class C extends core::Object {
|
|
final field core::int x = 2;
|
|
constructor •() → self::C
|
|
: final dynamic #t3 = throw new core::_DuplicatedFieldInitializerError::•("x"), final dynamic #t4 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:23:16: Error: 'x' was already initialized by this constructor.
|
|
this.x = 42 {}
|
|
^", super core::Object::•() {}
|
|
}
|
|
class D extends core::Object {
|
|
final field core::int x;
|
|
final field core::int y;
|
|
erroneous constructor •() → self::D
|
|
: final dynamic #t5 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:30:16: Error: A redirecting constructor can't have other initializers.
|
|
: this.x = 41,
|
|
^", final dynamic #t6 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:32:16: Error: A redirecting constructor can't have other initializers.
|
|
this.y = 42 {}
|
|
^", this self::D::named() {}
|
|
constructor named() → self::D
|
|
: self::D::x = 41, self::D::y = 42, super core::Object::•() {}
|
|
}
|
|
class E extends core::Object {
|
|
final field core::int x;
|
|
final field core::int y;
|
|
erroneous constructor •() → self::E
|
|
: final dynamic #t7 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:43:16: Error: A redirecting constructor can't have other initializers.
|
|
this.x = 1,
|
|
^", final dynamic #t8 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:44:16: Error: A redirecting constructor can't have other initializers.
|
|
this.y = 2 {}
|
|
^", this self::E::named() {}
|
|
constructor named() → self::E
|
|
: self::E::x = 41, self::E::y = 42, super core::Object::•() {}
|
|
erroneous constructor named2() → self::E
|
|
: final dynamic #t9 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:49:16: Error: A redirecting constructor can't have other initializers.
|
|
: this.x = 1,
|
|
^", final dynamic #t10 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:51:16: Error: A redirecting constructor can't have other initializers.
|
|
this.y = 2;
|
|
^", this self::E::named()
|
|
;
|
|
erroneous constructor named3() → self::E
|
|
: final dynamic #t11 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:53:9: Error: A redirecting constructor can't have a 'super' initializer.
|
|
: super(),
|
|
^^^^^", final dynamic #t12 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:55:16: Error: Can't have initializers after 'super'.
|
|
this.x = 1,
|
|
^", final dynamic #t13 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:56:16: Error: Can't have initializers after 'super'.
|
|
this.y = 2;
|
|
^", super core::Object::•()
|
|
;
|
|
erroneous constructor named4() → self::E
|
|
: final dynamic #t14 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:58:16: Error: A redirecting constructor can't have other initializers.
|
|
: this.x = 1,
|
|
^", final dynamic #t15 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:59:16: Error: A redirecting constructor can't have other initializers.
|
|
this.y = 2,
|
|
^", this self::E::named()
|
|
;
|
|
erroneous constructor named5() → self::E
|
|
: final dynamic #t16 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:62:9: Error: A redirecting constructor can't have other initializers.
|
|
: assert(true),
|
|
^^^^^^", this self::E::named()
|
|
;
|
|
erroneous constructor named6() → self::E
|
|
: final dynamic #t17 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:66:9: Error: A redirecting constructor can't have other initializers.
|
|
assert(true);
|
|
^^^^^^", this self::E::named()
|
|
;
|
|
}
|
|
class F extends core::Object {
|
|
constructor •() → self::F
|
|
: final dynamic #t18 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:72:9: Error: A redirecting constructor can't have a 'super' initializer.
|
|
super() {}
|
|
^^^^^", this self::F::named() {}
|
|
constructor named() → self::F
|
|
: super core::Object::•() {}
|
|
}
|
|
class G extends core::Object {
|
|
erroneous constructor •() → self::G
|
|
: final dynamic #t19 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:78:9: Error: A redirecting constructor can't have a 'super' initializer.
|
|
: super(),
|
|
^^^^^", final dynamic #t20 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:80:9: Error: Can't have more than one 'super' initializer.
|
|
super() {}
|
|
^^^^^", super core::Object::•() {}
|
|
constructor named() → self::G
|
|
: super core::Object::•() {}
|
|
}
|
|
class H extends core::Object {
|
|
erroneous constructor •() → self::H
|
|
: final dynamic #t21 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:87:14: Error: A redirecting constructor can't have more than one redirection.
|
|
this.named();
|
|
^", this self::H::named()
|
|
;
|
|
constructor named() → self::H
|
|
: super core::Object::•() {}
|
|
}
|
|
class I extends core::Object {
|
|
constructor •() → self::I
|
|
: final dynamic #t22 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:94:9: Error: Can't have more than one 'super' initializer.
|
|
super() {}
|
|
^^^^^", super core::Object::•() {}
|
|
}
|
|
class J extends core::Object {
|
|
field core::int x;
|
|
erroneous constructor •() → self::J
|
|
: final dynamic #t23 = invalid-expression "pkg/front_end/testcases/general/initialization_errors.dart:101:16: Error: Can't have initializers after 'super'.
|
|
this.x = 42 {}
|
|
^", super core::Object::•() {}
|
|
}
|
|
static method main() → dynamic {}
|