Skip to content

Commit

Permalink
dart-lang#2559. Add augmenting types tests. Part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Mar 13, 2024
1 parent 5c18c22 commit 67d9d73
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 67d9d73

Please sign in to comment.