-
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
Add augmenting functions signature tests. Part 2
- Loading branch information
Showing
22 changed files
with
1,664 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
LanguageFeatures/Augmentation-libraries/augmenting_functions_A04_t11.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,55 @@ | ||
// 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 signature of the function augmentation does not exactly match the | ||
/// original function. This means the return types must be the same; there | ||
/// must be the same number of positional, optional, and named parameters; the | ||
/// types of corresponding positional and optional parameters must be the | ||
/// same; the names and types of named parameters must be the same; any type | ||
/// parameters and bounds must be the same; and any required or covariant | ||
/// modifiers must match. | ||
/// | ||
/// @description Checks that it is a compile-time error if number of type | ||
/// parameters of an augmentation doesn't exactly match the original function | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55478 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_functions_A04_t11_lib.dart'; | ||
|
||
void topLevelFunction<T>() {} | ||
|
||
class C { | ||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
mixin M { | ||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
enum E { | ||
e1; | ||
|
||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
class A {} | ||
|
||
extension Ext on A { | ||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
main() { | ||
print(topLevelFunction); | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
} |
121 changes: 121 additions & 0 deletions
121
LanguageFeatures/Augmentation-libraries/augmenting_functions_A04_t11_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,121 @@ | ||
// 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 signature of the function augmentation does not exactly match the | ||
/// original function. This means the return types must be the same; there | ||
/// must be the same number of positional, optional, and named parameters; the | ||
/// types of corresponding positional and optional parameters must be the | ||
/// same; the names and types of named parameters must be the same; any type | ||
/// parameters and bounds must be the same; and any required or covariant | ||
/// modifiers must match. | ||
/// | ||
/// @description Checks that it is a compile-time error if number of type | ||
/// parameters of an augmentation doesn't exactly match the original function | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55478 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
augment library 'augmenting_functions_A04_t11.dart'; | ||
|
||
augment void topLevelFunction() {} | ||
// ^^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void topLevelFunction<T, X>() {} | ||
// ^^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C { | ||
augment static void staticMethod() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment static void staticMethod<T, X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<T, X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment mixin M { | ||
augment static void staticMethod() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment static void staticMethod<T, X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<T, X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment enum E { | ||
augment e1; | ||
|
||
augment static void staticMethod() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment static void staticMethod<T, X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<T, X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension Ext { | ||
augment static void staticMethod() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment static void staticMethod<T, X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<T, X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} |
55 changes: 55 additions & 0 deletions
55
LanguageFeatures/Augmentation-libraries/augmenting_functions_A04_t12.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,55 @@ | ||
// 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 signature of the function augmentation does not exactly match the | ||
/// original function. This means the return types must be the same; there | ||
/// must be the same number of positional, optional, and named parameters; the | ||
/// types of corresponding positional and optional parameters must be the | ||
/// same; the names and types of named parameters must be the same; any type | ||
/// parameters and bounds must be the same; and any required or covariant | ||
/// modifiers must match. | ||
/// | ||
/// @description Checks that it is a compile-time error if names of type | ||
/// parameters of an augmentation doesn't exactly match the original function | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55478 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_functions_A04_t12_lib.dart'; | ||
|
||
void topLevelFunction<T>() {} | ||
|
||
class C { | ||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
mixin M { | ||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
enum E { | ||
e1; | ||
|
||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
class A {} | ||
|
||
extension Ext on A { | ||
static void staticMethod<T>() {} | ||
void instanceMethod<T>() {} | ||
} | ||
|
||
main() { | ||
print(topLevelFunction); | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
} |
76 changes: 76 additions & 0 deletions
76
LanguageFeatures/Augmentation-libraries/augmenting_functions_A04_t12_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,76 @@ | ||
// 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 signature of the function augmentation does not exactly match the | ||
/// original function. This means the return types must be the same; there | ||
/// must be the same number of positional, optional, and named parameters; the | ||
/// types of corresponding positional and optional parameters must be the | ||
/// same; the names and types of named parameters must be the same; any type | ||
/// parameters and bounds must be the same; and any required or covariant | ||
/// modifiers must match. | ||
/// | ||
/// @description Checks that it is a compile-time error if names of type | ||
/// parameters of an augmentation doesn't exactly match the original function | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55478 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
augment library 'augmenting_functions_A04_t12.dart'; | ||
|
||
augment void topLevelFunction<X>() {} | ||
// ^^^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment class C { | ||
augment static void staticMethod<X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment mixin M { | ||
augment static void staticMethod<X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment enum E { | ||
augment e1; | ||
|
||
augment static void staticMethod<X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} | ||
|
||
augment extension Ext { | ||
augment static void staticMethod<X>() {} | ||
// ^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
augment void instanceMethod<X>() {} | ||
// ^^^^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
} |
55 changes: 55 additions & 0 deletions
55
LanguageFeatures/Augmentation-libraries/augmenting_functions_A04_t13.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,55 @@ | ||
// 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 signature of the function augmentation does not exactly match the | ||
/// original function. This means the return types must be the same; there | ||
/// must be the same number of positional, optional, and named parameters; the | ||
/// types of corresponding positional and optional parameters must be the | ||
/// same; the names and types of named parameters must be the same; any type | ||
/// parameters and bounds must be the same; and any required or covariant | ||
/// modifiers must match. | ||
/// | ||
/// @description Checks that it is a compile-time error if bounds of type | ||
/// parameters of an augmentation doesn't exactly match the original function | ||
/// @author sgrekhov22@gmail.com | ||
/// @issue 55478 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
import augment 'augmenting_functions_A04_t13_lib.dart'; | ||
|
||
void topLevelFunction<T extends num>() {} | ||
|
||
class C { | ||
static void staticMethod<T extends num>() {} | ||
void instanceMethod<T extends num>() {} | ||
} | ||
|
||
mixin M { | ||
static void staticMethod<T extends num>() {} | ||
void instanceMethod<T extends num>() {} | ||
} | ||
|
||
enum E { | ||
e1; | ||
|
||
static void staticMethod<T extends num>() {} | ||
void instanceMethod<T extends num>() {} | ||
} | ||
|
||
class A {} | ||
|
||
extension Ext on A { | ||
static void staticMethod<T extends num>() {} | ||
void instanceMethod<T extends num>() {} | ||
} | ||
|
||
main() { | ||
print(topLevelFunction); | ||
print(C); | ||
print(M); | ||
print(E); | ||
print(A); | ||
} |
Oops, something went wrong.