-
Notifications
You must be signed in to change notification settings - Fork 28
#1959. More basic and mixin restrictions tests #2021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.