From 776b154353a97441ec951686442381ca2d1c9105 Mon Sep 17 00:00:00 2001 From: sgrekhov Date: Thu, 12 Dec 2024 10:12:18 +0200 Subject: [PATCH] #2559. Update assertions for redirecting generative constructors tests --- ...t => augmenting_constructors_A06_t03.dart} | 22 ++++++-- .../augmenting_constructors_A06_t03_lib.dart | 51 +++++++++++++++++++ ...t => augmenting_constructors_A06_t04.dart} | 10 ++-- ... augmenting_constructors_A06_t04_lib.dart} | 10 ++-- .../augmenting_constructors_A18_t01.dart | 3 +- .../augmenting_constructors_A18_t01_lib.dart | 3 +- .../augmenting_constructors_A18_t02.dart | 3 +- .../augmenting_constructors_A18_t02_lib.dart | 3 +- .../augmenting_constructors_A18_t03.dart | 3 +- .../augmenting_constructors_A18_t03_lib.dart | 3 +- .../augmenting_constructors_A18_t04.dart | 4 +- .../augmenting_constructors_A18_t04_lib.dart | 4 +- .../augmenting_constructors_A18_t05_lib.dart | 28 ---------- .../augmenting_constructors_A18_t06.dart | 4 +- .../augmenting_constructors_A18_t06_lib.dart | 4 +- 15 files changed, 92 insertions(+), 63 deletions(-) rename LanguageFeatures/Augmentation-libraries/{augmenting_constructors_A18_t05.dart => augmenting_constructors_A06_t03.dart} (54%) create mode 100644 LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t03_lib.dart rename LanguageFeatures/Augmentation-libraries/{augmenting_constructors_A18_t07.dart => augmenting_constructors_A06_t04.dart} (70%) rename LanguageFeatures/Augmentation-libraries/{augmenting_constructors_A18_t07_lib.dart => augmenting_constructors_A06_t04_lib.dart} (84%) delete mode 100644 LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t05_lib.dart diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t05.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t03.dart similarity index 54% rename from LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t05.dart rename to LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t03.dart index 1b95430595..1ac8b145cb 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t05.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t03.dart @@ -2,11 +2,11 @@ // 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 Redirecting generative constructors +/// @assertion It is a compile-time error if: /// ... -/// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The resulting constructor is not valid (it has a redirection as well as +/// some initializer list elements, or it has multiple super initializers, +/// etc). /// /// @description Checks that it is a compile-time error if a merged constructor /// is cyclic. @@ -14,13 +14,25 @@ // SharedOptions=--enable-experiment=macros -part 'augmenting_constructors_A18_t05_lib.dart'; +part 'augmenting_constructors_A06_t03_lib.dart'; class C { C(); C.foo(); } +enum E { + e0; + const E(); + const E.foo(); +} + +extension type ET(int v) { + ET.foo(int v); +} + main() { print(C); + print(E); + print(ET); } diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t03_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t03_lib.dart new file mode 100644 index 0000000000..296ff65452 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t03_lib.dart @@ -0,0 +1,51 @@ +// Copyright (c) 2024, 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 It is a compile-time error if: +/// ... +/// - The resulting constructor is not valid (it has a redirection as well as +/// some initializer list elements, or it has multiple super initializers, +/// etc). +/// +/// @description Checks that it is a compile-time error if a merged constructor +/// is cyclic. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +part of 'augmenting_constructors_A06_t03.dart'; + +augment class C { + augment C() : this(); +// ^ +// [analyzer] unspecified +// [cfe] unspecified + augment C.foo() : this.foo(); +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment enum E { + augment e0; + augment const E() : this(); +// ^ +// [analyzer] unspecified +// [cfe] unspecified + augment const E.foo() : this.foo(); +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment extension type ET { + augment ET(int v) : this.foo(v); +// ^ +// [analyzer] unspecified +// [cfe] unspecified + augment ET.foo(int v) : this.foo(v); +// ^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t07.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t04.dart similarity index 70% rename from LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t07.dart rename to LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t04.dart index d90f874a16..c0c115c09f 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t07.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t04.dart @@ -2,11 +2,11 @@ // 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 Redirecting generative constructors +/// @assertion It is a compile-time error if: /// ... -/// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The resulting constructor is not valid (it has a redirection as well as +/// some initializer list elements, or it has multiple super initializers, +/// etc). /// /// @description Checks that it is a compile-time error if a merged constructor /// is cyclic. @@ -14,7 +14,7 @@ // SharedOptions=--enable-experiment=macros -part 'augmenting_constructors_A18_t07_lib.dart'; +part 'augmenting_constructors_A06_t04_lib.dart'; class C { C(); diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t07_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t04_lib.dart similarity index 84% rename from LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t07_lib.dart rename to LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t04_lib.dart index a17af1bfe3..705fd6c943 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t07_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A06_t04_lib.dart @@ -2,11 +2,11 @@ // 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 Redirecting generative constructors +/// @assertion It is a compile-time error if: /// ... -/// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The resulting constructor is not valid (it has a redirection as well as +/// some initializer list elements, or it has multiple super initializers, +/// etc). /// /// @description Checks that it is a compile-time error if a merged constructor /// is cyclic. @@ -14,7 +14,7 @@ // SharedOptions=--enable-experiment=macros -part of 'augmenting_constructors_A18_t07.dart'; +part of 'augmenting_constructors_A06_t04.dart'; augment class C { augment C(): this.foo(); diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01.dart index eeff368f3e..4c5d6d0a58 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01.dart @@ -5,8 +5,7 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The augmented constructor has any initializers. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if the augmented constructor has diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01_lib.dart index 980f0e16f0..6a6ec7b1c2 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t01_lib.dart @@ -5,8 +5,7 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The augmented constructor has any initializers. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if the augmented constructor has diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02.dart index 7a774349e7..b0d0f56fa7 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02.dart @@ -5,8 +5,7 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The augmented constructor has any initializers. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if the augmented constructor has a diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02_lib.dart index 38a3ad0d9a..d70caf00ac 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t02_lib.dart @@ -5,8 +5,7 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The augmented constructor has any initializers. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if the augmented constructor has a diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03.dart index 2d4bc6a473..79c275aa8a 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03.dart @@ -5,8 +5,7 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The augmented constructor has any initializers. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if the augmented constructor has a super diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03_lib.dart index 11ede4a7ef..e2defcff01 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t03_lib.dart @@ -5,8 +5,7 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// - The augmented constructor has any initializers. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if the augmented constructor has a super diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04.dart index 075424703a..7f705f40cd 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04.dart @@ -5,8 +5,8 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// ... +/// - The augmented constructor has a redirection. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor more than once. diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04_lib.dart index 1e8f05866b..7c2f7cda85 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t04_lib.dart @@ -5,8 +5,8 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// ... +/// - The augmented constructor has a redirection. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor more than once. diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t05_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t05_lib.dart deleted file mode 100644 index 11a3c10c6d..0000000000 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t05_lib.dart +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2024, 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 Redirecting generative constructors -/// ... -/// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. -/// -/// @description Checks that it is a compile-time error if a merged constructor -/// is cyclic. -/// @author sgrekhov22@gmail.com - -// SharedOptions=--enable-experiment=macros - -part of 'augmenting_constructors_A18_t05.dart'; - -augment class C { - augment C(): this(); -// ^ -// [analyzer] unspecified -// [cfe] unspecified - augment C.foo(): this.foo(); -// ^ -// [analyzer] unspecified -// [cfe] unspecified -} diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06.dart index 6a389ff304..92fa98cb5f 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06.dart @@ -5,8 +5,8 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// ... +/// - The augmented constructor has a body. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if an introductory constructor has a body diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06_lib.dart b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06_lib.dart index 07bf95f6b8..8eb2d1c8fe 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_constructors_A18_t06_lib.dart @@ -5,8 +5,8 @@ /// @assertion Redirecting generative constructors /// ... /// It is a compile-time error if: -/// - The augmented constructor has an initializer list or a body, or it has a -/// redirection. +/// ... +/// - The augmented constructor has a body. /// /// @description Checks that it is a compile-time error to declare an augmenting /// redirecting generative constructor if an introductory constructor has a body