diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A02_t01.dart b/LanguageFeatures/Declaring-constructors/static_processing_A02_t01.dart deleted file mode 100644 index fc2f13cd31..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A02_t01.dart +++ /dev/null @@ -1,64 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor (note that -/// it cannot be a ``, because that kind of declaration -/// does not support declaring constructors, that is a syntax error). -/// -/// @description Check that it is a compile-time error to declare a mixin with a -/// declaring constructor. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -mixin M1() {} -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -mixin M2; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -mixin const M3(final int v); -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -mixin M4(var int v) {} -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -mixin M5 { - this(); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -mixin M6 { - this.someName(var int v); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -mixin M7.someName() { -// ^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(M1); - print(M2); - print(M3); - print(M4); - print(M5); - print(M6); - print(M7); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A02_t02.dart b/LanguageFeatures/Declaring-constructors/static_processing_A02_t02.dart deleted file mode 100644 index 1be223c770..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A02_t02.dart +++ /dev/null @@ -1,55 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor (note that -/// it cannot be a ``, because that kind of declaration -/// does not support declaring constructors, that is a syntax error). -/// -/// @description Check that it is a compile-time error to declare a mixin class -/// with a non-trivial declaring constructor. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -mixin class M1() {} // Ok, this declares a "trivial" constructor - -base mixin class M2; - -mixin class const M3(final int v); -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -base mixin M4(var int v) {} -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -abstract mixin class M5 { - this(); // Ok, "trivial" constructor -} - -abstract base mixin class M6 { - this.someName(var int v); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -base mixin M7.someName() { // Constructor is "trivial" but it's not a "mixin class" -// ^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(M1); - print(M2); - print(M3); - print(M4); - print(M5); - print(M6); - print(M7); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A02_t03.dart b/LanguageFeatures/Declaring-constructors/static_processing_A02_t03.dart deleted file mode 100644 index 249338c3bb..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A02_t03.dart +++ /dev/null @@ -1,49 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor (note that -/// it cannot be a ``, because that kind of declaration -/// does not support declaring constructors, that is a syntax error). -/// -/// @description Check that it is a syntax error to declare a mixin application -/// class with a primary constructor. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -mixin M {} - -class C1() = Object with M; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -class C2.someName() = Object with M; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -class const C3.someName(final int v) = Object with M; -// ^ -// [analyzer] unspecified -// [cfe] unspecified - -class C4.new(var int v) = Object with M; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -class C5._() = Object with M; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified - -main() { - print(C1); - print(C2); - print(C3); - print(C4); - print(C5); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t01.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t01.dart deleted file mode 100644 index 6e18e9cf81..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t01.dart +++ /dev/null @@ -1,34 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is a compile-time error if the body of `D` -/// contains a non-redirecting generative constructor. Test a class. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -class C1(var int v) { - C1.someName(this.v); -// ^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C2.someName(final int v) { - C2(int x) : v = 42; -//^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(C1); - print(C2); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t02.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t02.dart deleted file mode 100644 index 62472cf88d..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t02.dart +++ /dev/null @@ -1,38 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is a compile-time error if the body of `D` -/// contains a non-redirecting generative constructor. Test an enum. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -enum const E1(final int v) { - e0(1); - - const E1.someName(this.v); -// ^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum const E2.someName(final int v) { - e0(2); - - const E2(int x) : v = 42; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(E1); - print(E2); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t03.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t03.dart deleted file mode 100644 index 32489a4aa4..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t03.dart +++ /dev/null @@ -1,30 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is not an error if `D` is an extension type and -/// the body of `D` contains a non-redirecting generative constructor. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -import '../../Utils/expect.dart'; - -extension type ET1(var int v) { - ET1.someName(this.v); -} - -extension type const ET2.someName(final int v) { - const ET2(int v) : this.v = v; -} - -main() { - Expect.equals(1, ET1(1).v); - Expect.equals(2, ET2(2).v); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t04.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t04.dart deleted file mode 100644 index cc98c2d2f8..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t04.dart +++ /dev/null @@ -1,30 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is not an error if the body of `D` contains a -/// redirecting generative constructor. Test a class. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -import '../../Utils/expect.dart'; - -class C1(var int v) { - C1.someName(int v) : this(v); -} - -class const C2.someName(final int v) { - const C2(int v) : this.someName(v); -} - -main() { - Expect.equals(1, C1(1).v); - Expect.equals(2, C2(2).v); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t05.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t05.dart deleted file mode 100644 index fc82d99b4f..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t05.dart +++ /dev/null @@ -1,34 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is not an error if the body of `D` contains a -/// redirecting generative constructor. Test an enum. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -import '../../Utils/expect.dart'; - -enum E1(final int v) { - e0(1); - - E1.someName(int v) : this(v); -} - -enum const E2.someName(final int v) { - e0.someName(2); - - const C2(int v) : this.someName(v); -} - -main() { - Expect.equals(1, E1.e0.v); - Expect.equals(2, E2.e0.v); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t06.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t06.dart deleted file mode 100644 index 761080c3de..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t06.dart +++ /dev/null @@ -1,30 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is not an error if the body of `D` contains a -/// factory constructor. Test a class. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -import '../../Utils/expect.dart'; - -class C1(var int v) { - factory C1.someName(int v) => C1(v); -} - -class const C2.someName(final int v) { - const factory C2(int v) = C2.someName; -} - -main() { - Expect.equals(1, C1(1).v); - Expect.equals(2, C2(2).v); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t07.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t07.dart deleted file mode 100644 index ed9aab6b1e..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t07.dart +++ /dev/null @@ -1,30 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is not an error if the body of `D` contains a -/// factory constructor. Test an extension type. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -import '../../Utils/expect.dart'; - -extension type ET1(int v) { - factory ET1.someName(int v) => ET1(v); -} - -extension type const ET2.someName(final int v) { - const factory ET2(int v) = ET2.someName; -} - -main() { - Expect.equals(1, ET1(1).v); - Expect.equals(2, ET2(2).v); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A03_t08.dart b/LanguageFeatures/Declaring-constructors/static_processing_A03_t08.dart deleted file mode 100644 index 379e3513a2..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A03_t08.dart +++ /dev/null @@ -1,34 +0,0 @@ -// 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor). -/// ... -/// A compile-time error occurs if the body of `D` contains a non-redirecting -/// generative constructor, unless `D` is an extension type. -/// -/// @description Check that it is not an error if the body of `D` contains a -/// factory constructor. Test an enum. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -import '../../Utils/expect.dart'; - -enum E1(int v) { - e0(1); - - factory ET1.someName(int v) => E1.e0; -} - -enum const E2.someName(final int v) { - e0(2); - - const factory E2(int v) => E2.e0; -} - -main() { - Expect.equals(1, E1.e0.v); - Expect.equals(2, E2.e0.v); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A05_t02.dart b/LanguageFeatures/Declaring-constructors/static_processing_A05_t02.dart deleted file mode 100644 index 29da48493c..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A05_t02.dart +++ /dev/null @@ -1,61 +0,0 @@ -// 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 A compile-time error occurs if the name of the primary -/// constructor is the same as the name of a constructor (declaring or not) in -/// the body. -/// -/// @description Check that it is a compile-time error if the name of the -/// declaring constructor is the same as the name of some constructor declared -/// in the body. Test extension types. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -extension type ET1(int v) { - ET1(this.v); -//^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type const ET3.someName(final int v) { - const ET3.someName(this.v); -// ^^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET4 { - this.someName(final int v); - ET4.someName(this.v); -//^^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET5(final int v) { - ET5.someName(int v) : this(v); - factory ET5(int v) = ET5.someName; -// ^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET6 { - this.someName(final int v); - ET6(this.v); - factory ET6.someName(int v) => ET6(v); -// ^^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(ET1); - print(ET3); - print(ET4); - print(ET5); - print(ET6); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A05_t04.dart b/LanguageFeatures/Declaring-constructors/static_processing_A05_t04.dart deleted file mode 100644 index be3795e930..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A05_t04.dart +++ /dev/null @@ -1,117 +0,0 @@ -// 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 A compile-time error occurs if the name of the primary -/// constructor is the same as the name of a constructor (declaring or not) in -/// the body. -/// -/// @description Check that it is a compile-time error if the name of an in-body -/// declaring constructor is the same as the name of some constructor declared -/// in the body. Test classes. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -class C1 { - this(var int v); - C1.foo(this.v); - C1(int v) : this.foo(v); -//^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C2 { - this(var int v2); - C2.foo(this.v); - C2.new(int v) : this.foo(v); -//^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C3 { - this.new(var int v); - C3.foo(this.v); - C3(int v) : this.foo(v); -//^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C5 { - this.new(var int v); - C5.foo(this.v); - C5.new(int v) : this.foo(v); -//^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C6 { - const this.someName(final int v); - const C6(this.v); - const C6.someName(int v) : this(v); -// ^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C7 { - this(var int v); - C7.foo(int v) : this(v); - factory C7(int v) = C7.foo; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C8 { - this(var int v); - C8.foo(int v) : this(v); - factory C8.new(int v) = C8.foo; -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C9 { - this.new(var int v); - C9.foo(int v) : this(v); - factory C9(int v) = C9.foo; -// ^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C10 { - this.new(var int v); - C10.foo(int v) : this(v); - factory C10.new(int v) = C10.foo; -// ^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C11 { - this.someName(final int v); - C11(this.v); - factory C11.someName(int v) => C11(v); -// ^^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(C1); - print(C2); - print(C3); - print(C5); - print(C6); - print(C7); - print(C8); - print(C9); - print(C10); - print(C11); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A05_t05.dart b/LanguageFeatures/Declaring-constructors/static_processing_A05_t05.dart deleted file mode 100644 index acc257b67f..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A05_t05.dart +++ /dev/null @@ -1,93 +0,0 @@ -// 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 A compile-time error occurs if the name of the primary -/// constructor is the same as the name of a constructor (declaring or not) in -/// the body. -/// -/// @description Check that it is a compile-time error if the name of an in-body -/// declaring constructor is the same as the name of some constructor declared -/// in the body. Test extension types. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -extension type ET1 { - this(final int v); - ET1(this.v); -//^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET2 { - this(final int v); - ET2.new(this.v); -//^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET3 { - this.new(final int v); - ET3(this.v); -//^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET4 { - this.new(final int v); - ET4.new(this.v); -//^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET5 { - this(final int v); - ET.foo(int v) : this(v); - factory ET5(int v) = ET5.foo; -// ^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET6 { - this.new(final int v); - ET6.foo(int v) : this(v); - factory ET6(int v) = ET6.foo; -// ^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET7 { - this(final int v); - ET7.foo(this.v); - factory ET7.new(int v) => ET7.foo(v); -// ^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET8 { - this.new(final int v); - ET8.foo(this.v); - factory ET8.new(int v) => ET8.foo(v); -// ^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(ET1); - print(ET2); - print(ET3); - print(ET4); - print(ET5); - print(ET6); - print(ET7); - print(ET8); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A05_t06.dart b/LanguageFeatures/Declaring-constructors/static_processing_A05_t06.dart deleted file mode 100644 index ca4713ee87..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A05_t06.dart +++ /dev/null @@ -1,76 +0,0 @@ -// 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 A compile-time error occurs if the name of the primary -/// constructor is the same as the name of a constructor (declaring or not) in -/// the body. -/// -/// @description Check that it is a compile-time error if the name of an in-body -/// declaring constructor is the same as the name of some constructor declared -/// in the body. Test enums. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=declaring-constructors - -enum E1 { - e0(1); - - const this(final int v); - const E1.foo(this.v); - const E1(int v) : this.foo(v); -// ^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E2 { - e0(2); - - const this.new(final int v); - const E1.foo(this.v); - const E2(int v) : this.invalid(v); -// ^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E3 { - e0(3); - - const this(final int v); - const E3.foo(this.v); - const E3.new(int v) : this.foo(v); -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E4 { - e0(4); - - const this.new(final int v); - const E4.foo(this.v); - const E4.new(int v) : this.foo(v); -// ^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E5 { - e0(5); - const this.someName(final int v); - const E4.foo(this.v); - const E5.someName(int v) : this.foo(v); -// ^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(E1); - print(E2); - print(E3); - print(E4); - print(E5); -} diff --git a/LanguageFeatures/Primary-constructors/static_processing_A02_t03.dart b/LanguageFeatures/Primary-constructors/static_processing_A02_t03.dart index f5294d7564..e29b09131a 100644 --- a/LanguageFeatures/Primary-constructors/static_processing_A02_t03.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A02_t03.dart @@ -43,9 +43,28 @@ extension type ET4._() { // [cfe] unspecified } +extension type ET5(final int v) { + ET5.someName(int v) : this(v); + factory ET5(int v) = ET5.someName; +// ^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +extension type ET6.someName(int v) { + ET6(this.v); + factory ET6.someName(int v) => ET6(v); +// ^^^^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + + main() { print(ET1); print(ET2); print(ET3); print(ET4); + print(ET5); + print(ET6); } diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A05_t01.dart b/LanguageFeatures/Primary-constructors/static_processing_A02_t13.dart similarity index 82% rename from LanguageFeatures/Declaring-constructors/static_processing_A05_t01.dart rename to LanguageFeatures/Primary-constructors/static_processing_A02_t13.dart index 73c41355a4..061a325292 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A05_t01.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A02_t13.dart @@ -2,13 +2,15 @@ // 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 A compile-time error occurs if the name of the primary -/// constructor is the same as the name of a constructor (declaring or not) in -/// the body. +/// @assertion A compile-time error occurs if a class, mixin class, enum, or +/// extension type has a primary constructor whose name is also the name of a +/// constructor declared in the body, or if it declares a primary constructor +/// whose name is `C.n`, and the body declares a static member whose basename is +/// `n`. /// /// @description Check that it is a compile-time error if the name of the -/// declaring constructor is the same as the name of some constructor declared -/// in the body. Test classes. +/// primary constructor is the same as the name of some constructor declared in +/// the body. Test classes. /// @author sgrekhov22@gmail.com // SharedOptions=--enable-experiment=declaring-constructors @@ -25,8 +27,8 @@ class C1(var int v) { } class C2(int v1) { - this(var int v2); -//^^^^ + new(int v1); +//^^^ // [analyzer] unspecified // [cfe] unspecified } @@ -50,15 +52,6 @@ class C5(var int v) { // [cfe] unspecified } -class C6 { - this.someName(final int v); - C6(this.v); - factory C6.someName(int v) => C6(v); -// ^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - class C7.new(var int v) { C7.invalid(this.v); //^^^^^^^^^^ @@ -121,7 +114,6 @@ main() { print(C2); print(C3); print(C5); - print(C6); print(C7); print(C8); print(C9); diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A05_t03.dart b/LanguageFeatures/Primary-constructors/static_processing_A02_t14.dart similarity index 63% rename from LanguageFeatures/Declaring-constructors/static_processing_A05_t03.dart rename to LanguageFeatures/Primary-constructors/static_processing_A02_t14.dart index 87f2085385..f31cb05b09 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A05_t03.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A02_t14.dart @@ -2,13 +2,15 @@ // 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 A compile-time error occurs if the name of the primary -/// constructor is the same as the name of a constructor (declaring or not) in -/// the body. +/// @assertion A compile-time error occurs if a class, mixin class, enum, or +/// extension type has a primary constructor whose name is also the name of a +/// constructor declared in the body, or if it declares a primary constructor +/// whose name is `C.n`, and the body declares a static member whose basename is +/// `n`. /// /// @description Check that it is a compile-time error if the name of the -/// declaring constructor is the same as the name of some constructor declared -/// in the body. Test enums. +/// primary constructor is the same as the name of some constructor declared in +/// the body. Test enums. /// @author sgrekhov22@gmail.com // SharedOptions=--enable-experiment=declaring-constructors @@ -28,27 +30,19 @@ enum const E1(final int v) { enum const E2(final int v) { e0(2); - const this(final int v); -// ^^^^ + const new(int v); +// ^^^ // [analyzer] unspecified // [cfe] unspecified } enum const E3.someName(final int v) { e0(3); - const E3.someName(this.v); -// ^^^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum const E4.someName(final int v) { - e0(4); - const E4(this.v); + const E3(this.v); // ^^ // [analyzer] unspecified // [cfe] unspecified - const E4.someName(int v) : this(v); + const E3.someName(int v) : this(v); // ^^^^^^^^^^^ // [analyzer] unspecified // [cfe] unspecified @@ -58,5 +52,4 @@ main() { print(E1); print(E2); print(E3); - print(E4); } diff --git a/LanguageFeatures/Primary-constructors/static_processing_A05_t03.dart b/LanguageFeatures/Primary-constructors/static_processing_A05_t03.dart index e6cda81d7d..c1f24a65f1 100644 --- a/LanguageFeatures/Primary-constructors/static_processing_A05_t03.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A05_t03.dart @@ -2,12 +2,16 @@ // 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 Consider a class, enum, or extension type declaration `D` with a -/// declaring header constructor, also known as a primary constructor. +/// @assertion Consider a class, mixin class, enum, or extension type +/// declaration `D` with a primary constructor (note that it cannot be a +/// ``, because that kind of declaration does not +/// syntactically support primary constructors). This declaration is treated as +/// a class, mixin class, enum, respectively extension type declaration without +/// a primary constructor which is obtained as described in the following. This +/// determines the dynamic semantics of a primary constructor. /// ... -/// If `D` is an extension type, it is a compile-time error if `D` -/// does not contain a declaring constructor that has exactly one declaring -/// parameter which is `final`. +/// If `D` is an extension type, it is a compile-time error if the primary +/// constructor that `D` contains does not have exactly one parameter. /// /// @description Check that it is a compile-time error if an extension type does /// not contain a declaring constructor that has exactly one declaring parameter