From 8ccb79096127b9c8cec487881be5376fd1178856 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Tue, 14 Oct 2025 11:42:33 +0300 Subject: [PATCH 1/4] #3315. Add tests for initializer list --- .../static_processing_A24_t01.dart | 98 +++++++++ .../static_processing_A24_t02.dart | 71 +++++++ .../static_processing_A24_t03.dart | 191 ++++++++++++++++++ .../static_processing_A24_t04.dart | 120 +++++++++++ .../static_processing_A24_t05.dart | 176 ++++++++++++++++ .../static_processing_A24_t06.dart | 61 ++++++ 6 files changed, 717 insertions(+) create mode 100644 LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart create mode 100644 LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart create mode 100644 LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart create mode 100644 LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart create mode 100644 LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart create mode 100644 LanguageFeatures/Declaring-constructors/static_processing_A24_t06.dart diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart new file mode 100644 index 0000000000..8505dd54f0 --- /dev/null +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart @@ -0,0 +1,98 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The semantics of the declaring constructor is found in the +/// following steps, where `D` is the class, extension type, or enum declaration +/// in the program that includes a declaring constructor `k`, and `D2` is the +/// result of the derivation of the semantics of `D`. The derivation step will +/// delete elements that amount to the declaring constructor. Semantically, it +/// will add a new constructor `k2`, and it will add zero or more instance +/// variable declarations. +/// ... +/// If there is an initializer list following the formal parameter list `L` then +/// `k2` has an initializer list with the same elements in the same order. +/// +/// @description Check that if a declaring constructor has an initializer list +/// then `k2` has an initializer list with the same elements. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=declaring-constructors + +import '../../Utils/expect.dart'; + +class A(int z); + +class C1 extends A { + int x; + this: x = 1, super(-1); +} + +class C2() extends A { + int x; + this: x = 2, super(-2); +} + +class C3(int x) extends A { + int x; + this: x = x, super(-x); +} + +class C4 extends A { + int x; + this() : x = 4, super(-4); +} + +class C5 extends A { + int x; + this(int x) : x = 5, super(-5); +} + +enum E1 { + e0(); + final int x; + this : x = 1; +} + +enum E2() { + e0(); + final int x; + this : x = 2; +} + +enum E3(int x) { + e0(3); + final int x; + this : x = x; +} + +enum E4 { + e0(); + final int x; + this() : x = 4; +} + +enum E5 { + e0(5); + final int x; + this(int x) : x = x; +} + +main() { + Expect.equals(1, C1().x); + Expect.equals(-1, C1().z); + Expect.equals(2, C2().x); + Expect.equals(-2, C2().z); + Expect.equals(3, C3(3).x); + Expect.equals(-3, C3(3).z); + Expect.equals(4, C4().x); + Expect.equals(-4, C4().z); + Expect.equals(5, C5(5).x); + Expect.equals(-5, C5(5).z); + + Expect.equals(1, E1.e0.x); + Expect.equals(2, E2.e0.x); + Expect.equals(3, E3.e0.x); + Expect.equals(4, E4.e0.x); + Expect.equals(5, E5.e0.x); +} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart new file mode 100644 index 0000000000..1127ffa480 --- /dev/null +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart @@ -0,0 +1,71 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The semantics of the declaring constructor is found in the +/// following steps, where `D` is the class, extension type, or enum declaration +/// in the program that includes a declaring constructor `k`, and `D2` is the +/// result of the derivation of the semantics of `D`. The derivation step will +/// delete elements that amount to the declaring constructor. Semantically, it +/// will add a new constructor `k2`, and it will add zero or more instance +/// variable declarations. +/// ... +/// If there is an initializer list following the formal parameter list `L` then +/// `k2` has an initializer list with the same elements in the same order. +/// +/// @description Check that it is a compile-time error if a declaring +/// constructor has an initializer list with superconstructor invocation not in +/// the end of the list. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=declaring-constructors + +class A(int z); + +class C1 extends A { + int x; + this: super(-1), x = 1; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C2() extends A { + int x; + this: super(-2), x = 2; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C3(int x) extends A { + int x; + this: super(-x), x = x; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C4 extends A { + int x; + this() : super(-4), x = 4; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C5 extends A { + int x; + this(int x) : super(-5), x = 5; +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +main() { + print(C1); + print(C2); + print(C3); + print(C4); + print(C5); +} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart new file mode 100644 index 0000000000..3737a29aa2 --- /dev/null +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart @@ -0,0 +1,191 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The semantics of the declaring constructor is found in the +/// following steps, where `D` is the class, extension type, or enum declaration +/// in the program that includes a declaring constructor `k`, and `D2` is the +/// result of the derivation of the semantics of `D`. The derivation step will +/// delete elements that amount to the declaring constructor. Semantically, it +/// will add a new constructor `k2`, and it will add zero or more instance +/// variable declarations. +/// ... +/// If there is an initializer list following the formal parameter list `L` then +/// `k2` has an initializer list with the same elements in the same order. +/// +/// @description Check that it is a compile-time error if a parameter of a +/// declaring constructor is initialized both in the constructor and in the +/// initializer list. Test classes. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=declaring-constructors + +class A { + int z; + A(this.z); +} + +class C1(var int x) { + this: x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C2(final int x) { + this: x = 2; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C3(this.x) { + int x; + this: x = x; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C4(super.z) extends A { + this: z = 0; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C5([var int x = 0]) { + this: x = 5; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C6([final int x = 0]) { + this: x = 6; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C7({var int x = 0}) { + this: x = 7; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C8({final int x = 0}) { + this: x = 8; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C9({required var int x}) { + this: x = 9; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C10({required final int x}) { + this: x = 10; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C11 { + this(var int x) : x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C12 { + this(final int x) : x = 2; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C13 { + int x; + this(this.x) : x = x; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C14 extends A { + this(super.z) : z = 0; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C15 { + this([var int x = 0]) : x = 15; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C16 { + this([final int x = 0]) : x = 16; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C17 { + this({var int x = 0}) : x = 17; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C18 { + this({final int x = 0}) : x = 18; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C19 { + this({required var int x}) : x = 19; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C20 { + this({required final int x}) : x = 20; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +main() { + print(C1); + print(C2); + print(C3); + print(C4); + print(C5); + print(C6); + print(C7); + print(C8); + print(C9); + print(C10); + print(C11); + print(C12); + print(C13); + print(C14); + print(C15); + print(C16); + print(C17); + print(C18); + print(C19); + print(C20); +} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart new file mode 100644 index 0000000000..4dd6604c42 --- /dev/null +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart @@ -0,0 +1,120 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The semantics of the declaring constructor is found in the +/// following steps, where `D` is the class, extension type, or enum declaration +/// in the program that includes a declaring constructor `k`, and `D2` is the +/// result of the derivation of the semantics of `D`. The derivation step will +/// delete elements that amount to the declaring constructor. Semantically, it +/// will add a new constructor `k2`, and it will add zero or more instance +/// variable declarations. +/// ... +/// If there is an initializer list following the formal parameter list `L` then +/// `k2` has an initializer list with the same elements in the same order. +/// +/// @description Check that it is a compile-time error if a parameter of a +/// declaring constructor is initialized both in the constructor and in the +/// initializer list. Test extension types. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=declaring-constructors + +extension type ET1(int x) { + this: x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET2(final int x) { + this: x = 2; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET3([int x = 0]) { + this: x = 3; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET4([final int x = 0]) { + this: x = 4; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET5({int x = 0}) { + this: x = 5; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET6({final int x = 0}) { + this: x = 6; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET7({required int x}) { + this: x = 7; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET8({required final int x}) { + this: x = 8; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET9 { + this(final int x) : x = 9; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET10 { + this([final int x = 0]) : x = 10; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET11 { + this({final int x = 0}) : x = 11; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET12 { + this({required final int x}) : x = 12; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +main() { + print(ET1); + print(ET2); + print(ET3); + print(ET4); + print(ET5); + print(ET6); + print(ET7); + print(ET8); + print(ET9); + print(ET10); + print(ET11); + print(ET12); +} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart new file mode 100644 index 0000000000..cc00bb7102 --- /dev/null +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart @@ -0,0 +1,176 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The semantics of the declaring constructor is found in the +/// following steps, where `D` is the class, extension type, or enum declaration +/// in the program that includes a declaring constructor `k`, and `D2` is the +/// result of the derivation of the semantics of `D`. The derivation step will +/// delete elements that amount to the declaring constructor. Semantically, it +/// will add a new constructor `k2`, and it will add zero or more instance +/// variable declarations. +/// ... +/// If there is an initializer list following the formal parameter list `L` then +/// `k2` has an initializer list with the same elements in the same order. +/// +/// @description Check that it is a compile-time error if a parameter of a +/// declaring constructor is initialized both in the constructor and in the +/// initializer list. Test enums. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=declaring-constructors + +enum E1(final int x) { + e0(0); + this: x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E2([final int x = 0]) { + e0(0); + this: x = 2; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E3({int x = 0}) { + e(x: 0); + this: x = 5; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E4({required final int x}) { + e(x: 0); + this: x = 4; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E5(this.x) { + e0(0); + final int x; + this: x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E6([this.x = 0]) { + e0(0); + final int x; + this: x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E7({this.x = 0}) { + e0(x: 0); + final int x; + this: x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E8({required this.x}) { + e0(x: 0); + final int x; + this: x = 1; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E9 { + e0(0); + const this(final int x) : x = 9; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E10 { + e0(0); + const this([final int x = 0]) : x = 10; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E11 { + e(x: 0); + const this({int x = 0}) : x = 11; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E12 { + e(x: 0); + const this({required final int x}) : x = 12; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E13 { + e0(0); + final int x; + const this(this.x) : x = 13; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E14 { + e0(0); + final int x; + const this([this.x = 0]) : x = 14; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E15 { + e0(x: 0); + final int x; + const this({this.x = 0}) : x = 15; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E16 { + e0(x: 0); + final int x; + const this({required this.x}) : x = 16; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +main() { + print(E1); + print(E2); + print(E3); + print(E4); + print(E5); + print(E6); + print(E7); + print(E8); + print(E9); + print(E10); + print(E11); + print(E12); + print(E13); + print(E14); + print(E15); + print(E16); +} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t06.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t06.dart new file mode 100644 index 0000000000..3fae3d99ba --- /dev/null +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t06.dart @@ -0,0 +1,61 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The semantics of the declaring constructor is found in the +/// following steps, where `D` is the class, extension type, or enum declaration +/// in the program that includes a declaring constructor `k`, and `D2` is the +/// result of the derivation of the semantics of `D`. The derivation step will +/// delete elements that amount to the declaring constructor. Semantically, it +/// will add a new constructor `k2`, and it will add zero or more instance +/// variable declarations. +/// ... +/// If there is an initializer list following the formal parameter list `L` then +/// `k2` has an initializer list with the same elements in the same order. +/// +/// @description Check that it is a compile-time error if an instance variable +/// is initialized in the initializer list more than once. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=declaring-constructors + +class C1(int v) { + int x; + this : x = 1, x = v; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +class C2 { + int x; + this(int v) : x = 1, x = v; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E1(int v) { + e0(0); + final int x; + this : x = 1, x = v; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E2 { + e0(0); + final int x; + this(int v) : x = 1, x = v; +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +main() { + print(C1); + print(C2); + print(E1); + print(E2); +} From d264b367c5072b0fb80af464201bda3ab9516005 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Wed, 15 Oct 2025 14:18:10 +0300 Subject: [PATCH 2/4] Implement review recommendations --- .../static_processing_A24_t01.dart | 18 ++---------------- .../static_processing_A24_t02.dart | 9 --------- .../static_processing_A24_t03.dart | 13 +++++++------ 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart index 8505dd54f0..9d4571a91f 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t01.dart @@ -23,11 +23,6 @@ import '../../Utils/expect.dart'; class A(int z); -class C1 extends A { - int x; - this: x = 1, super(-1); -} - class C2() extends A { int x; this: x = 2, super(-2); @@ -48,12 +43,6 @@ class C5 extends A { this(int x) : x = 5, super(-5); } -enum E1 { - e0(); - final int x; - this : x = 1; -} - enum E2() { e0(); final int x; @@ -69,18 +58,16 @@ enum E3(int x) { enum E4 { e0(); final int x; - this() : x = 4; + const this() : x = 4; } enum E5 { e0(5); final int x; - this(int x) : x = x; + const this(int x) : x = x; } main() { - Expect.equals(1, C1().x); - Expect.equals(-1, C1().z); Expect.equals(2, C2().x); Expect.equals(-2, C2().z); Expect.equals(3, C3(3).x); @@ -90,7 +77,6 @@ main() { Expect.equals(5, C5(5).x); Expect.equals(-5, C5(5).z); - Expect.equals(1, E1.e0.x); Expect.equals(2, E2.e0.x); Expect.equals(3, E3.e0.x); Expect.equals(4, E4.e0.x); diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart index 1127ffa480..7cc67dd514 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t02.dart @@ -22,14 +22,6 @@ class A(int z); -class C1 extends A { - int x; - this: super(-1), x = 1; -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - class C2() extends A { int x; this: super(-2), x = 2; @@ -63,7 +55,6 @@ class C5 extends A { } main() { - print(C1); print(C2); print(C3); print(C4); diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart index 3737a29aa2..0ef5758b18 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart @@ -14,8 +14,9 @@ /// `k2` has an initializer list with the same elements in the same order. /// /// @description Check that it is a compile-time error if a parameter of a -/// declaring constructor is initialized both in the constructor and in the -/// initializer list. Test classes. +/// declaring constructor is initialized both by an initializing formal or by a +/// declaring formal parameter of a declaing constructor and in the initializer +/// list. Test classes. /// @author sgrekhov22@gmail.com // SharedOptions=--enable-experiment=declaring-constructors @@ -48,8 +49,8 @@ class C3(this.x) { } class C4(super.z) extends A { - this: z = 0; -// ^ + this: super(0); +// ^^^^^ // [analyzer] unspecified // [cfe] unspecified } @@ -119,8 +120,8 @@ class C13 { } class C14 extends A { - this(super.z) : z = 0; -// ^ + this(super.z) : super(0); +// ^^^^^ // [analyzer] unspecified // [cfe] unspecified } From a9768e53bbdcff8e239a975e25e5a0a1305e4543 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Wed, 15 Oct 2025 14:22:36 +0300 Subject: [PATCH 3/4] Fix a typo --- .../Declaring-constructors/static_processing_A24_t03.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart index 0ef5758b18..cc43455318 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart @@ -15,7 +15,7 @@ /// /// @description Check that it is a compile-time error if a parameter of a /// declaring constructor is initialized both by an initializing formal or by a -/// declaring formal parameter of a declaing constructor and in the initializer +/// declaring formal parameter of a declaring constructor and in the initializer /// list. Test classes. /// @author sgrekhov22@gmail.com From b87bd464297aabadd2f6749596aac8d84e24db51 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Wed, 15 Oct 2025 16:57:09 +0300 Subject: [PATCH 4/4] Implement review recommendations --- .../static_processing_A24_t03.dart | 27 +++---------------- .../static_processing_A24_t04.dart | 7 ++--- .../static_processing_A24_t05.dart | 6 ++--- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart index cc43455318..23eedcfe19 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t03.dart @@ -13,19 +13,14 @@ /// If there is an initializer list following the formal parameter list `L` then /// `k2` has an initializer list with the same elements in the same order. /// -/// @description Check that it is a compile-time error if a parameter of a -/// declaring constructor is initialized both by an initializing formal or by a -/// declaring formal parameter of a declaring constructor and in the initializer -/// list. Test classes. +/// @description Check that it is a compile-time error if an instance variable +/// is initialized both by an initializing formal or by a declaring formal +/// parameter of a declaring constructor and in the initializer list. Test +/// classes. /// @author sgrekhov22@gmail.com // SharedOptions=--enable-experiment=declaring-constructors -class A { - int z; - A(this.z); -} - class C1(var int x) { this: x = 1; // ^ @@ -48,13 +43,6 @@ class C3(this.x) { // [cfe] unspecified } -class C4(super.z) extends A { - this: super(0); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - class C5([var int x = 0]) { this: x = 5; // ^ @@ -119,13 +107,6 @@ class C13 { // [cfe] unspecified } -class C14 extends A { - this(super.z) : super(0); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - class C15 { this([var int x = 0]) : x = 15; // ^ diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart index 4dd6604c42..7841c9d093 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t04.dart @@ -13,9 +13,10 @@ /// If there is an initializer list following the formal parameter list `L` then /// `k2` has an initializer list with the same elements in the same order. /// -/// @description Check that it is a compile-time error if a parameter of a -/// declaring constructor is initialized both in the constructor and in the -/// initializer list. Test extension types. +/// @description Check that it is a compile-time error if an instance variable +/// is initialized both by an initializing formal or by a declaring formal +/// parameter of a declaring constructor and in the initializer list. Test +/// extension types. /// @author sgrekhov22@gmail.com // SharedOptions=--enable-experiment=declaring-constructors diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart b/LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart index cc00bb7102..47df20a933 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart +++ b/LanguageFeatures/Declaring-constructors/static_processing_A24_t05.dart @@ -13,9 +13,9 @@ /// If there is an initializer list following the formal parameter list `L` then /// `k2` has an initializer list with the same elements in the same order. /// -/// @description Check that it is a compile-time error if a parameter of a -/// declaring constructor is initialized both in the constructor and in the -/// initializer list. Test enums. +/// @description Check that it is a compile-time error if an instance variable +/// is initialized both by an initializing formal or by a declaring formal +/// parameter of a declaring constructor and in the initializer list. Test enums. /// @author sgrekhov22@gmail.com // SharedOptions=--enable-experiment=declaring-constructors