forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dart-lang#1959. Tests for syntax and basic restrictions (dart-lang#2017)
Add tests for syntax and basic restrictions.
- Loading branch information
Showing
58 changed files
with
4,203 additions
and
0 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
LanguageFeatures/Class-modifiers/basic_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,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 It is a compile-time error if: | ||
/// - A declaration depends directly on a sealed declaration from another | ||
/// library. | ||
/// | ||
/// @description Check that it is a compile-time error if class marked `sealed` | ||
/// is extended outside of the library where it is declared | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=class-modifiers | ||
|
||
import "class_modifiers_lib.dart"; | ||
|
||
class ExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract class AbstractExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base class AbstractBaseExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract interface class AbstractInterfaceExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract final class AbstractFinalExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
final class FinalExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base class BaseExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
sealed class SealedExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
interface class InterfaceExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin class MixinExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin class BaseMixinExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract mixin class AbstractMixinExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base mixin class AbstractBaseMixinExtendsSealed extends SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(ExtendsSealed); | ||
print(AbstractExtendsSealed); | ||
print(AbstractBaseExtendsSealed); | ||
print(AbstractInterfaceExtendsSealed); | ||
print(AbstractFinalExtendsSealed); | ||
print(FinalExtendsSealed); | ||
print(BaseExtendsSealed); | ||
print(SealedExtendsSealed); | ||
print(InterfaceExtendsSealed); | ||
print(MixinExtendsSealed); | ||
print(BaseMixinExtendsSealed); | ||
print(AbstractMixinExtendsSealed); | ||
print(AbstractBaseMixinExtendsSealed); | ||
} |
115 changes: 115 additions & 0 deletions
115
LanguageFeatures/Class-modifiers/basic_restrictions_A01_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,115 @@ | ||
// 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 is a compile-time error if: | ||
/// - A declaration depends directly on a sealed declaration from another | ||
/// library. | ||
/// | ||
/// @description Check that it is a compile-time error to implement the | ||
/// interface of a class marked `sealed` outside of the library where it is | ||
/// declared | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=class-modifiers | ||
|
||
import "class_modifiers_lib.dart"; | ||
|
||
class ImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract class AbstractImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base class AbstractBaseImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract interface class AbstractInterfaceImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract final class AbstractFinalImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
final class FinalImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base class BaseImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
sealed class SealedImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
interface class InterfaceImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin class MixinClassImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin class BaseMixinClassImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract mixin class AbstractMixinImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base mixin class AbstractBaseMixinImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
mixin MixinImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin BaseMixinImplementsSealed implements SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum EnumImplementsSealedClass implements SealedClass {e1, e2} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(ImplementsSealed); | ||
print(AbstractImplementsSealed); | ||
print(AbstractBaseImplementsSealed); | ||
print(AbstractInterfaceImplementsSealed); | ||
print(AbstractFinalImplementsSealed); | ||
print(FinalImplementsSealed); | ||
print(BaseImplementsSealed); | ||
print(SealedImplementsSealed); | ||
print(InterfaceImplementsSealed); | ||
print(MixinClassImplementsSealed); | ||
print(BaseMixinClassImplementsSealed); | ||
print(AbstractMixinImplementsSealed); | ||
print(AbstractBaseMixinImplementsSealed); | ||
print(MixinImplementsSealed); | ||
print(BaseMixinImplementsSealed); | ||
print(EnumImplementsSealedClass); | ||
} |
84 changes: 84 additions & 0 deletions
84
LanguageFeatures/Class-modifiers/basic_restrictions_A01_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,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 It is a compile-time error if: | ||
/// - A declaration depends directly on a sealed declaration from another | ||
/// library. | ||
/// | ||
/// @description Check that it is a compile-time error to mix in or use in the | ||
/// `on` clause of a mixin a class marked `sealed` outside of the library where | ||
/// it is declared | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=class-modifiers | ||
|
||
import "class_modifiers_lib.dart"; | ||
|
||
mixin MixinOnSealed on SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base mixin BaseMixinOnSealed on SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
class ClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
base class BaseClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
interface class InterfaceClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
final class FinalClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
sealed class SealedClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract class AbstractClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract base class AbstractBaseClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract interface class AbstractInterfaceClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
abstract final class AbstractFinalClassWithSealed with SealedClass {} | ||
// ^^^^^^^^^^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
main() { | ||
print(MixinOnSealed); | ||
print(BaseMixinOnSealed); | ||
print(ClassWithSealed); | ||
print(BaseClassWithSealed); | ||
print(InterfaceClassWithSealed); | ||
print(FinalClassWithSealed); | ||
print(SealedClassWithSealed); | ||
print(AbstractClassWithSealed); | ||
print(AbstractBaseClassWithSealed); | ||
print(AbstractInterfaceClassWithSealed); | ||
} |
Oops, something went wrong.