-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2559. Add more augmented expression tests for class-like declarations (
#3019) Add more augmented expression tests for class-like declarations
- Loading branch information
Showing
6 changed files
with
290 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
LanguageFeatures/Augmentation-libraries/augmented_expression_A10_t24.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// 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 Consider a non-augmenting member declaration Dm that occurs | ||
/// inside an augmenting type declaration Dt. A compile-time error occurs if the | ||
/// identifier `augmented` occurs in Dm. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting | ||
/// class-like declaration has a type parameter named `augmented`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
class C<augmented> {} | ||
|
||
augment class C<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin M<augmented> {} | ||
|
||
augment class M<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum E<augmented> {e0;} | ||
|
||
augment enum E<augmented> {e1;} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
class A {} | ||
|
||
extension Ext<augmented> on A {} | ||
|
||
augment extension Ext<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ET<augmented>(int _) {} | ||
|
||
augment extension type ET<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
print(ET); | ||
} |
61 changes: 61 additions & 0 deletions
61
LanguageFeatures/Augmentation-libraries/augmented_expression_A10_t25.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// 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 Consider a non-augmenting member declaration Dm that occurs | ||
/// inside an augmenting type declaration Dt. A compile-time error occurs if the | ||
/// identifier `augmented` occurs in Dm. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting | ||
/// class-like declaration has a type parameter with a type bound named | ||
/// `augmented`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
class augmented {} | ||
|
||
class C<T extends augmented> {} | ||
|
||
augment class C<T extends augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin M<T extends augmented> {} | ||
|
||
augment class M<T extends augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum E<T extends augmented> {e0;} | ||
|
||
augment enum E<T extends augmented> {e1;} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
class A {} | ||
|
||
extension Ext<T extends augmented> on A {} | ||
|
||
augment extension Ext<T extends augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ET<augmented>(int _) {} | ||
|
||
augment extension type ET<T extends augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
print(ET); | ||
} |
35 changes: 35 additions & 0 deletions
35
LanguageFeatures/Augmentation-libraries/augmented_expression_A10_t26.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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 Consider a non-augmenting member declaration Dm that occurs | ||
/// inside an augmenting type declaration Dt. A compile-time error occurs if the | ||
/// identifier `augmented` occurs in Dm. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting class | ||
/// declaration extends a type that contains the name `augmented`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
class augmented {} | ||
class A<T> {} | ||
|
||
class C1 {} | ||
|
||
augment class C1 extends augmented {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
class C2 {} | ||
|
||
augment class C2 extends A<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(C1); | ||
print(C2); | ||
} |
34 changes: 34 additions & 0 deletions
34
LanguageFeatures/Augmentation-libraries/augmented_expression_A10_t27.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// 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 Consider a non-augmenting member declaration Dm that occurs | ||
/// inside an augmenting type declaration Dt. A compile-time error occurs if the | ||
/// identifier `augmented` occurs in Dm. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting mixin | ||
/// declaration extends a type that contains the name `augmented`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
class augmented {} | ||
class A<T> {} | ||
|
||
mixin M1 {} | ||
|
||
augment mixin M1 on augmented {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin M2 {} | ||
|
||
augment mixin M2 on A<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
main() { | ||
print(M1); | ||
print(M2); | ||
} |
50 changes: 50 additions & 0 deletions
50
LanguageFeatures/Augmentation-libraries/augmented_expression_A10_t28.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// 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 Consider a non-augmenting member declaration Dm that occurs | ||
/// inside an augmenting type declaration Dt. A compile-time error occurs if the | ||
/// identifier `augmented` occurs in Dm. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting | ||
/// class-like declaration implements a type named `augmented`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
interface class augmented {} | ||
class B extends augmented {} | ||
class C {} | ||
|
||
augment class C implements augmented {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin M {} | ||
|
||
augment mixin M implements augmented {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum E {e0;} | ||
|
||
augment enum E implements augmented {e1;} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ET(B _) {} | ||
|
||
augment extension type ET implements augmented {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(ET); | ||
} |
52 changes: 52 additions & 0 deletions
52
LanguageFeatures/Augmentation-libraries/augmented_expression_A10_t29.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// 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 Consider a non-augmenting member declaration Dm that occurs | ||
/// inside an augmenting type declaration Dt. A compile-time error occurs if the | ||
/// identifier `augmented` occurs in Dm. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting | ||
/// class-like declaration implements a type that contains the name `augmented`. | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
interface class augmented {} | ||
class B extends augmented {} | ||
class A<T> {} | ||
|
||
class C {} | ||
|
||
augment class C implements A<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin M {} | ||
|
||
augment mixin M implements A<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum E {e0;} | ||
|
||
augment enum E implements A<augmented> {e1;} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
extension type ET(A<B> _) {} | ||
|
||
augment extension type ET implements A<augmented> {} | ||
// ^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(ET); | ||
} |