Skip to content

#3182. Update augmenting_declarations_A01/02_*.dart tests #3195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +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 An augmentation declaration D is a declaration marked with the
/// new built-in identifier `augment`, which makes D augment a declaration D1
/// with the same name and in the same context as D. D1 is determined as being
/// before D and after every other declaration with the same name and in the
/// same context which is before D (that is, D1 is the greatest declaration
/// which is smaller than D, according to the 'after' ordering). A compile-time
/// error occurs if no declaration satisfies the requirements on D1.
/// @assertion It's a compile-time error if there is no matching declaration I.
/// In other words, it's an error to have a declaration marked augment with no
/// declaration to apply it to.
///
/// @description Checks that it is a compile-time error if a library contains an
/// augmentation declaration, but no non-augmentation declaration with the
/// augmenting declaration, but there is no introductory declaration with the
/// corresponding name in the same scope.
/// @author [email protected]

// SharedOptions=--enable-experiment=macros
// SharedOptions=--enable-experiment=augmentations

augment class C {}
// ^
Expand All @@ -42,21 +38,9 @@ augment extension type ET {}
// [analyzer] unspecified
// [cfe] unspecified

augment typedef StringAlias = String;
// ^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment typedef void Foo();
// ^^^
// [analyzer] unspecified
// [cfe] unspecified

