-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t01.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,23 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares wrong number of type parameters | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_types_A05_t01_lib.dart'; | ||
|
||
class C<T> {} | ||
|
||
main() { | ||
print(C); | ||
} |
27 changes: 27 additions & 0 deletions
27
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t01_lib.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,27 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares wrong number of type parameters | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'augmenting_types_A05_t01.dart'; | ||
|
||
augment class C {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C<T, X> {} | ||
// ^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
25 changes: 25 additions & 0 deletions
25
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t02.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,25 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares type parameters with different bounds | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_types_A05_t02_lib.dart'; | ||
|
||
class A {} | ||
class B extends A {} | ||
class C<T extends A> {} | ||
|
||
main() { | ||
print(C); | ||
} |
32 changes: 32 additions & 0 deletions
32
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t02_lib.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,32 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares type parameters with different bounds | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'augmenting_types_A05_t02.dart'; | ||
|
||
augment class C<T extends B> {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C<T extends Object> {} | ||
// ^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C<T extends List> {} | ||
// ^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
24 changes: 24 additions & 0 deletions
24
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t03.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,24 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares type parameters with different names | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_types_A05_t03_lib.dart'; | ||
|
||
class A {} | ||
class C<X extends A, Y> {} | ||
|
||
main() { | ||
print(C); | ||
} |
32 changes: 32 additions & 0 deletions
32
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t03_lib.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,32 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is a compile-time error if an augmenting type | ||
/// declares type parameters with different names | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'augmenting_types_A05_t03.dart'; | ||
|
||
augment class C<X extends A, Z> {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C<T extends A, Y> {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C<Y extends A, X> {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified |
36 changes: 36 additions & 0 deletions
36
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t04.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,36 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is not an error if an augmenting type | ||
/// declares the same number of type parameters with the same names and bounds | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import '../../Utils/expect.dart'; | ||
import augment 'augmenting_types_A05_t04_lib.dart'; | ||
|
||
class A {} | ||
typedef AAlias = A; | ||
class B extends A {} | ||
|
||
class C1<T extends A> {} | ||
class C2<T extends AAlias> {} | ||
|
||
main() { | ||
Expect.equals("C1<B>", C1<B>().name1); | ||
Expect.equals("C1<B>", C1<B>().name2()); | ||
Expect.equals("C1<A>", C1<AAlias>().name1); | ||
Expect.equals("C1<A>", C1<AAlias>().name2()); | ||
Expect.equals("C2<B>", C2<B>().name1); | ||
Expect.equals("C2<B>", C2<B>().name2()); | ||
Expect.equals("C2<A>", C2<AAlias>().name1); | ||
Expect.equals("C2<A>", C2<AAlias>().name2()); | ||
} |
30 changes: 30 additions & 0 deletions
30
LanguageFeatures/Augmentation-libraries/augmenting_types_A05_t04_lib.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,30 @@ | ||
// 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 type parameters of the type augmentation do not match the original | ||
/// type's type parameters. This means there must be the same number of type | ||
/// parameters with the same bounds and names. | ||
/// | ||
/// @description Checks that it is not an error if an augmenting type | ||
/// declares the same number of type parameters with the same names and bounds | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library augment 'augmenting_types_A05_t04.dart'; | ||
|
||
augment class C1<T extends A> { | ||
String get name1 => 'C1<$T>'; | ||
} | ||
augment class C1<T extends AAlias> { | ||
String name2() => 'C1<$T>'; | ||
} | ||
augment class C2<T extends A> { | ||
String get name1 => 'C2<$T>'; | ||
} | ||
augment class C2<T extends AAlias> { | ||
String name2() => 'C2<$T>'; | ||
} |