dart-sdk/tests/language/sealed_class/sealed_class_syntax_disabled_error_test.dart
Sergey G. Grekhov 82b78916fd [tests] Remove obsolete Dart 3.0 experiments from language tests
Change-Id: If31c487e3ebe2c1ae847aff7c8994580b8b6f2f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309660
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-06-15 08:26:27 +00:00

31 lines
1.1 KiB
Dart

// Copyright (c) 2022, 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.
// @dart = 2.19
// Make sure errors are emitted when trying to use sealed classes without
// the `sealed` experiment enabled.
sealed class SealedClass {
// [error column 1, length 6]
// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] The 'sealed-class' language feature is disabled for this library.
// ^
// [cfe] The non-abstract class 'SealedClass' is missing implementations for these members:
int nonAbstractFoo = 0;
abstract int foo;
//^^^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER
int nonAbstractBar(int value) => value + 100;
int bar(int value);
//^^^^^^^^^^^^^^^^^^^
// [analyzer] COMPILE_TIME_ERROR.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER
}
mixin M {}
sealed class SealedClassTypeAlias = Object with M;
// [error column 1, length 6]
// [analyzer] SYNTACTIC_ERROR.EXPERIMENT_NOT_ENABLED
// [cfe] The 'sealed-class' language feature is disabled for this library.