diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t21.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t21.dart new file mode 100644 index 0000000000..60932b1b63 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t21.dart @@ -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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// - Augmenting getters: Within an augmenting getter `augmented` invokes the +/// getter and evaluates to the return value. If augmenting a field with a +/// getter, this will invoke the implicit getter from the augmented field. +/// +/// @description Checks that it is a compile-time error to call a function which +/// has a named formal parameter with the name `augmented` in the body of an +/// augmenting getter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A01_t21_lib.dart'; + +int foo({int augmented = 0}) => augmented + 42; + +String get topLevelGetter => "Original"; + +class C { + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +mixin M { + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +enum E { + e1; + + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +class A {} + +extension Ext on A { + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +main() { + print(topLevelGetter); + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t21_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t21_lib.dart new file mode 100644 index 0000000000..3775c1ce5f --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t21_lib.dart @@ -0,0 +1,110 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// - Augmenting getters: Within an augmenting getter `augmented` invokes the +/// getter and evaluates to the return value. If augmenting a field with a +/// getter, this will invoke the implicit getter from the augmented field. +/// +/// @description Checks that it is a compile-time error to call a function which +/// has a named formal parameter with the name `augmented` in the body of an +/// augmenting getter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A01_t21.dart'; + +augment String get topLevelGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; +} + +augment class C { + augment static String get staticGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} + +augment mixin M { + augment static String get staticGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} + +augment enum E1 { + e1; + + augment static String get staticGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} + +augment extension Ext1 { + augment static String get staticGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t22.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t22.dart new file mode 100644 index 0000000000..7bdc49415b --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t22.dart @@ -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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// - Augmenting getters: Within an augmenting getter `augmented` invokes the +/// getter and evaluates to the return value. If augmenting a field with a +/// getter, this will invoke the implicit getter from the augmented field. +/// +/// @description Checks that it is a compile-time error to use a record which +/// has a field with the name `augmented` in a body of an augmenting getter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A01_t22_lib.dart'; + +String get topLevelGetter => "Original"; + +class C { + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +mixin M { + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +enum E { + e1; + + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +class A {} + +extension Ext on A { + static String get staticGetter => "Original"; + String get instanceGetter => "Original"; +} + +main() { + print(topLevelGetter); + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t22_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t22_lib.dart new file mode 100644 index 0000000000..90a8e64725 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t22_lib.dart @@ -0,0 +1,100 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// - Augmenting getters: Within an augmenting getter `augmented` invokes the +/// getter and evaluates to the return value. If augmenting a field with a +/// getter, this will invoke the implicit getter from the augmented field. +/// +/// @description Checks that it is a compile-time error to use a record which +/// has a field with the name `augmented` in a body of an augmenting getter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A01_t22.dart'; + +augment String get topLevelGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; +} + +augment class C { + augment static String get staticGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} + +augment mixin M { + augment static String get staticGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} + +augment enum E1 { + e1; + + augment static String get staticGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} + +augment extension Ext1 { + augment static String get staticGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } + + augment String get instanceGetter { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + return "Augmented"; + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t19_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t19_lib.dart index e3545bae7e..39a0f89e79 100644 --- a/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t19_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t19_lib.dart @@ -53,7 +53,7 @@ augment mixin M2 { } augment enum E1 { - e1; + augment e1; augment static void set augmented(String value) {} // ^^^^^^^^^ // [analyzer] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t20.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t20.dart new file mode 100644 index 0000000000..94a2de2fd4 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t20.dart @@ -0,0 +1,56 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting setters: Within an augmenting setter `augmented` must be +/// followed by an `=` and will directly invoke the augmented setter. If +/// augmenting a field with a setter, this will invoke the implicit setter +/// from the augmented field. +/// +/// @description Checks that it is a compile-time error to call a function which +/// has a named formal parameter with the name `augmented` in the body of an +/// augmenting setter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A02_t20_lib.dart'; + +int foo({int augmented = 0}) => augmented + 42; + +void set topLevelSetter(String _) {} + +class C { + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +mixin M { + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +enum E { + e1; + + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +class A {} + +extension Ext on A { + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +main() { + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t20_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t20_lib.dart new file mode 100644 index 0000000000..c1d44bfa7f --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t20_lib.dart @@ -0,0 +1,103 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting setters: Within an augmenting setter `augmented` must be +/// followed by an `=` and will directly invoke the augmented setter. If +/// augmenting a field with a setter, this will invoke the implicit setter +/// from the augmented field. +/// +/// @description Checks that it is a compile-time error to call a function which +/// has a named formal parameter with the name `augmented` in the body of an +/// augmenting setter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A02_t20.dart'; + +augment void set topLevelSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void set staticSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void set staticSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void set staticSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void set staticSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t21.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t21.dart new file mode 100644 index 0000000000..8d7983ca34 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t21.dart @@ -0,0 +1,53 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting setters: Within an augmenting setter `augmented` must be +/// followed by an `=` and will directly invoke the augmented setter. If +/// augmenting a field with a setter, this will invoke the implicit setter +/// from the augmented field. +/// +/// @description Checks that it is a compile-time error to use a record which +/// has a field with the name `augmented` in a body of an augmenting setter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A02_t21_lib.dart'; + +void set topLevelSetter(String _) {} + +class C { + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +mixin M { + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +enum E { + e1; + + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +class A {} + +extension Ext on A { + static void set staticSetter(String _) {} + void set instanceSetter(String _) {} +} + +main() { + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t21_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t21_lib.dart new file mode 100644 index 0000000000..0cca9bc5c9 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A02_t21_lib.dart @@ -0,0 +1,93 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting setters: Within an augmenting setter `augmented` must be +/// followed by an `=` and will directly invoke the augmented setter. If +/// augmenting a field with a setter, this will invoke the implicit setter +/// from the augmented field. +/// +/// @description Checks that it is a compile-time error to use a record which +/// has a field with the name `augmented` in a body of an augmenting setter. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A02_t21.dart'; + +augment void set topLevelSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void set staticSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void set staticSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void set staticSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void set staticSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + + augment void set instanceSetter(String _) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t24.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t24.dart index 716177b82f..c201b6b165 100644 --- a/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t24.dart +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t24.dart @@ -53,7 +53,6 @@ extension Ext on A { } main() { - print(topLevelVariable); print(C1); print(C2); print(M1); diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t26.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t26.dart new file mode 100644 index 0000000000..ca73fbb78a --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t26.dart @@ -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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting fields: Within an augmenting field, augmented can only be used +/// in an initializer expression, and refers to the original field's +/// initializer expression, which is immediately evaluated. +/// +/// If augmented refers to a variable declaration (as defined by a declaration +/// and a number of prior augmentations) with no initializer expression, and the +/// variable's type is nullable, augmented evaluates to null. If the variable's +/// type is not nullable, then it's a compile-time error. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// variable initializer calls a function with a named parameter whose name is +/// `augmented`. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A03_t26_lib.dart'; + +String foo({int augmented = 0}) => "${augmented + 42}"; + +String topLevelVariable = "Top-level variable"; + +class C { + static String staticVariable = "Static variable of a class"; + String instanceVariable = "Instance variable of a class"; +} + +mixin M { + static String staticVariable = "Static variable of a mixin"; + String instanceVariable = "Instance variable of a mixin"; +} + +enum E { + e1; + static String staticVariable = "Static variable of an enum"; +} + +class A {} + +extension Ext on A { + static String staticVariable = "Static variable of an extension"; +} + +main() { + print(topLevelVariable); + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t26_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t26_lib.dart new file mode 100644 index 0000000000..69b013327d --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t26_lib.dart @@ -0,0 +1,67 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting fields: Within an augmenting field, augmented can only be used +/// in an initializer expression, and refers to the original field's +/// initializer expression, which is immediately evaluated. +/// +/// If augmented refers to a variable declaration (as defined by a declaration +/// and a number of prior augmentations) with no initializer expression, and the +/// variable's type is nullable, augmented evaluates to null. If the variable's +/// type is not nullable, then it's a compile-time error. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// variable initializer calls a function with a named parameter whose name is +/// `augmented`. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A03_t26.dart'; + +augment String topLevelVariable = foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +augment class C { + augment static String staticVariable = foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment String instanceVariable = foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment mixin M { + augment static String staticVariable = foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment String instanceVariable = foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment enum E { + e1; + augment static String staticVariable = foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment extension Ext { + augment static String staticVariable = foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t27.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t27.dart new file mode 100644 index 0000000000..f517d7ac4b --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t27.dart @@ -0,0 +1,57 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting fields: Within an augmenting field, augmented can only be used +/// in an initializer expression, and refers to the original field's +/// initializer expression, which is immediately evaluated. +/// +/// If augmented refers to a variable declaration (as defined by a declaration +/// and a number of prior augmentations) with no initializer expression, and the +/// variable's type is nullable, augmented evaluates to null. If the variable's +/// type is not nullable, then it's a compile-time error. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// field initializer contains a record with a named parameter whose name is +/// `augmented`. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A03_t27_lib.dart'; + +Record topLevelVariable = (); + +class C { + static Record staticVariable =(); + Record instanceVariable = (); +} + +mixin M { + static Record staticVariable =(); + Record instanceVariable = (); +} + +enum E { + e1; + static Record staticVariable =(); + final Record instanceVariable = (); +} + +class A {} + +extension Ext on A { + static Record staticVariable = (); +} + +main() { + print(topLevelVariable); + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t27_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t27_lib.dart new file mode 100644 index 0000000000..9ffb080818 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A03_t27_lib.dart @@ -0,0 +1,71 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting fields: Within an augmenting field, augmented can only be used +/// in an initializer expression, and refers to the original field's +/// initializer expression, which is immediately evaluated. +/// +/// If augmented refers to a variable declaration (as defined by a declaration +/// and a number of prior augmentations) with no initializer expression, and the +/// variable's type is nullable, augmented evaluates to null. If the variable's +/// type is not nullable, then it's a compile-time error. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// field initializer contains a record with a named parameter whose name is +/// `augmented`. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A03_t27.dart'; + +augment Record topLevelVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +augment class C { + augment static Record staticVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment Record instanceVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment mixin M { + augment static Record staticVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment Record instanceVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment enum E { + e1; + augment static Record staticVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment final Record instanceVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment extension Ext { + augment static Record staticVariable = (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t23.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t23.dart new file mode 100644 index 0000000000..6ff5750842 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t23.dart @@ -0,0 +1,56 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting functions: When augmenting a function, `augmented` refers to +/// the augmented function. Tear offs are not allowed, so this function must +/// immediately be invoked. +/// +/// @description Checks that it is a compile-time error to call a function with +/// a named parameter whose name is `augmented` in a body of an augmenting +/// function. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t23_lib.dart'; + +int foo({int augmented = 0}) => augmented + 42; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E2 { + e1; + + static void staticMethod() {} + void instanceMethod() {} +} + +class A {} + +extension Ext on A { + static void staticMethod() {} + void instanceMethod() {} +} + +main() { + print(topLevelFunction); + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t23_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t23_lib.dart new file mode 100644 index 0000000000..be28f4e4aa --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t23_lib.dart @@ -0,0 +1,98 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting functions: When augmenting a function, `augmented` refers to +/// the augmented function. Tear offs are not allowed, so this function must +/// immediately be invoked. +/// +/// @description Checks that it is a compile-time error to call a function with +/// a named parameter whose name is `augmented` in a body of an augmenting +/// function. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t23.dart'; + +augment void topLevelFunction() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + e1; + + augment static void staticMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + foo(); // Ok + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t24.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t24.dart new file mode 100644 index 0000000000..e983d64360 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t24.dart @@ -0,0 +1,54 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting functions: When augmenting a function, `augmented` refers to +/// the augmented function. Tear offs are not allowed, so this function must +/// immediately be invoked. +/// +/// @description Checks that it is a compile-time error to use a record with +/// a named parameter whose name is `augmented` in a body of an augmenting +/// function. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t24_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E2 { + e1; + + static void staticMethod() {} + void instanceMethod() {} +} + +class A {} + +extension Ext on A { + static void staticMethod() {} + void instanceMethod() {} +} + +main() { + print(topLevelFunction); + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t24_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t24_lib.dart new file mode 100644 index 0000000000..6bd3632aba --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t24_lib.dart @@ -0,0 +1,89 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting functions: When augmenting a function, `augmented` refers to +/// the augmented function. Tear offs are not allowed, so this function must +/// immediately be invoked. +/// +/// @description Checks that it is a compile-time error to use a record with +/// a named parameter whose name is `augmented` in a body of an augmenting +/// function. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t24.dart'; + +augment void topLevelFunction() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + e1; + + augment static void staticMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t15_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t15_lib.dart index 71681e039e..82467e8ee7 100644 --- a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t15_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t15_lib.dart @@ -50,8 +50,8 @@ augment mixin M { // [cfe] unspecified } -enum E { - e1; +augment enum E { + augment e1; augment String operator +(Object augmented) => "E +"; // ^^^^^^^^^ // [analyzer] unspecified @@ -66,7 +66,7 @@ enum E { // [cfe] unspecified } -extension Ext on A { +augment extension Ext { augment String operator +(Object augmented) => "Ext +"; // ^^^^^^^^^ // [analyzer] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t16_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t16_lib.dart index 07215a1c70..acf871d523 100644 --- a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t16_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t16_lib.dart @@ -50,8 +50,8 @@ augment mixin M { // [cfe] unspecified } -enum E { - e1; +augment enum E { + augment e1; augment String operator +(augmented other) => "E +"; // ^^^^^^^^^ // [analyzer] unspecified @@ -66,7 +66,7 @@ enum E { // [cfe] unspecified } -extension Ext on A { +augment extension Ext { augment String operator +(augmented other) => "Ext +"; // ^^^^^^^^^ // [analyzer] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t17_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t17_lib.dart index 08096cad1b..ddeea5ed23 100644 --- a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t17_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t17_lib.dart @@ -42,8 +42,8 @@ augment mixin M { // [cfe] unspecified } -enum E { - e1; +augment enum E { + augment e1; augment augmented? operator +(Object? other) => null; // ^^^^^^^^^ // [analyzer] unspecified @@ -54,7 +54,7 @@ enum E { // [cfe] unspecified } -extension Ext on A { +augment extension Ext { augment augmented? operator +(Object? other) => null; // ^^^^^^^^^ // [analyzer] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t18.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t18.dart new file mode 100644 index 0000000000..f5f3f4fe83 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t18.dart @@ -0,0 +1,59 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting operators: When augmenting an operator, `augmented` must be +/// followed by the operator. For example when augmenting `+` you must do +/// `augmented + 1`, and when augmenting `[]` you must do `augmented[]`. +/// These constructs invoke the augmented operator, and are the only valid +/// uses of `augmented` in these contexts. +/// +/// @description Checks that it is a compile-time error to call a function which +/// has a named formal parameter with the name `augmented` in an augmenting +/// operator body. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A05_t18_lib.dart'; + +int foo({int augmented = 0}) => augmented + 42; + +class C { + int operator +(Object? other) => 0; + int operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +mixin M { + int operator +(Object? other) => 0; + int operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +enum E { + e1; + int operator +(Object? other) => 0; + int operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +class A { +} + +extension Ext on A { + int operator +(Object? other) => 0; + int operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +main() { + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t18_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t18_lib.dart new file mode 100644 index 0000000000..2be03beb0c --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t18_lib.dart @@ -0,0 +1,91 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting operators: When augmenting an operator, `augmented` must be +/// followed by the operator. For example when augmenting `+` you must do +/// `augmented + 1`, and when augmenting `[]` you must do `augmented[]`. +/// These constructs invoke the augmented operator, and are the only valid +/// uses of `augmented` in these contexts. +/// +/// @description Checks that it is a compile-time error to call a function which +/// has a named formal parameter with the name `augmented` in an augmenting +/// operator body. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A05_t18.dart'; + +augment class C { + augment int operator +(Object? other) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment int operator [](int index) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment int operator +(Object? other) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment int operator [](int index) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + augment int operator +(Object? other) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment int operator [](int index) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment int operator +(Object? other) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment int operator [](int index) => foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + foo(augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t19.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t19.dart new file mode 100644 index 0000000000..e09c114840 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t19.dart @@ -0,0 +1,57 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting operators: When augmenting an operator, `augmented` must be +/// followed by the operator. For example when augmenting `+` you must do +/// `augmented + 1`, and when augmenting `[]` you must do `augmented[]`. +/// These constructs invoke the augmented operator, and are the only valid +/// uses of `augmented` in these contexts. +/// +/// @description Checks that it is a compile-time error to use a record which +/// has a named formal parameter with the name `augmented` in an augmenting +/// operator body. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A05_t19_lib.dart'; + +class C { + Record operator +(Object? other) => 0; + Record operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +mixin M { + Record operator +(Object? other) => 0; + Record operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +enum E { + e1; + Record operator +(Object? other) => 0; + Record operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +class A { +} + +extension Ext on A { + Record operator +(Object? other) => 0; + Record operator [](int index) => 0; + void operator []=(int index, int value) {} +} + +main() { + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t19_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t19_lib.dart new file mode 100644 index 0000000000..235a3a2f21 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A05_t19_lib.dart @@ -0,0 +1,91 @@ +// 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 The exact result of an `augmented` expression depends on what is +/// being augmented, but it generally follows the same rules as any normal +/// identifier: +/// ... +/// - Augmenting operators: When augmenting an operator, `augmented` must be +/// followed by the operator. For example when augmenting `+` you must do +/// `augmented + 1`, and when augmenting `[]` you must do `augmented[]`. +/// These constructs invoke the augmented operator, and are the only valid +/// uses of `augmented` in these contexts. +/// +/// @description Checks that it is a compile-time error to use a record which +/// has a named formal parameter with the name `augmented` in an augmenting +/// operator body. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A05_t19.dart'; + +augment class C { + augment Record operator +(Object? other) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment Record operator [](int index) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment Record operator +(Object? other) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment Record operator [](int index) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + augment Record operator +(Object? other) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment Record operator [](int index) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment Record operator +(Object? other) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment Record operator [](int index) => (augmented: 1); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + augment void operator []=(int index, int value) { + print((augmented: 1)); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +}