diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01.dart new file mode 100644 index 0000000000..4324821b70 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01.dart @@ -0,0 +1,24 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks the merge order of augment libraries +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import '../../Utils/expect.dart'; +import augment 'merge_order_A01_t01_lib1.dart'; +import augment 'merge_order_A01_t01_lib3.dart'; + +class A {} + +main() { + Expect.equals("Augmented A", A().foo()); + Expect.equals("Augmented B", B().foo()); + Expect.equals("Augmented C", C().foo()); + Expect.equals("Augmented D", D().foo()); +} diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib1.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib1.dart new file mode 100644 index 0000000000..043330b9f5 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib1.dart @@ -0,0 +1,20 @@ +// 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 merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks the merge order of augment libraries +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'merge_order_A01_t01.dart'; + +import augment 'merge_order_A01_t01_lib2.dart'; + +augment class A { + String foo() => "Augmented A"; +} +class B {} diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib2.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib2.dart new file mode 100644 index 0000000000..2cf8d1e1ae --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib2.dart @@ -0,0 +1,19 @@ +// 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 merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks the merge order of augment libraries +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'merge_order_A01_t01_lib1.dart'; + +augment class B { + String foo() => "Augmented B"; +} +class C {} +class D {} diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib3.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib3.dart new file mode 100644 index 0000000000..9ca7df9e54 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t01_lib3.dart @@ -0,0 +1,21 @@ +// 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 merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks the merge order of augment libraries +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'merge_order_A01_t01.dart'; + +augment class C { + String foo() => "Augmented C"; +} + +augment class D { + String foo() => "Augmented D"; +} diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02.dart new file mode 100644 index 0000000000..cec1b4d26e --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02.dart @@ -0,0 +1,27 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// declaration appears in a library before the library where the original +/// declaration occurs, according to merge order +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'merge_order_A01_t02_lib1.dart'; +import augment 'merge_order_A01_t02_lib3.dart'; + +augment class A {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified + +main() { + print(A); + print(B); + print(C); +} diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib1.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib1.dart new file mode 100644 index 0000000000..7992b55cd9 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib1.dart @@ -0,0 +1,24 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion The merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// declaration appears in a library before the library where the original +/// declaration occurs, according to merge order +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'merge_order_A01_t02.dart'; + +import augment 'merge_order_A01_t02_lib2.dart'; + +class A { +} +augment class B {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib2.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib2.dart new file mode 100644 index 0000000000..c81721de83 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib2.dart @@ -0,0 +1,22 @@ +// 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 merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// declaration appears in a library before the library where the original +/// declaration occurs, according to merge order +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'merge_order_A01_t02_lib1.dart'; + +class B {} + +augment class C {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib3.dart b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib3.dart new file mode 100644 index 0000000000..acf0fee1a1 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/merge_order_A01_t02_lib3.dart @@ -0,0 +1,17 @@ +// 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 merge order is defined as a depth-first pre-order traversal +/// of the import augment directives starting at the main library. +/// +/// @description Checks that it is a compile-time error if an augmenting +/// declaration appears in a library before the library where the original +/// declaration occurs, according to merge order +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'merge_order_A01_t02.dart'; + +class C {}