diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A08_t01.dart b/LanguageFeatures/Declaring-constructors/static_processing_A08_t01.dart deleted file mode 100644 index d9f19afd9d..0000000000 --- a/LanguageFeatures/Declaring-constructors/static_processing_A08_t01.dart +++ /dev/null @@ -1,78 +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 The following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: -/// ... -/// A compile-time error occurs if `p` has both of the modifiers `covariant` and -/// `final`, also if the latter is implicitly induced (which can occur in a -/// primary constructor of an extension type declaration). -/// -/// @description Check that it is a compile-time error if a formal parameters of -/// a declaring constructor has both of the modifiers `covariant` and `final`. -/// Test classes. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=primary-constructors - -class C1(covariant final String x) {} -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - -class C2([covariant final String x = ""]) {} -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - -class C3({covariant final String x = ""}) {} -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - -class C4({required covariant final String x}) {} -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified - -class C5 { - this(covariant final String x); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C6 { - this([covariant final String x = ""]); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C7 { - this({covariant final String x = ""}); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C8 { - this({required covariant final String x}); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -main() { - print(C1); - print(C2); - print(C3); - print(C4); - print(C5); - print(C6); - print(C7); - print(C8); -} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A07_t01.dart b/LanguageFeatures/Primary-constructors/static_processing_A07_t01.dart similarity index 59% rename from LanguageFeatures/Declaring-constructors/static_processing_A07_t01.dart rename to LanguageFeatures/Primary-constructors/static_processing_A07_t01.dart index f069c218d9..46c59f5494 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A07_t01.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A07_t01.dart @@ -2,17 +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 The following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// /// A compile-time error occurs if `p` contains a term of the form /// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier /// `covariant`. /// /// @description Check that it is a compile-time error if a formal parameter of -/// a declaring constructor contains a term of the form `this.v` and has the +/// a primary constructor contains a term of the form `this.v` and has the /// modifier `covariant`. Test classes. /// @author sgrekhov22@gmail.com @@ -46,45 +45,9 @@ class C4({required covariant String this.x}) { String x; } -class C5 { - String x; - this(covariant String this.x); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C6 { - String x; - this([covariant this.x = ""]); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C7 { - String x; - this({covariant String this.x = ""}); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C8 { - String x; - this({required covariant String this.x}); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - main() { print(C1); print(C2); print(C3); print(C4); - print(C5); - print(C6); - print(C7); - print(C8); } diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A07_t02.dart b/LanguageFeatures/Primary-constructors/static_processing_A07_t02.dart similarity index 59% rename from LanguageFeatures/Declaring-constructors/static_processing_A07_t02.dart rename to LanguageFeatures/Primary-constructors/static_processing_A07_t02.dart index 063c74ec56..8f925478a7 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A07_t02.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A07_t02.dart @@ -2,17 +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 The following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// /// A compile-time error occurs if `p` contains a term of the form /// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier /// `covariant`. /// /// @description Check that it is a compile-time error if a formal parameter of -/// a declaring constructor contains a term of the form `super.v` and has the +/// a primary constructor contains a term of the form `super.v` and has the /// modifier `covariant`. Test classes. /// @author sgrekhov22@gmail.com @@ -51,45 +50,9 @@ class C4({required covariant String super.x}) extends A { String x; } -class C5 extends A { - String x; - this(covariant String super.x); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C6 extends A { - String x; - this([covariant super.x = ""]); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C7 extends A { - String x; - this({covariant String super.x = ""}); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C8 extends A { - String x; - this({required covariant String super.x}); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - main() { print(C1); print(C2); print(C3); print(C4); - print(C5); - print(C6); - print(C7); - print(C8); } diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A07_t03.dart b/LanguageFeatures/Primary-constructors/static_processing_A07_t03.dart similarity index 60% rename from LanguageFeatures/Declaring-constructors/static_processing_A07_t03.dart rename to LanguageFeatures/Primary-constructors/static_processing_A07_t03.dart index ddb728903d..763ff8551e 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A07_t03.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A07_t03.dart @@ -2,17 +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 The following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// /// A compile-time error occurs if `p` contains a term of the form /// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier /// `covariant`. /// /// @description Check that it is a compile-time error if a formal parameter of -/// a declaring constructor contains a term of the form `this.v` and has the +/// a primary constructor contains a term of the form `this.v` and has the /// modifier `covariant`. Test extension types. /// @author sgrekhov22@gmail.com @@ -46,41 +45,9 @@ extension type ET4({required covariant String this.x}) { ET4.someName(String x); } -extension type ET5(String x) { - this.someName(covariant String this.x); -//^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET6(String x) { - this.someName([covariant String this.x = ""]); -//^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET7(String x) { - this.someName({covariant String this.x = ""}); -//^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET8(String x) { - this.someName({required covariant String this.x}); -//^ -// [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_A07_t04.dart b/LanguageFeatures/Primary-constructors/static_processing_A07_t04.dart similarity index 59% rename from LanguageFeatures/Declaring-constructors/static_processing_A07_t04.dart rename to LanguageFeatures/Primary-constructors/static_processing_A07_t04.dart index 0c350e2ab6..748e07bff6 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A07_t04.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A07_t04.dart @@ -2,17 +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 The following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// /// A compile-time error occurs if `p` contains a term of the form /// `this.v`, or `super.v` where `v` is an identifier, and `p` has the modifier /// `covariant`. /// /// @description Check that it is a compile-time error if a formal parameter of -/// a declaring constructor contains a term of the form `this.v` and has the +/// a primary constructor contains a term of the form `this.v` and has the /// modifier `covariant`. Test enums. /// @author sgrekhov22@gmail.com @@ -50,49 +49,10 @@ enum E4({required covariant String this.x}) { final String x; } -enum E5 { - e0(""); - final String x; - this(covariant String this.x); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E6 { - e0(""); - final String x; - this([covariant this.x = ""]); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E7 { - e0(""); - final String x; - this({covariant String this.x = ""}); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E8 { - e0(""); - final String x; - this({required covariant String this.x}); -//^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} main() { print(E1); print(E2); print(E3); print(E4); - print(E5); - print(E6); - print(E7); - print(E8); } diff --git a/LanguageFeatures/Primary-constructors/static_processing_A08_t01.dart b/LanguageFeatures/Primary-constructors/static_processing_A08_t01.dart new file mode 100644 index 0000000000..f894c72946 --- /dev/null +++ b/LanguageFeatures/Primary-constructors/static_processing_A08_t01.dart @@ -0,0 +1,43 @@ +// 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 following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: +/// ... +/// A compile-time error occurs if `p` has the modifier covariant, but not `var`. +/// +/// @description Check that it is a compile-time error if a formal parameters of +/// a primary constructor has both of the modifiers `covariant` and `final`. +/// Test classes. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=primary-constructors + +class C1(covariant final String x) {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +class C2([covariant final String x = ""]) {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +class C3({covariant final String x = ""}) {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +class C4({required covariant final String x}) {} +// ^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { + print(C1); + print(C2); + print(C3); + print(C4); +} diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A08_t02.dart b/LanguageFeatures/Primary-constructors/static_processing_A08_t02.dart similarity index 52% rename from LanguageFeatures/Declaring-constructors/static_processing_A08_t02.dart rename to LanguageFeatures/Primary-constructors/static_processing_A08_t02.dart index c572620630..23e757a51a 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A08_t02.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A08_t02.dart @@ -2,17 +2,14 @@ // 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 following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// ... -/// A compile-time error occurs if `p` has both of the modifiers `covariant` and -/// `final`, also if the latter is implicitly induced (which can occur in a -/// primary constructor of an extension type declaration). +/// A compile-time error occurs if `p` has the modifier covariant, but not `var`. /// /// @description Check that it is a compile-time error if a formal parameters of -/// a declaring constructor has both of the modifiers `covariant` and `final`. +/// a primary constructor has both of the modifiers `covariant` and `final`. /// Test extension types. /// @author sgrekhov22@gmail.com @@ -39,41 +36,9 @@ extension type ET4({required covariant String x}) {} // [analyzer] unspecified // [cfe] unspecified -extension type ET5 { - this(covariant final String x); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET6 { - this([covariant final String x = ""]); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET7 { - this({covariant final String x = ""}); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -extension type ET8 { - this({required covariant final String x}); -// ^^^^^^^^^ -// [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_A08_t03.dart b/LanguageFeatures/Primary-constructors/static_processing_A08_t03.dart similarity index 59% rename from LanguageFeatures/Declaring-constructors/static_processing_A08_t03.dart rename to LanguageFeatures/Primary-constructors/static_processing_A08_t03.dart index 3b678a710b..7963adc168 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A08_t03.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A08_t03.dart @@ -2,17 +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 The following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// ... /// A compile-time error occurs if `p` has both of the modifiers `covariant` and /// `final`, also if the latter is implicitly induced (which can occur in a /// primary constructor of an extension type declaration). /// /// @description Check that it is a compile-time error if a formal parameters of -/// a declaring constructor has both of the modifiers `covariant` and `final`. +/// a primary constructor has both of the modifiers `covariant` and `final`. /// Test enums. /// @author sgrekhov22@gmail.com @@ -46,45 +45,9 @@ enum E4({required covariant final String x}) { e0(x: ""); } -enum E5 { - e0(""); - this(covariant final String x); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E6 { - e0(); - this([covariant final String x = ""]); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E7 { - e0(); - this({covariant final String x = ""}); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E8 { - e0(x: ""); - this({required covariant final String x}); -// ^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - main() { print(E1); print(E2); print(E3); print(E4); - print(E5); - print(E6); - print(E7); - print(E8); } diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A09_t01.dart b/LanguageFeatures/Primary-constructors/static_processing_A09_t01.dart similarity index 52% rename from LanguageFeatures/Declaring-constructors/static_processing_A09_t01.dart rename to LanguageFeatures/Primary-constructors/static_processing_A09_t01.dart index 75dea6235f..efeb4d6a16 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A09_t01.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A09_t01.dart @@ -2,15 +2,14 @@ // 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 following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// ... -/// A compile-time error occurs if p has the modifier covariant, but not `var`. +/// A compile-time error occurs if `p` has the modifier covariant, but not `var`. /// /// @description Check that it is a compile-time error if a formal parameters of -/// a declaring constructor has the modifier `covariant`, but not `var`. Test +/// a primary constructor has the modifier `covariant`, but not `var`. Test /// classes. /// @author sgrekhov22@gmail.com @@ -36,41 +35,9 @@ class C4({required covariant String x}) {} // [analyzer] unspecified // [cfe] unspecified -class C5 { - this(covariant String x); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C6 { - this([covariant String x = ""]); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C7 { - this({covariant String x = ""}); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -class C8 { - this({required covariant String x}); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - main() { print(C1); print(C2); print(C3); print(C4); - print(C5); - print(C6); - print(C7); - print(C8); } diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A09_t03.dart b/LanguageFeatures/Primary-constructors/static_processing_A09_t03.dart similarity index 52% rename from LanguageFeatures/Declaring-constructors/static_processing_A09_t03.dart rename to LanguageFeatures/Primary-constructors/static_processing_A09_t03.dart index 3aeacd8ec1..9594370e6f 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A09_t03.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A09_t03.dart @@ -2,16 +2,14 @@ // 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 following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// ... -/// A compile-time error occurs if `p` has the modifier `covariant`, but neither -/// `var` nor `final`. +/// A compile-time error occurs if `p` has the modifier covariant, but not `var`. /// /// @description Check that it is a compile-time error if a formal parameters of -/// a declaring constructor has the modifier `covariant`, but not `var`. Test +/// a primary constructor has the modifier `covariant`, but not `var`. Test /// enums. /// @author sgrekhov22@gmail.com @@ -45,45 +43,9 @@ enum E4({required covariant String x}) { e0(x: ""); } -enum E5 { - e0(""); - this(covariant String x); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E6 { - e0(); - this([covariant String x = ""]); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E7 { - e0(); - this({covariant String x = ""}); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - -enum E8 { - e0(x: ""); - this({required covariant String x}); -// ^^^^^^^^^ -// [analyzer] unspecified -// [cfe] unspecified -} - main() { print(E1); print(E2); print(E3); print(E4); - print(E5); - print(E6); - print(E7); - print(E8); } diff --git a/LanguageFeatures/Declaring-constructors/static_processing_A10_t01.dart b/LanguageFeatures/Primary-constructors/static_processing_A10_t01.dart similarity index 58% rename from LanguageFeatures/Declaring-constructors/static_processing_A10_t01.dart rename to LanguageFeatures/Primary-constructors/static_processing_A10_t01.dart index 613a50c593..b9f80362d4 100644 --- a/LanguageFeatures/Declaring-constructors/static_processing_A10_t01.dart +++ b/LanguageFeatures/Primary-constructors/static_processing_A10_t01.dart @@ -2,13 +2,12 @@ // 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 following errors apply to formal parameters of a declaring -/// constructor, be it in the header or in the body. Let `p` be a formal -/// parameter of a declaring constructor in a class, enum, or extension type -/// declaration `D` named `C`: +/// @assertion The following errors apply to formal parameters of a primary +/// constructor. Let `p` be a formal parameter of a primary constructor in a +/// class, mixin class, enum, or extension type declaration `D` named `C`: /// ... /// Conversely, it is not an error for the modifier `covariant` to occur on a -/// declaring formal parameter `p` of a declaring constructor. This extends the +/// declaring formal parameter `p` of a primary constructor. This extends the /// existing allowlist of places where `covariant` can occur. /// /// @description Check that it is not an error if a formal parameters of a @@ -35,30 +34,6 @@ class C4({required covariant var num x}); class D4({required int super.x}) extends C4; -class C5 { - this(covariant var num x); -} - -class D5(int super.x) extends C5; - -class C6 { - this([covariant var num x = 0]); -} - -class D6(int super.x) extends C6; - -class C7 { - this({covariant var num x = 0}); -} - -class D7({int super.x}) extends C7; - -class C8 { - this({required covariant var num x}); -} - -class D8({required int super.x}) extends C8; - main() { Expect.equals(1, D1(1).x); Expect.throws(() { @@ -79,24 +54,4 @@ main() { Expect.throws(() { D4(x: 3.14 as dynamic); }); - - Expect.equals(5, D5(5).x); - Expect.throws(() { - D5(3.14 as dynamic); - }); - - Expect.equals(6, D6(6).x); - Expect.throws(() { - D6(3.14 as dynamic); - }); - - Expect.equals(7, D7(x: 7).x); - Expect.throws(() { - D7(x: 3.14 as dynamic); - }); - - Expect.equals(8, D8(x: 8).x); - Expect.throws(() { - D8(x: 3.14 as dynamic); - }); }