mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:59:47 +00:00
82b78916fd
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>
31 lines
1.1 KiB
Dart
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.
|