-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add more basic and mixin restrictions tests.
- Loading branch information
Showing
21 changed files
with
3,451 additions
and
2 deletions.
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
LanguageFeatures/Class-modifiers/basic_restrictions_A05_t01.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright (c) 2023, 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 An enum declaration still cannot be implemented, extended or | ||
/// mixed in anywhere, independently of modifiers. | ||
/// | ||
/// @description Check that it is a compile-time error if an enum declaration is | ||
/// extended or used in mixin's `on` part | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=class-modifiers | ||
|
||
enum E {e1, e2} | ||
|
||
class ExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base class BaseExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
interface class InterfaceExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
final class FinalExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
sealed class SealedExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract class AbstractExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base class AbstractBaseExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
|
||
abstract interface class AbstractInterfaceExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract final class AbstractFinalExtendsEnum extends E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin MixinOnEnum on E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin BaseMixinOnEnum on E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(ExtendsEnum); | ||
print(BaseExtendsEnum); | ||
print(InterfaceExtendsEnum); | ||
print(FinalExtendsEnum); | ||
print(SealedExtendsEnum); | ||
print(AbstractExtendsEnum); | ||
print(AbstractBaseExtendsEnum); | ||
print(AbstractInterfaceExtendsEnum); | ||
print(AbstractFinalExtendsEnum); | ||
print(MixinOnEnum); | ||
print(BaseMixinOnEnum); | ||
} |
108 changes: 108 additions & 0 deletions
108
LanguageFeatures/Class-modifiers/basic_restrictions_A05_t02.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
// Copyright (c) 2023, 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 An enum declaration still cannot be implemented, extended or | ||
/// mixed in anywhere, independently of modifiers. | ||
/// | ||
/// @description Check that it is a compile-time error if an enum declaration is | ||
/// implemented | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=class-modifiers | ||
|
||
enum E {e1, e2} | ||
|
||
class ImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base class BaseImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
interface class InterfaceImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
final class FinalImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
sealed class SealedImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract class AbstractImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base class AbstractBaseImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
|
||
abstract interface class AbstractInterfaceImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract final class AbstractFinalImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin class MixinClassImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin class BaseMixinClassImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract mixin class AbstractMixinClassImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base mixin class AbstractBaseMixinClassImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin MixinImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin BaseMixinImplementsEnum implements E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(ImplementsEnum); | ||
print(BaseImplementsEnum); | ||
print(InterfaceImplementsEnum); | ||
print(FinalImplementsEnum); | ||
print(SealedImplementsEnum); | ||
print(AbstractImplementsEnum); | ||
print(AbstractBaseImplementsEnum); | ||
print(AbstractInterfaceImplementsEnum); | ||
print(AbstractFinalImplementsEnum); | ||
print(MixinClassImplementsEnum); | ||
print(BaseMixinClassImplementsEnum); | ||
print(AbstractMixinClassImplementsEnum); | ||
print(AbstractBaseMixinClassImplementsEnum); | ||
print(MixinImplementsEnum); | ||
print(BaseMixinImplementsEnum); | ||
} |
96 changes: 96 additions & 0 deletions
96
LanguageFeatures/Class-modifiers/basic_restrictions_A05_t03.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright (c) 2023, 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 An enum declaration still cannot be implemented, extended or | ||
/// mixed in anywhere, independently of modifiers. | ||
/// | ||
/// @description Check that it is a compile-time error if an enum declaration is | ||
/// mixed in | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=class-modifiers | ||
|
||
enum E {e1, e2} | ||
|
||
class WithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base class BaseWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
interface class InterfaceWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
final class FinalWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
sealed class SealedWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract class AbstractWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base class AbstractBaseWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
|
||
abstract interface class AbstractInterfaceWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract final class AbstractFinalWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin class MixinClassWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin class BaseMixinClassWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract mixin class AbstractMixinClassWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base mixin class AbstractBaseMixinClassWithEnum with E {} | ||
// ^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(WithEnum); | ||
print(BaseWithEnum); | ||
print(InterfaceWithEnum); | ||
print(FinalWithEnum); | ||
print(SealedWithEnum); | ||
print(AbstractWithEnum); | ||
print(AbstractBaseWithEnum); | ||
print(AbstractInterfaceWithEnum); | ||
print(AbstractFinalWithEnum); | ||
print(MixinClassWithEnum); | ||
print(BaseMixinClassWithEnum); | ||
print(AbstractMixinClassWithEnum); | ||
print(AbstractBaseMixinClassWithEnum); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
LanguageFeatures/Class-modifiers/class_modifiers_pre_feature_lib.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2023, 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. | ||
|
||
/// @description Library containing pre-feature classes for testing class | ||
/// modifiers | ||
/// @author [email protected] | ||
// @dart=2.19 | ||
|
||
library class_modifiers_pre_feature_lib; | ||
|
||
class Class {} | ||
abstract class AbstractClass {} | ||
mixin Mixin {} | ||
|
||
typedef TypedefClass = Class; | ||
typedef TypedefAbstractClass = AbstractClass; | ||
typedef TypedefMixin = Mixin; |
66 changes: 66 additions & 0 deletions
66
LanguageFeatures/Class-modifiers/mixin_restrictions_A01_t01.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) 2023, 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's a compile-time error if a mixin class declaration: | ||
/// ... | ||
/// - has an extends clause | ||
/// | ||
/// @description Check that it is a compile-time error if a `mixin class` | ||
/// declaration has an `extends` clause | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=class-modifiers | ||
|
||
class C {} | ||
|
||
mixin class MixinClassExtendsObject extends Object {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin class BaseMixinClassExtendsObject extends Object {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract mixin class AbstractMixinClassExtendsObject extends Object {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base mixin class AbstractBaseMixinClassExtendsObject extends Object {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin class MixinClassExtendsC extends C {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin class BaseMixinClassExtendsC extends C {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract mixin class AbstractMixinClassExtendsC extends C {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base mixin class AbstractBaseMixinClassExtendsC extends C {} | ||
// ^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(MixinClassExtendsObject); | ||
print(BaseMixinClassExtendsObject); | ||
print(AbstractMixinClassExtendsObject); | ||
print(AbstractBaseMixinClassExtendsObject); | ||
print(MixinClassExtendsC); | ||
print(BaseMixinClassExtendsC); | ||
print(AbstractMixinClassExtendsC); | ||
print(AbstractBaseMixinClassExtendsC); | ||
} |
Oops, something went wrong.