diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10.dart index b3ebc7df73..c09a25b349 100644 --- a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10.dart +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10.dart @@ -17,6 +17,8 @@ import augment 'augmented_expression_A01_t10_lib.dart'; +String get topLevelGetter => "Original"; + class C { static String get staticGetter => "Original"; String get instanceGetter => "Original"; diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10_lib.dart index 4aceb28805..f7aed468d0 100644 --- a/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10_lib.dart +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A01_t10_lib.dart @@ -15,7 +15,7 @@ // SharedOptions=--enable-experiment=macros -augment library 'augmented_expression_A01_t04.dart'; +augment library 'augmented_expression_A01_t10.dart'; augment String get topLevelGetter { var augmented = "x"; diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01.dart new file mode 100644 index 0000000000..082fea1a39 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01.dart @@ -0,0 +1,60 @@ +// 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 tear-off `augmented` +/// expression inside of an augmenting function +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t01_lib1.dart'; +import augment 'augmented_expression_A04_t01_lib2.dart'; + +const augmented = "Augmented constant, should not be used"; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} + final augmented = "C.augmented, should not be used"; +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} + final augmented = "M.augmented, should not be used"; +} + +enum E { + e1; + + static void staticMethod() {} + void instanceMethod() {} + final augmented = "E.augmented, should not be used"; +} + +class A {} + +extension Ext on A { + static void staticMethod() {} + void instanceMethod() {} + final augmented = "Ext.augmented, should not be used"; +} + +main() { + print(topLevelFunction); + print(C); + print(M); + print(E); + print(A); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01_lib1.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01_lib1.dart new file mode 100644 index 0000000000..9dfbc0ede4 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01_lib1.dart @@ -0,0 +1,88 @@ +// 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 tear-off `augmented` +/// expression inside of an augmenting function +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t01.dart'; + +augment void topLevelFunction() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var f = augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01_lib2.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01_lib2.dart new file mode 100644 index 0000000000..108be7605b --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t01_lib2.dart @@ -0,0 +1,106 @@ +// 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 tear-off `augmented` +/// expression inside of an augmenting function +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t01.dart'; + +augment void topLevelFunction() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; +} + +augment class C { + augment static void staticMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } + augment void instanceMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } +} + +augment mixin M { + augment static void staticMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } + augment void instanceMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } + augment void instanceMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } +} + +augment extension Ext { + augment static void staticMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } + augment void instanceMethod() { + var f = () { + augmented.toString(); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + }; + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t02.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t02.dart new file mode 100644 index 0000000000..568b930484 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t02.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 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 declare a local +/// variable named `augmented` inside of an augmenting function +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t02_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t02_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t02_lib.dart new file mode 100644 index 0000000000..52bb98e59f --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t02_lib.dart @@ -0,0 +1,88 @@ +// 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 declare a local +/// variable named `augmented` inside of an augmenting function +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t02.dart'; + +augment void topLevelFunction() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + var augmented; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t03.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t03.dart new file mode 100644 index 0000000000..6f9d5ef75e --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t03.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 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 declare a local +/// function named `augmented` inside of an augmenting function +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t02_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t03_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t03_lib.dart new file mode 100644 index 0000000000..3893c97002 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t03_lib.dart @@ -0,0 +1,88 @@ +// 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 declare a local +/// variable named `augmented` inside of an augmenting function +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t03.dart'; + +augment void topLevelFunction() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + int augmented() => 42; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t04.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t04.dart new file mode 100644 index 0000000000..ee5c0ef5c9 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t04.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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a +/// variable pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t04_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t04_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t04_lib.dart new file mode 100644 index 0000000000..5362a68c91 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t04_lib.dart @@ -0,0 +1,107 @@ +// 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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a +/// variable pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t04.dart'; + +augment void topLevelFunction() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment class C { + augment static void staticMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +} + +augment mixin M { + augment static void staticMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +} + +augment extension Ext { + augment static void staticMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch((1,)) { + case (var augmented,): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t05.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t05.dart new file mode 100644 index 0000000000..591f72b5b0 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t05.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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a +/// parenthesized pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t05_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t05_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t05_lib.dart new file mode 100644 index 0000000000..9c2401c43a --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t05_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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a +/// parenthesized pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t05.dart'; + +augment void topLevelFunction() { + var (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + var (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + var (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + var (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + var (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented) = (42); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t06.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t06.dart new file mode 100644 index 0000000000..aef460bcf3 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t06.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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a list +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t06_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t06_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t06_lib.dart new file mode 100644 index 0000000000..efe13eb26f --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t06_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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a list +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t06.dart'; + +augment void topLevelFunction() { + var [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + var [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + var [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + var [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + var [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final [augmented] = [42]; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t07.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t07.dart new file mode 100644 index 0000000000..2efcce46ef --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t07.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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a map +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t07_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t07_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t07_lib.dart new file mode 100644 index 0000000000..51b299fae7 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t07_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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a map +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t07.dart'; + +augment void topLevelFunction() { + var {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + var {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + var {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + var {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + var {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final {"key": augmented} = {"key": 42}; +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t08.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t08.dart new file mode 100644 index 0000000000..127d636f27 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t08.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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a record +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t08_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t08_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t08_lib.dart new file mode 100644 index 0000000000..002d0eb471 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t08_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 declare a local +/// variable named `augmented` inside of an augmenting function. Test a record +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t08.dart'; + +augment void topLevelFunction() { + var (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified +} + +augment class C { + augment static void staticMethod() { + var (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment mixin M { + augment static void staticMethod() { + var (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + var (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment extension Ext { + augment static void staticMethod() { + var (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + augment void instanceMethod() { + final (augmented,) = (42,); +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} diff --git a/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t09.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t09.dart new file mode 100644 index 0000000000..77a7447aaa --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t09.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 declare a local +/// variable named `augmented` inside of an augmenting function. Test an object +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmented_expression_A04_t09_lib.dart'; + +void topLevelFunction() {} + +class C { + static void staticMethod() {} + void instanceMethod() {} +} + +mixin M { + static void staticMethod() {} + void instanceMethod() {} +} + +enum E { + 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_t09_lib.dart b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t09_lib.dart new file mode 100644 index 0000000000..f0eed6f8be --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmented_expression_A04_t09_lib.dart @@ -0,0 +1,107 @@ +// 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 declare a local +/// variable named `augmented` inside of an augmenting function. Test an object +/// pattern. +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +augment library 'augmented_expression_A04_t09.dart'; + +augment void topLevelFunction() { + switch(1) { + case int(isEven: var augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } +} + +augment class C { + augment static void staticMethod() { + switch(1) { + case int(isEven: var augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch(1) { + case int(isEven: final augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +} + +augment mixin M { + augment static void staticMethod() { + switch(1) { + case int(isEven: var augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch(1) { + case int(isEven: final augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +} + +augment enum E { + augment e1; + + augment static void staticMethod() { + switch(1) { + case int(isEven: var augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch(1) { + case int(isEven: final augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +} + +augment extension Ext { + augment static void staticMethod() { + switch(1) { + case int(isEven: var augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } + augment void instanceMethod() { + switch(1) { + case int(isEven: final augmented): +// ^^^^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + } + } +}