diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01.dart b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01.dart new file mode 100644 index 0000000000..e37713a194 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion It is a compile-time error if: +/// +/// - The augmenting type and corresponding type are not the same kind: class, +/// mixin, enum, or extension. You can't augment a class with a mixin, etc. +/// +/// @description Checks that it is a compile-time error if an augmenting type +/// and the corresponding type are not the same kind +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmenting_types_A01_t01_lib1.dart'; +import augment 'augmenting_types_A01_t01_lib2.dart'; + +class C {} + +mixin M {} + +enum E {e1;} + +main() { + print(C); + print(M); + print(E); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01_lib1.dart b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01_lib1.dart new file mode 100644 index 0000000000..9b74223304 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01_lib1.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion It is a compile-time error if: +/// +/// - The augmenting type and corresponding type are not the same kind: class, +/// mixin, enum, or extension. You can't augment a class with a mixin, etc. +/// +/// @description Checks that it is a compile-time error if an augmenting type +/// and the corresponding type are not the same kind +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'augmenting_types_A01_t01.dart'; + +augment mixin C {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified + +augment class M {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified + +augment class E {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01_lib2.dart b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01_lib2.dart new file mode 100644 index 0000000000..5001af7a97 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t01_lib2.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion It is a compile-time error if: +/// +/// - The augmenting type and corresponding type are not the same kind: class, +/// mixin, enum, or extension. You can't augment a class with a mixin, etc. +/// +/// @description Checks that it is a compile-time error if an augmenting type +/// and the corresponding type are not the same kind +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'augmenting_types_A01_t01.dart'; + +augment enum C {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified + +augment enum M {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified + +augment mixin E {} +// ^ +// [analyzer] unspecified +// [cfe] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02.dart b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02.dart new file mode 100644 index 0000000000..af43d2bed8 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02.dart @@ -0,0 +1,33 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion It is a compile-time error if: +/// +/// - The augmenting type and corresponding type are not the same kind: class, +/// mixin, enum, or extension. You can't augment a class with a mixin, etc. +/// +/// @description Checks that it is a compile-time error if an augmenting type +/// and the corresponding type are not the same kind. Test type aliases +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +import augment 'augmenting_types_A01_t02_lib1.dart'; +import augment 'augmenting_types_A01_t02_lib2.dart'; + +class C {} + +mixin M {} + +enum E {e1;} + +typedef CAlias = C; +typedef MAlias = M; +typedef EAlias = E; + +main() { + print(CAlias); + print(MAlias); + print(EAlias); +} diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02_lib1.dart b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02_lib1.dart new file mode 100644 index 0000000000..1ac9362b3f --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02_lib1.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion It is a compile-time error if: +/// +/// - The augmenting type and corresponding type are not the same kind: class, +/// mixin, enum, or extension. You can't augment a class with a mixin, etc. +/// +/// @description Checks that it is a compile-time error if an augmenting type +/// and the corresponding type are not the same kind. Test type aliases +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'augmenting_types_A01_t02.dart'; + +augment mixin CAlias {} +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +augment class MAlias {} +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +augment class EAlias {} +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02_lib2.dart b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02_lib2.dart new file mode 100644 index 0000000000..bbf8c6e01d --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_types_A01_t02_lib2.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// @assertion It is a compile-time error if: +/// +/// - The augmenting type and corresponding type are not the same kind: class, +/// mixin, enum, or extension. You can't augment a class with a mixin, etc. +/// +/// @description Checks that it is a compile-time error if an augmenting type +/// and the corresponding type are not the same kind. Test type aliases +/// @author sgrekhov22@gmail.com + +// SharedOptions=--enable-experiment=macros + +library augment 'augmenting_types_A01_t02.dart'; + +augment enum CAlias {} +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +augment enum MAlias {} +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified + +augment mixin EAlias {} +// ^^^^^^ +// [analyzer] unspecified +// [cfe] unspecified