main() {
print(C);
print(M);
print(E);
print(ET);
print(StringAlias);
print(Foo);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +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 An augmentation declaration D is a declaration marked with the
/// new built-in identifier `augment`, which makes D augment a declaration D1
/// with the same name and in the same context as D. D1 is determined as being
/// before D and after every other declaration with the same name and in the
/// same context which is before D (that is, D1 is the greatest declaration
/// which is smaller than D, according to the 'after' ordering). A compile-time
/// error occurs if no declaration satisfies the requirements on D1.
/// @assertion It's a compile-time error if there is no matching declaration I.
/// In other words, it's an error to have a declaration marked augment with no
/// declaration to apply it to.
///
/// @description Checks that it is a compile-time error if a library contains an
/// augmentation declaration, but no non-augmentation declaration with the
/// augmenting declaration, but there is no introductory declaration with the
/// corresponding name in the same scope.
/// @author [email protected]

// SharedOptions=--enable-experiment=macros

augment int variable = 0;
// ^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment final finalVariable = 0;
// ^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment late int lateVariable = 0;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment late final lateFinalVariable = 0;
// ^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
// SharedOptions=--enable-experiment=augmentations

augment void function() {}
// ^^^^^^^^
Expand All @@ -53,16 +29,8 @@ augment void set setter(int _) {}
// [cfe] unspecified

main() {
int variable = 0;
final finalVariable = 0;
late int lateVariable = 0;
late final lateFinalVariable = 0;
void function() {}

print(variable);
print(finalVariable);
print(lateVariable);
print(lateFinalVariable);
print(function);
print(getter);
setter = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,20 @@
// 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 An augmentation declaration D is a declaration marked with the
/// new built-in identifier `augment`, which makes D augment a declaration D1
/// with the same name and in the same context as D. D1 is determined as being
/// before D and after every other declaration with the same name and in the
/// same context which is before D (that is, D1 is the greatest declaration
/// which is smaller than D, according to the 'after' ordering). A compile-time
/// error occurs if no declaration satisfies the requirements on D1.
/// @assertion It's a compile-time error if there is no matching declaration I.
/// In other words, it's an error to have a declaration marked augment with no
/// declaration to apply it to.
///
/// @description Checks that it is a compile-time error if a library contains an
/// augmentation declaration, but no non-augmentation declaration with the
/// augmenting declaration, but there is no introductory declaration with the
/// corresponding name in the same scope.
/// @author [email protected]

// SharedOptions=--enable-experiment=macros

int variable = 0;

final finalVariable = 0;

late int lateVariable = 0;

late final lateFinalVariable = 0;
// SharedOptions=--enable-experiment=augmentations

void function() {}

main() {
augment int variable = 0;
// ^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment final finalVariable = 0;
// ^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment late int lateVariable = 0;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment late final lateFinalVariable = 0;
// ^^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

augment void function() {}
// ^^^^^^^^
// [analyzer] unspecified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,122 +2,98 @@
// 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 An augmentation declaration D is a declaration marked with the
/// new built-in identifier `augment`, which makes D augment a declaration D1
/// with the same name and in the same context as D. D1 is determined as being
/// before D and after every other declaration with the same name and in the
/// same context which is before D (that is, D1 is the greatest declaration
/// which is smaller than D, according to the 'after' ordering). A compile-time
/// error occurs if no declaration satisfies the requirements on D1.
/// @assertion It's a compile-time error if there is no matching declaration I.
/// In other words, it's an error to have a declaration marked augment with no
/// declaration to apply it to.
///
/// @description Checks that it is a compile-time error if a library contains an
/// augmentation declaration, but no non-augmentation declaration with the
/// augmenting declaration, but there is no introductory declaration with the
/// corresponding name in the same scope.
/// @author [email protected]

// SharedOptions=--enable-experiment=macros
// SharedOptions=--enable-experiment=augmentations

class C {
augment static int staticVariable = 0;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void staticMethod() {}
abstract class C {
augment static void staticMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static int get staticGetter => 0;
augment static int get staticGetter;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void set staticSetter(int _) {}
augment static void set staticSetter(int _);
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment int instanceVariable = 0;
// ^^^^^^^^^^^^^^^^
augment abstract int instanceVariable;
// ^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void instanceMethod() {}
augment void instanceMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment int get instanceGetter => 0;
augment int get instanceGetter;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void set instanceSetter(int _) {}
augment void set instanceSetter(int _);
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

mixin M {
augment static int staticVariable = 0;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void staticMethod() {}
augment static void staticMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static int get staticGetter => 0;
augment static int get staticGetter;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void set staticSetter(int _) {}
augment static void set staticSetter(int _);
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment int instanceVariable = 0;
// ^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void instanceMethod() {}
augment void instanceMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment int get instanceGetter => 0;
augment int get instanceGetter;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void set instanceSetter(int _) {}
augment void set instanceSetter(int _);
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

enum E {
e0;
augment static int staticVariable = 0;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void staticMethod() {}
augment static void staticMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static int get staticGetter => 0;
augment static int get staticGetter;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void set staticSetter(int _) {}
augment static void set staticSetter(int _);
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment final int instanceVariable = 0;
// ^^^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void instanceMethod() {}
augment void instanceMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment int get instanceGetter => 0;
augment int get instanceGetter;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void set instanceSetter(int _) {}
augment void set instanceSetter(int _);
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
Expand All @@ -126,62 +102,54 @@ enum E {
class A {}

extension Ext on A {
augment static int staticVariable = 0;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void staticMethod() {}
augment static void staticMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static int get staticGetter => 0;
augment static int get staticGetter;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void set staticSetter(int _) {}
augment static void set staticSetter(int _);
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void instanceMethod() {}
augment void instanceMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment int get instanceGetter => 0;
augment int get instanceGetter;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void set instanceSetter(int _) {}
augment void set instanceSetter(int _);
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

extension type ET(int _) {
augment static int staticVariable = 0;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void staticMethod() {}
augment static void staticMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static int get staticGetter => 0;
augment static int get staticGetter;
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment static void set staticSetter(int _) {}
augment static void set staticSetter(int _);
// ^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void instanceMethod() {}
augment void instanceMethod();
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment int get instanceGetter => 0;
augment int get instanceGetter;
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
augment void set instanceSetter(int _) {}
augment void set instanceSetter(int _);
// ^^^^^^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
Expand Down
Loading
Loading