Skip to content

Commit

Permalink
dart-lang#2559. Update augmenting libraries tests according dart-lang…
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov committed Apr 2, 2024
1 parent 8d2cada commit 96bec22
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@ interface class I2 {
String id2 => "I2";
}

interface class I3 extends I1 {
String id2 => "I2";
}

augment class C implements I2 {
String get id2 => "I2 from C";
}

extension type ET(I1 _) implements I0 {
augment extension type ET(I1 _) implements I0 {
String get id0 => "I0 from ET";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import augment 'augmenting_types_A06_t07_lib.dart';

class A {}

class C implements A {}
class C {}
class D implements A, C {}

mixin M on A {}

class MA = C with M;
class MA = D with M;

main() {
A a = MA();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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 A class, enum, extension type, or mixin augmentation may specify
/// extends, implements, on, and with clauses (when generally supported). The
/// types in these clauses are appended to the original declarations clauses of
/// the same kind, and if that clause did not exist previously then it is added
/// with the new types. All regular rules apply after this appending process, so
/// you cannot have multiple extends on a class, or an on clause on an enum, etc
///
/// @description Checks that a mixin augment may specify an `on` clause and it
/// is a compile-time error to create a mixin application that doesn't take into
/// account this augment
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

import augment 'augmenting_types_A06_t09_lib.dart';

class A {}
class C {}
mixin M on A {}

class BadMA1 = A with M;
// ^
// [analyzer] unspecified
// [cfe] unspecified

class BadMA2 = C with M;
// ^
// [analyzer] unspecified
// [cfe] unspecified

main() {
print(BadMA1);
print(BadMA2);
}
Original file line number Diff line number Diff line change
@@ -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 A class, enum, extension type, or mixin augmentation may specify
/// extends, implements, on, and with clauses (when generally supported). The
/// types in these clauses are appended to the original declarations clauses of
/// the same kind, and if that clause did not exist previously then it is added
/// with the new types. All regular rules apply after this appending process, so
/// you cannot have multiple extends on a class, or an on clause on an enum, etc
///
/// @description Checks that a mixin augment may specify an `on` clause and it
/// is a compile-time error to create a mixin application that doesn't take into
/// account this augment
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

augment library 'augmenting_types_A06_t09.dart';

augment mixin M on C {}

0 comments on commit 96bec22

Please sign in to comment.