mirror of
https://github.com/dart-lang/sdk
synced 2024-10-02 23:59:16 +00:00
Enforce current library restrictions.
Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`. Mark all current classes intended as mixins as `mixin class`. More additions and cleanup will follow, but this change should make everything keep working as today if we flip the switch. TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers. Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683 Reviewed-by: Siva Annamalai <asiva@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Kallen Tu <kallentu@google.com>
This commit is contained in:
parent
61a4fb4f9e
commit
0c05e33836
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -16,6 +16,18 @@
|
|||
|
||||
### Libraries
|
||||
|
||||
#### General changes
|
||||
|
||||
- **Breaking Change**: Non-`mixin` classes in the platform libraries
|
||||
can no longer be mixed in, unless they are explicitly marked as `mixin class`.
|
||||
The following existing classes have been made mixin classes:
|
||||
* `IterableMixin`
|
||||
* `ListMixin`
|
||||
* `SetMixin`
|
||||
* `MapMixin`
|
||||
* `LinkedListEntry`
|
||||
* `StringConversionSink`
|
||||
|
||||
#### `dart:core`
|
||||
|
||||
- **Breaking change** [#49529][]:
|
||||
|
@ -48,6 +60,15 @@
|
|||
Existing bidirectional iterators can still work, they just don't have
|
||||
a shared supertype locking them to a specific name for moving backwards.
|
||||
|
||||
- **Breaking change when migrating code to Dart 3.0**:
|
||||
Some changes to platform libraries only affect code when it is migrated
|
||||
to language version 3.0.
|
||||
- The `Function` type can no longer be implemented.
|
||||
Since Dart 2.0 writing `implements Function` has been allowed
|
||||
for backwards compatibility, but it has not had any effect.
|
||||
In Dart 3.0, the `Function` type is `final` and cannot be implemented
|
||||
by class-modifier aware code.
|
||||
|
||||
[#49529]: https://github.com/dart-lang/sdk/issues/49529
|
||||
[`List.filled`]: https://api.dart.dev/stable/2.18.6/dart-core/List/List.filled.html
|
||||
[`int.parse`]: https://api.dart.dev/stable/2.18.4/dart-core/int/parse.html
|
||||
|
@ -149,14 +170,14 @@ Updates the Linter to `1.34.0-dev`, which includes changes that
|
|||
- `prefer_equal_for_default_values`
|
||||
- `super_goes_last`
|
||||
- fix `unnecessary_parenthesis` false-positives with null-aware expressions.
|
||||
- fix `void_checks` to allow assignments of `Future<dynamic>?` to parameters
|
||||
- fix `void_checks` to allow assignments of `Future<dynamic>?` to parameters
|
||||
typed `FutureOr<void>?`.
|
||||
- fix `use_build_context_synchronously` in if conditions.
|
||||
- fix a false positive for `avoid_private_typedef_functions` with generalized
|
||||
type aliases.
|
||||
- update `unnecessary_parenthesis` to detect some doubled parens.
|
||||
- update `void_checks` to allow returning `Never` as void.
|
||||
- update `no_adjacent_strings_in_list` to support set literals and for- and
|
||||
- update `no_adjacent_strings_in_list` to support set literals and for- and
|
||||
if-elements.
|
||||
- update `avoid_types_as_parameter_names` to handle type variables.
|
||||
- update `avoid_positional_boolean_parameters` to handle typedefs.
|
||||
|
|
|
@ -71,7 +71,7 @@ void buildTestsForAnalysisServer() {
|
|||
'lib/src/edit/nnbd_migration/resources/resources.g.dart',
|
||||
'test/integration/support/integration_test_methods.dart',
|
||||
'test/integration/support/protocol_matchers.dart',
|
||||
// The following are not generated, but can't be sorted because the contain
|
||||
// The following are not generated, but can't be sorted because they contain
|
||||
// ignore comments in the directives, which sorting deletes.
|
||||
'lib/src/edit/edit_domain.dart',
|
||||
'lib/src/services/kythe/schema.dart',
|
||||
|
|
|
@ -140,7 +140,7 @@ class ExperimentalFeatures {
|
|||
isEnabledByDefault: IsEnabledByDefault.class_modifiers,
|
||||
isExpired: IsExpired.class_modifiers,
|
||||
documentation: 'Class modifiers',
|
||||
experimentalReleaseVersion: null,
|
||||
experimentalReleaseVersion: Version.parse('3.0.0'),
|
||||
releaseVersion: null,
|
||||
);
|
||||
|
||||
|
@ -314,7 +314,7 @@ class ExperimentalFeatures {
|
|||
isEnabledByDefault: IsEnabledByDefault.records,
|
||||
isExpired: IsExpired.records,
|
||||
documentation: 'Records',
|
||||
experimentalReleaseVersion: Version.parse('2.19.0'),
|
||||
experimentalReleaseVersion: Version.parse('3.0.0'),
|
||||
releaseVersion: null,
|
||||
);
|
||||
|
||||
|
@ -324,7 +324,7 @@ class ExperimentalFeatures {
|
|||
isEnabledByDefault: IsEnabledByDefault.sealed_class,
|
||||
isExpired: IsExpired.sealed_class,
|
||||
documentation: 'Sealed class',
|
||||
experimentalReleaseVersion: null,
|
||||
experimentalReleaseVersion: Version.parse('3.0.0'),
|
||||
releaseVersion: null,
|
||||
);
|
||||
|
||||
|
|
|
@ -1746,7 +1746,10 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
|||
final interfaceElement = interfaceType.element;
|
||||
if (interfaceElement is ClassOrMixinElementImpl &&
|
||||
interfaceElement.isBase &&
|
||||
interfaceElement.library != _currentLibrary) {
|
||||
interfaceElement.library != _currentLibrary &&
|
||||
!_mayIgnoreClassModifiers(interfaceElement.library)) {
|
||||
// Should this be combined with _checkForImplementsClauseErrorCodes
|
||||
// to avoid double errors if implementing `int`.
|
||||
if (interfaceElement is ClassElement) {
|
||||
errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode.BASE_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY,
|
||||
|
@ -2862,7 +2865,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
|||
final element = type.element;
|
||||
if (element is ClassElementImpl &&
|
||||
element.isFinal &&
|
||||
element.library != _currentLibrary) {
|
||||
element.library != _currentLibrary &&
|
||||
!_mayIgnoreClassModifiers(element.library)) {
|
||||
errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY,
|
||||
superclass,
|
||||
|
@ -2877,7 +2881,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
|||
final element = type.element;
|
||||
if (element is MixinElementImpl &&
|
||||
element.isFinal &&
|
||||
element.library != _currentLibrary) {
|
||||
element.library != _currentLibrary &&
|
||||
!_mayIgnoreClassModifiers(element.library)) {
|
||||
errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode.FINAL_MIXIN_MIXED_IN_OUTSIDE_OF_LIBRARY,
|
||||
namedType,
|
||||
|
@ -2893,7 +2898,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
|||
final element = type.element;
|
||||
if (element is ClassOrMixinElementImpl &&
|
||||
element.isFinal &&
|
||||
element.library != _currentLibrary) {
|
||||
element.library != _currentLibrary &&
|
||||
!_mayIgnoreClassModifiers(element.library)) {
|
||||
final ErrorCode errorCode;
|
||||
if (element is ClassElement) {
|
||||
errorCode = CompileTimeErrorCode
|
||||
|
@ -3113,7 +3119,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
|||
final superclassElement = superclassType.element;
|
||||
if (superclassElement is ClassElementImpl &&
|
||||
superclassElement.isInterface &&
|
||||
superclassElement.library != _currentLibrary) {
|
||||
superclassElement.library != _currentLibrary &&
|
||||
!_mayIgnoreClassModifiers(superclassElement.library)) {
|
||||
errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode.INTERFACE_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY,
|
||||
superclass,
|
||||
|
@ -3128,7 +3135,8 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
|||
final withElement = withType.element;
|
||||
if (withElement is MixinElementImpl &&
|
||||
withElement.isInterface &&
|
||||
withElement.library != _currentLibrary) {
|
||||
withElement.library != _currentLibrary &&
|
||||
!_mayIgnoreClassModifiers(withElement.library)) {
|
||||
errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode
|
||||
.INTERFACE_MIXIN_MIXED_IN_OUTSIDE_OF_LIBRARY,
|
||||
|
@ -5485,6 +5493,26 @@ class ErrorVerifier extends RecursiveAstVisitor<void>
|
|||
return false;
|
||||
}
|
||||
|
||||
/// Checks whether a `final`, `base` or `interface` modifier can be ignored.
|
||||
///
|
||||
/// Checks whether a subclass in the current library
|
||||
/// can ignore a class modifier of a declaration in [superLibrary].
|
||||
///
|
||||
/// Only true if the supertype library is a platform library, and
|
||||
/// either the current library is also a platform library,
|
||||
/// or the current library has a language version which predates
|
||||
/// class modifiers
|
||||
bool _mayIgnoreClassModifiers(LibraryElement superLibrary) {
|
||||
// Only modifiers in platform libraries can be ignored.
|
||||
if (!superLibrary.isInSdk) return false;
|
||||
|
||||
// Other platform libraries can ignore modifiers.
|
||||
if (_currentLibrary.isInSdk) return true;
|
||||
|
||||
// Libraries predating class modifiers can ignore platform modifiers.
|
||||
return !_currentLibrary.featureSet.isEnabled(Feature.class_modifiers);
|
||||
}
|
||||
|
||||
/// Return the name of the [parameter], or `null` if the parameter does not
|
||||
/// have a name.
|
||||
Token? _parameterName(FormalParameter parameter) {
|
||||
|
|
|
@ -66,7 +66,7 @@ class DartUriResolver extends UriResolver {
|
|||
///
|
||||
/// @param uri the URI being tested
|
||||
/// @return `true` if the given URI is a `dart:` URI
|
||||
static bool isDartUri(Uri uri) => DART_SCHEME == uri.scheme;
|
||||
static bool isDartUri(Uri uri) => uri.isScheme(DART_SCHEME);
|
||||
}
|
||||
|
||||
/// An implementation of an non-existing [Source].
|
||||
|
|
|
@ -771,6 +771,8 @@ final Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
|
|||
const AllowedExperimentalFlags defaultAllowedExperimentalFlags =
|
||||
const AllowedExperimentalFlags(sdkDefaultExperiments: {
|
||||
ExperimentalFlag.records,
|
||||
ExperimentalFlag.classModifiers,
|
||||
ExperimentalFlag.sealedClass,
|
||||
}, sdkLibraryExperiments: {}, packageExperiments: {
|
||||
"async": {
|
||||
ExperimentalFlag.nonNullable,
|
||||
|
|
|
@ -2159,6 +2159,56 @@ severity: $severity
|
|||
typeBuilder.libraryBuilder.library.languageVersion >=
|
||||
ExperimentalFlag.sealedClass.experimentEnabledVersion;
|
||||
|
||||
/// Set when we know whether this library can ignore class modifiers.
|
||||
///
|
||||
/// The same decision applies to all declarations in the library,
|
||||
/// so the value only needs to be computed once.
|
||||
bool? isExempt;
|
||||
|
||||
/// Whether the [cls] declaration can ignore (some) class modifiers.
|
||||
///
|
||||
/// Checks whether the [cls] can ignore modifiers
|
||||
/// from the [supertypeDeclaration].
|
||||
/// This is only possible if the supertype declaration comes
|
||||
/// from a platform library (`dart:` URI scheme),
|
||||
/// and then only if the library is another platform library which is
|
||||
/// exempt from restrictions on extending otherwise sealed platform types,
|
||||
/// or if the library is a pre-class-modifiers-feature language version
|
||||
/// library.
|
||||
bool mayIgnoreClassModifiers(ClassBuilder supertypeDeclaration) {
|
||||
// Only use this to ignore `final`, `base`, and `interface`.
|
||||
// Nobody can ignore `abstract`, `sealed` or `mixin`.
|
||||
|
||||
// We already know the library cannot ignore modifiers.
|
||||
if (isExempt == false) return false;
|
||||
|
||||
// Exception only applies to platform libraries.
|
||||
final LibraryBuilder superLibrary = supertypeDeclaration.libraryBuilder;
|
||||
if (!superLibrary.importUri.isScheme("dart")) return false;
|
||||
|
||||
// Remaining tests depend on the source library only,
|
||||
// and the result can be cached.
|
||||
if (isExempt == true) return true;
|
||||
|
||||
final LibraryBuilder subLibrary = cls.libraryBuilder;
|
||||
|
||||
// Some platform libraries may implement types like `int`,
|
||||
// even if they are final.
|
||||
if (subLibrary.mayImplementRestrictedTypes) {
|
||||
isExempt = true;
|
||||
return true;
|
||||
}
|
||||
// "Legacy" libraries may ignore `final`, `base` and `interface`
|
||||
// from platform libraries. (But still cannot implement `int`.)
|
||||
if (subLibrary.library.languageVersion <
|
||||
ExperimentalFlag.classModifiers.experimentEnabledVersion) {
|
||||
isExempt = true;
|
||||
return true;
|
||||
}
|
||||
isExempt = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
TypeDeclarationBuilder? unaliasDeclaration(TypeBuilder typeBuilder) {
|
||||
TypeDeclarationBuilder? typeDeclarationBuilder = typeBuilder.declaration;
|
||||
if (typeDeclarationBuilder is TypeAliasBuilder) {
|
||||
|
@ -2181,7 +2231,9 @@ severity: $severity
|
|||
cls.libraryBuilder.origin !=
|
||||
supertypeDeclaration.libraryBuilder.origin) {
|
||||
if (isClassModifiersEnabled(supertypeDeclaration)) {
|
||||
if (supertypeDeclaration.isInterface && !cls.isMixinDeclaration) {
|
||||
if (supertypeDeclaration.isInterface &&
|
||||
!cls.isMixinDeclaration &&
|
||||
!mayIgnoreClassModifiers(supertypeDeclaration)) {
|
||||
cls.addProblem(
|
||||
templateInterfaceClassExtendedOutsideOfLibrary
|
||||
.withArguments(supertypeDeclaration.fullNameForErrors),
|
||||
|
@ -2190,7 +2242,8 @@ severity: $severity
|
|||
} else if (supertypeDeclaration.isFinal &&
|
||||
// TODO(kallentu): Error case where the class has a singular on
|
||||
// clause. Change with the new spec changes.
|
||||
!cls.isMixinDeclaration) {
|
||||
!cls.isMixinDeclaration &&
|
||||
!mayIgnoreClassModifiers(supertypeDeclaration)) {
|
||||
cls.addProblem(
|
||||
templateFinalClassExtendedOutsideOfLibrary
|
||||
.withArguments(supertypeDeclaration.fullNameForErrors),
|
||||
|
@ -2235,13 +2288,15 @@ severity: $severity
|
|||
|
||||
if (cls.libraryBuilder.origin !=
|
||||
mixedInTypeDeclaration.libraryBuilder.origin) {
|
||||
if (mixedInTypeDeclaration.isInterface) {
|
||||
if (mixedInTypeDeclaration.isInterface &&
|
||||
!mayIgnoreClassModifiers(mixedInTypeDeclaration)) {
|
||||
cls.addProblem(
|
||||
templateInterfaceMixinMixedInOutsideOfLibrary
|
||||
.withArguments(mixedInTypeDeclaration.fullNameForErrors),
|
||||
mixedInTypeBuilder.charOffset ?? TreeNode.noOffset,
|
||||
noLength);
|
||||
} else if (mixedInTypeDeclaration.isFinal) {
|
||||
} else if (mixedInTypeDeclaration.isFinal &&
|
||||
!mayIgnoreClassModifiers(mixedInTypeDeclaration)) {
|
||||
cls.addProblem(
|
||||
templateFinalMixinMixedInOutsideOfLibrary
|
||||
.withArguments(mixedInTypeDeclaration.fullNameForErrors),
|
||||
|
@ -2276,7 +2331,8 @@ severity: $severity
|
|||
if (isClassModifiersEnabled(interfaceDeclaration)) {
|
||||
// Report an error for a class implementing a base class outside of
|
||||
// its library.
|
||||
if (interfaceDeclaration.isBase) {
|
||||
if (interfaceDeclaration.isBase &&
|
||||
!mayIgnoreClassModifiers(interfaceDeclaration)) {
|
||||
if (interfaceDeclaration.isMixinDeclaration) {
|
||||
cls.addProblem(
|
||||
templateBaseMixinImplementedOutsideOfLibrary
|
||||
|
@ -2293,7 +2349,8 @@ severity: $severity
|
|||
} else if (interfaceDeclaration.isFinal &&
|
||||
// TODO(kallentu): Error case where the class has multiple on
|
||||
// clauses. Change with the new spec changes.
|
||||
!cls.cls.isAnonymousMixin) {
|
||||
!cls.cls.isAnonymousMixin &&
|
||||
!mayIgnoreClassModifiers(interfaceDeclaration)) {
|
||||
if (interfaceDeclaration.isMixinDeclaration) {
|
||||
cls.addProblem(
|
||||
templateFinalMixinImplementedOutsideOfLibrary
|
||||
|
|
|
@ -2601,6 +2601,7 @@ restored
|
|||
restores
|
||||
restrict
|
||||
restricted
|
||||
restrictions
|
||||
restrictive
|
||||
result
|
||||
resulted
|
||||
|
|
|
@ -38,9 +38,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/records/type_record_as_supertype.dart:22:16: Error: 'RR' is restricted and can't be extended or implemented.
|
||||
// abstract class C2 with RR {} // Error.
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:16: Context: This is the type denoted by the type alias.
|
||||
// abstract class Record {}
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:22: Context: This is the type denoted by the type alias.
|
||||
// abstract final class Record {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -38,9 +38,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/records/type_record_as_supertype.dart:22:16: Error: 'RR' is restricted and can't be extended or implemented.
|
||||
// abstract class C2 with RR {} // Error.
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:16: Context: This is the type denoted by the type alias.
|
||||
// abstract class Record {}
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:22: Context: This is the type denoted by the type alias.
|
||||
// abstract final class Record {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -38,9 +38,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/records/type_record_as_supertype.dart:22:16: Error: 'RR' is restricted and can't be extended or implemented.
|
||||
// abstract class C2 with RR {} // Error.
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:16: Context: This is the type denoted by the type alias.
|
||||
// abstract class Record {}
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:22: Context: This is the type denoted by the type alias.
|
||||
// abstract final class Record {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -38,9 +38,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/records/type_record_as_supertype.dart:22:16: Error: 'RR' is restricted and can't be extended or implemented.
|
||||
// abstract class C2 with RR {} // Error.
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:16: Context: This is the type denoted by the type alias.
|
||||
// abstract class Record {}
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:22: Context: This is the type denoted by the type alias.
|
||||
// abstract final class Record {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -38,9 +38,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/records/type_record_as_supertype.dart:22:16: Error: 'RR' is restricted and can't be extended or implemented.
|
||||
// abstract class C2 with RR {} // Error.
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:16: Context: This is the type denoted by the type alias.
|
||||
// abstract class Record {}
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:22: Context: This is the type denoted by the type alias.
|
||||
// abstract final class Record {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -38,9 +38,9 @@ library /*isNonNullableByDefault*/;
|
|||
// pkg/front_end/testcases/records/type_record_as_supertype.dart:22:16: Error: 'RR' is restricted and can't be extended or implemented.
|
||||
// abstract class C2 with RR {} // Error.
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:16: Context: This is the type denoted by the type alias.
|
||||
// abstract class Record {}
|
||||
// ^
|
||||
// sdk/lib/core/record.dart:11:22: Context: This is the type denoted by the type alias.
|
||||
// abstract final class Record {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
|
|
@ -182,7 +182,7 @@ ISOLATE_UNIT_TEST_CASE(JSON_JSONStream_DartObject) {
|
|||
"Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{"
|
||||
"\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
|
||||
"\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_"
|
||||
"kind\":\"kernel\"},\"tokenPos\":925,\"endTokenPos\":1165,\"line\":23,"
|
||||
"kind\":\"kernel\"},\"tokenPos\":925,\"endTokenPos\":1171,\"line\":23,"
|
||||
"\"column\":1},\"library\":{"
|
||||
"\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
|
||||
"core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,"
|
||||
|
@ -191,7 +191,7 @@ ISOLATE_UNIT_TEST_CASE(JSON_JSONStream_DartObject) {
|
|||
"\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
|
||||
"\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
|
||||
"\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_kind\":\"kernel\"},"
|
||||
"\"tokenPos\":925,\"endTokenPos\":1165,\"line\":23,\"column\":1},"
|
||||
"\"tokenPos\":925,\"endTokenPos\":1171,\"line\":23,\"column\":1},"
|
||||
"\"library\":{\"type\":\"@"
|
||||
"Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":"
|
||||
"\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,\"id\":\"\","
|
||||
|
|
|
@ -289,7 +289,7 @@ class _HttpProfileData {
|
|||
int _nextServiceId = 1;
|
||||
|
||||
// TODO(ajohnsen): Use other way of getting a unique id.
|
||||
abstract class _ServiceObject {
|
||||
mixin _ServiceObject {
|
||||
int __serviceId = 0;
|
||||
int get _serviceId {
|
||||
if (__serviceId == 0) __serviceId = _nextServiceId++;
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
"version": 1,
|
||||
"experimentSets": {
|
||||
"sdkExperiments": [
|
||||
"records"
|
||||
"records",
|
||||
"class-modifiers",
|
||||
"sealed-class"
|
||||
],
|
||||
"nullSafety": [
|
||||
"non-nullable"
|
||||
|
|
|
@ -333,8 +333,7 @@ class _UnmodifiableByteDataView implements ByteData, UnmodifiableByteDataView {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _UnmodifiableListMixin<N, L extends List<N>,
|
||||
TD extends TypedData> {
|
||||
mixin _UnmodifiableListMixin<N, L extends List<N>, TD extends TypedData> {
|
||||
L get _list;
|
||||
TD get _data => (_list as TD);
|
||||
|
||||
|
|
|
@ -333,8 +333,7 @@ class _UnmodifiableByteDataView implements ByteData, UnmodifiableByteDataView {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _UnmodifiableListMixin<N, L extends List<N>,
|
||||
TD extends TypedData> {
|
||||
mixin _UnmodifiableListMixin<N, L extends List<N>, TD extends TypedData> {
|
||||
L get _list;
|
||||
TD get _data => (_list as TD);
|
||||
|
||||
|
|
|
@ -829,7 +829,7 @@ mixin _TypedDoubleListMixin<SpawnedType extends List<double>>
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _Float32x4ListMixin implements List<Float32x4> {
|
||||
mixin _Float32x4ListMixin implements List<Float32x4> {
|
||||
int get elementSizeInBytes;
|
||||
int get offsetInBytes;
|
||||
_ByteBuffer get buffer;
|
||||
|
@ -1187,7 +1187,7 @@ abstract class _Float32x4ListMixin implements List<Float32x4> {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _Int32x4ListMixin implements List<Int32x4> {
|
||||
mixin _Int32x4ListMixin implements List<Int32x4> {
|
||||
int get elementSizeInBytes;
|
||||
int get offsetInBytes;
|
||||
_ByteBuffer get buffer;
|
||||
|
@ -1544,7 +1544,7 @@ abstract class _Int32x4ListMixin implements List<Int32x4> {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _Float64x2ListMixin implements List<Float64x2> {
|
||||
mixin _Float64x2ListMixin implements List<Float64x2> {
|
||||
int get elementSizeInBytes;
|
||||
int get offsetInBytes;
|
||||
_ByteBuffer get buffer;
|
||||
|
|
|
@ -36,10 +36,10 @@ part of dart.async;
|
|||
/// `Future<Object>`.
|
||||
@pragma("vm:entry-point")
|
||||
abstract class FutureOr<T> {
|
||||
// Private generative constructor, so that it is not subclassable, mixable, or
|
||||
// instantiable.
|
||||
// Private generative constructor, so that it is not subclassable, mixable,
|
||||
// or instantiable.
|
||||
FutureOr._() {
|
||||
throw new UnsupportedError("FutureOr can't be instantiated");
|
||||
throw new UnsupportedError("FutureOr cannot be instantiated");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -768,7 +768,7 @@ abstract class _StreamController<T> implements _StreamControllerBase<T> {
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _SyncStreamControllerDispatch<T>
|
||||
mixin _SyncStreamControllerDispatch<T>
|
||||
implements _StreamController<T>, SynchronousStreamController<T> {
|
||||
void _sendData(T data) {
|
||||
_subscription._add(data);
|
||||
|
@ -783,8 +783,7 @@ abstract class _SyncStreamControllerDispatch<T>
|
|||
}
|
||||
}
|
||||
|
||||
abstract class _AsyncStreamControllerDispatch<T>
|
||||
implements _StreamController<T> {
|
||||
mixin _AsyncStreamControllerDispatch<T> implements _StreamController<T> {
|
||||
void _sendData(T data) {
|
||||
_subscription._addPending(_DelayedData<T>(data));
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ part of dart.collection;
|
|||
/// This [Iterable] mixin implements all [Iterable] members except `iterator`.
|
||||
///
|
||||
/// All other methods are implemented in terms of `iterator`.
|
||||
abstract class IterableMixin<E> implements Iterable<E> {
|
||||
abstract mixin class IterableMixin<E> implements Iterable<E> {
|
||||
// This class has methods copied verbatim into:
|
||||
// - IterableBase
|
||||
// - SetMixin
|
||||
|
|
|
@ -270,7 +270,7 @@ class _LinkedListIterator<E extends LinkedListEntry<E>> implements Iterator<E> {
|
|||
/// linked list, and otherwise the `list` property is `null`.
|
||||
///
|
||||
/// When created, an entry is not in any linked list.
|
||||
abstract class LinkedListEntry<E extends LinkedListEntry<E>> {
|
||||
abstract base mixin class LinkedListEntry<E extends LinkedListEntry<E>> {
|
||||
LinkedList<E>? _list;
|
||||
E? _next;
|
||||
E? _previous;
|
||||
|
|
|
@ -69,7 +69,7 @@ abstract class ListBase<E> extends Object with ListMixin<E> {
|
|||
/// To avoid this, override 'add' and 'addAll' to also forward directly
|
||||
/// to the growable list, or, if possible, use `DelegatingList` from
|
||||
/// "package:collection/collection.dart" instead of a `ListMixin`.
|
||||
abstract class ListMixin<E> implements List<E> {
|
||||
abstract mixin class ListMixin<E> implements List<E> {
|
||||
// Iterable interface.
|
||||
// TODO(lrn): When we get composable mixins, reuse IterableMixin instead
|
||||
// of redeclaring everything.
|
||||
|
|
|
@ -108,7 +108,7 @@ abstract class MapBase<K, V> extends MapMixin<K, V> {
|
|||
///
|
||||
/// A more efficient implementation is usually possible by overriding
|
||||
/// some of the other members as well.
|
||||
abstract class MapMixin<K, V> implements Map<K, V> {
|
||||
abstract mixin class MapMixin<K, V> implements Map<K, V> {
|
||||
Iterable<K> get keys;
|
||||
V? operator [](Object? key);
|
||||
operator []=(K key, V value);
|
||||
|
@ -263,7 +263,7 @@ class _MapBaseValueIterator<K, V> implements Iterator<V> {
|
|||
|
||||
/// Mixin that overrides mutating map operations with implementations that
|
||||
/// throw.
|
||||
abstract class _UnmodifiableMapMixin<K, V> implements Map<K, V> {
|
||||
mixin _UnmodifiableMapMixin<K, V> implements Map<K, V> {
|
||||
/// This operation is not supported by an unmodifiable map.
|
||||
void operator []=(K key, V value) {
|
||||
throw UnsupportedError("Cannot modify unmodifiable map");
|
||||
|
|
|
@ -20,7 +20,7 @@ part of dart.collection;
|
|||
/// Implementations of `Set` using this mixin should consider also implementing
|
||||
/// `clear` in constant time. The default implementation works by removing every
|
||||
/// element.
|
||||
abstract class SetMixin<E> implements Set<E> {
|
||||
abstract mixin class SetMixin<E> implements Set<E> {
|
||||
// This class reimplements all of [IterableMixin].
|
||||
// If/when Dart mixins get more powerful, we should just create a single
|
||||
// Mixin class from IterableMixin and the new methods of this class.
|
||||
|
@ -341,7 +341,7 @@ abstract class _SetBase<E> with SetMixin<E> {
|
|||
Set<E> toSet() => _newSet()..addAll(this);
|
||||
}
|
||||
|
||||
abstract class _UnmodifiableSetMixin<E> implements Set<E> {
|
||||
mixin _UnmodifiableSetMixin<E> implements Set<E> {
|
||||
static Never _throwUnmodifiable() {
|
||||
throw UnsupportedError("Cannot change an unmodifiable set");
|
||||
}
|
||||
|
|
|
@ -882,7 +882,7 @@ abstract class _JsonStringifier {
|
|||
/// [Map] objects using the specified indent value.
|
||||
///
|
||||
/// Subclasses should implement [writeIndentation].
|
||||
abstract class _JsonPrettyPrintMixin implements _JsonStringifier {
|
||||
mixin _JsonPrettyPrintMixin implements _JsonStringifier {
|
||||
int _indentLevel = 0;
|
||||
|
||||
/// Add [indentLevel] indentations to the JSON output.
|
||||
|
|
|
@ -155,7 +155,7 @@ abstract class StringConversionSinkBase extends StringConversionSinkMixin {}
|
|||
|
||||
/// This class provides a mixin for converters that need to accept String
|
||||
/// inputs.
|
||||
abstract class StringConversionSinkMixin implements StringConversionSink {
|
||||
abstract mixin class StringConversionSinkMixin implements StringConversionSink {
|
||||
void addSlice(String str, int start, int end, bool isLast);
|
||||
void close();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ part of dart.core;
|
|||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// bool.
|
||||
@pragma("vm:entry-point")
|
||||
class bool {
|
||||
final class bool {
|
||||
/// Returns the boolean value of the environment declaration [name].
|
||||
///
|
||||
/// The boolean value of the declaration is `true` if the declared value is
|
||||
|
|
|
@ -21,7 +21,7 @@ part of dart.core;
|
|||
/// * [num] the super class for [double].
|
||||
/// * [Numbers](https://dart.dev/guides/language/numbers) in
|
||||
/// [A tour of the Dart language](https://dart.dev/guides/language/language-tour).
|
||||
abstract class double extends num {
|
||||
abstract final class double extends num {
|
||||
static const double nan = 0.0 / 0.0;
|
||||
static const double infinity = 1.0 / 0.0;
|
||||
static const double negativeInfinity = -infinity;
|
||||
|
|
|
@ -11,7 +11,7 @@ part of dart.core;
|
|||
/// Non-platform classes cannot implement, extend or
|
||||
/// mix in this class.
|
||||
@Since("2.14")
|
||||
abstract class Enum {
|
||||
abstract final class Enum {
|
||||
/// A numeric identifier for the enumerated value.
|
||||
///
|
||||
/// The values of a single enumeration are numbered
|
||||
|
|
|
@ -101,7 +101,7 @@ part of dart.core;
|
|||
/// Function? maybeFun = Random().nextBool() ? fun : null;
|
||||
/// print(maybeFun?.call(1)); // Prints "1" or "null".
|
||||
/// ```
|
||||
abstract class Function {
|
||||
abstract final class Function {
|
||||
/// Dynamically call [function] with the specified arguments.
|
||||
///
|
||||
/// Acts the same as dynamically calling [function] with
|
||||
|
|
|
@ -25,7 +25,7 @@ part of dart.core;
|
|||
/// * [num] the super class for [int].
|
||||
/// * [Numbers](https://dart.dev/guides/language/numbers) in
|
||||
/// [A tour of the Dart language](https://dart.dev/guides/language/language-tour).
|
||||
abstract class int extends num {
|
||||
abstract final class int extends num {
|
||||
/// Returns the integer value of the given environment declaration [name].
|
||||
///
|
||||
/// The result is the same as would be returned by:
|
||||
|
|
|
@ -21,7 +21,7 @@ part of dart.core;
|
|||
/// [...? e6] // spreads e6 into the list literal, unless e6 is null.
|
||||
/// ```
|
||||
@pragma("vm:entry-point")
|
||||
class Null {
|
||||
final class Null {
|
||||
factory Null._uninstantiable() {
|
||||
throw UnsupportedError('class Null cannot be instantiated');
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ part of dart.core;
|
|||
/// * [Numbers](https://dart.dev/guides/language/numbers) in
|
||||
/// [A tour of the Dart language](https://dart.dev/guides/language/language-tour).
|
||||
|
||||
abstract class num implements Comparable<num> {
|
||||
sealed class num implements Comparable<num> {
|
||||
/// Test whether this value is numerically equal to `other`.
|
||||
///
|
||||
/// If both operands are [double]s, they are equal if they have the same
|
||||
|
|
|
@ -8,4 +8,4 @@ part of dart.core;
|
|||
///
|
||||
/// The run-time type of a record object is a record type, and as such, a
|
||||
/// subtype of [Record].
|
||||
abstract class Record {}
|
||||
abstract final class Record {}
|
||||
|
|
|
@ -105,7 +105,7 @@ part of dart.core;
|
|||
/// * [RegExp] to work with regular expressions.
|
||||
/// * [Strings and regular expressions](https://dart.dev/guides/libraries/library-tour#strings-and-regular-expressions)
|
||||
@pragma('vm:entry-point')
|
||||
abstract class String implements Comparable<String>, Pattern {
|
||||
abstract final class String implements Comparable<String>, Pattern {
|
||||
/// Allocates a new string containing the specified [charCodes].
|
||||
///
|
||||
/// The [charCodes] can be both UTF-16 code units and runes.
|
||||
|
|
|
@ -5913,7 +5913,7 @@ class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
|
|||
// items in the MEMBERS set if you want that functionality.
|
||||
}
|
||||
|
||||
abstract class CssStyleDeclarationBase {
|
||||
abstract mixin class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName);
|
||||
void setProperty(String propertyName, String? value, [String? priority]);
|
||||
|
||||
|
@ -37899,7 +37899,7 @@ class _Html5NodeValidator implements NodeValidator {
|
|||
// 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.
|
||||
|
||||
abstract class ImmutableListMixin<E> implements List<E> {
|
||||
abstract mixin class ImmutableListMixin<E> implements List<E> {
|
||||
// From Iterable<$E>:
|
||||
Iterator<E> get iterator {
|
||||
// Note: NodeLists are not fixed size. And most probably length shouldn't
|
||||
|
|
|
@ -9,7 +9,7 @@ part of dart._internal;
|
|||
*
|
||||
* Intended to mix-in on top of [ListMixin] for fixed-length lists.
|
||||
*/
|
||||
abstract class FixedLengthListMixin<E> {
|
||||
mixin FixedLengthListMixin<E> {
|
||||
/** This operation is not supported by a fixed length list. */
|
||||
set length(int newLength) {
|
||||
throw new UnsupportedError(
|
||||
|
@ -84,7 +84,7 @@ abstract class FixedLengthListMixin<E> {
|
|||
* This mixin is intended to be mixed in on top of [ListMixin] on
|
||||
* unmodifiable lists.
|
||||
*/
|
||||
abstract class UnmodifiableListMixin<E> implements List<E> {
|
||||
mixin UnmodifiableListMixin<E> implements List<E> {
|
||||
/** This operation is not supported by an unmodifiable list. */
|
||||
void operator []=(int index, E value) {
|
||||
throw new UnsupportedError("Cannot modify an unmodifiable list");
|
||||
|
|
|
@ -7,7 +7,7 @@ part of dart.io;
|
|||
int _nextServiceId = 1;
|
||||
|
||||
// TODO(ajohnsen): Use other way of getting a unique id.
|
||||
abstract class _ServiceObject {
|
||||
mixin _ServiceObject {
|
||||
int __serviceId = 0;
|
||||
int get _serviceId {
|
||||
if (__serviceId == 0) __serviceId = _nextServiceId++;
|
||||
|
|
|
@ -27,7 +27,7 @@ part "unmodifiable_typed_data.dart";
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// ByteBuffer.
|
||||
abstract class ByteBuffer {
|
||||
abstract final class ByteBuffer {
|
||||
/// Returns the length of this byte buffer, in bytes.
|
||||
int get lengthInBytes;
|
||||
|
||||
|
@ -346,7 +346,7 @@ abstract class ByteBuffer {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// TypedData.
|
||||
abstract class TypedData {
|
||||
abstract final class TypedData {
|
||||
/// Returns the number of bytes in the representation of each element in this
|
||||
/// list.
|
||||
int get elementSizeInBytes;
|
||||
|
@ -361,7 +361,7 @@ abstract class TypedData {
|
|||
ByteBuffer get buffer;
|
||||
}
|
||||
|
||||
abstract class _TypedIntList extends TypedData {
|
||||
abstract final class _TypedIntList extends TypedData {
|
||||
/// Returns the concatenation of this list and [other].
|
||||
///
|
||||
/// If other is also a typed-data integer list, the returned list will
|
||||
|
@ -371,7 +371,7 @@ abstract class _TypedIntList extends TypedData {
|
|||
List<int> operator +(List<int> other);
|
||||
}
|
||||
|
||||
abstract class _TypedFloatList extends TypedData {
|
||||
abstract final class _TypedFloatList extends TypedData {
|
||||
/// Returns the concatenation of this list and [other].
|
||||
///
|
||||
/// If other is also a typed-data floating point number list,
|
||||
|
@ -386,7 +386,7 @@ abstract class _TypedFloatList extends TypedData {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Endian.
|
||||
class Endian {
|
||||
final class Endian {
|
||||
final bool _littleEndian;
|
||||
const Endian._(this._littleEndian);
|
||||
|
||||
|
@ -433,7 +433,7 @@ class Endian {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// ByteData.
|
||||
abstract class ByteData implements TypedData {
|
||||
abstract final class ByteData implements TypedData {
|
||||
/// Creates a [ByteData] of the specified length (in elements), all of
|
||||
/// whose bytes are initially zero.
|
||||
@pragma("vm:entry-point")
|
||||
|
@ -719,7 +719,7 @@ abstract class ByteData implements TypedData {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Int8List.
|
||||
abstract class Int8List implements List<int>, _TypedIntList {
|
||||
abstract final class Int8List implements List<int>, _TypedIntList {
|
||||
/// Creates an [Int8List] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -832,7 +832,7 @@ abstract class Int8List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Uint8List.
|
||||
abstract class Uint8List implements List<int>, _TypedIntList {
|
||||
abstract final class Uint8List implements List<int>, _TypedIntList {
|
||||
/// Creates a [Uint8List] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -952,7 +952,7 @@ abstract class Uint8List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Uint8ClampedList.
|
||||
abstract class Uint8ClampedList implements List<int>, _TypedIntList {
|
||||
abstract final class Uint8ClampedList implements List<int>, _TypedIntList {
|
||||
/// Creates a [Uint8ClampedList] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -1068,7 +1068,7 @@ abstract class Uint8ClampedList implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Int16List.
|
||||
abstract class Int16List implements List<int>, _TypedIntList {
|
||||
abstract final class Int16List implements List<int>, _TypedIntList {
|
||||
/// Creates an [Int16List] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -1193,7 +1193,7 @@ abstract class Int16List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Uint16List.
|
||||
abstract class Uint16List implements List<int>, _TypedIntList {
|
||||
abstract final class Uint16List implements List<int>, _TypedIntList {
|
||||
/// Creates a [Uint16List] of the specified length (in elements), all
|
||||
/// of whose elements are initially zero.
|
||||
///
|
||||
|
@ -1319,7 +1319,7 @@ abstract class Uint16List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Int32List.
|
||||
abstract class Int32List implements List<int>, _TypedIntList {
|
||||
abstract final class Int32List implements List<int>, _TypedIntList {
|
||||
/// Creates an [Int32List] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -1444,7 +1444,7 @@ abstract class Int32List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Uint32List.
|
||||
abstract class Uint32List implements List<int>, _TypedIntList {
|
||||
abstract final class Uint32List implements List<int>, _TypedIntList {
|
||||
/// Creates a [Uint32List] of the specified length (in elements), all
|
||||
/// of whose elements are initially zero.
|
||||
///
|
||||
|
@ -1570,7 +1570,7 @@ abstract class Uint32List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Int64List.
|
||||
abstract class Int64List implements List<int>, _TypedIntList {
|
||||
abstract final class Int64List implements List<int>, _TypedIntList {
|
||||
/// Creates an [Int64List] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -1695,7 +1695,7 @@ abstract class Int64List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Uint64List.
|
||||
abstract class Uint64List implements List<int>, _TypedIntList {
|
||||
abstract final class Uint64List implements List<int>, _TypedIntList {
|
||||
/// Creates a [Uint64List] of the specified length (in elements), all
|
||||
/// of whose elements are initially zero.
|
||||
///
|
||||
|
@ -1822,7 +1822,7 @@ abstract class Uint64List implements List<int>, _TypedIntList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Float32List.
|
||||
abstract class Float32List implements List<double>, _TypedFloatList {
|
||||
abstract final class Float32List implements List<double>, _TypedFloatList {
|
||||
/// Creates a [Float32List] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -1944,7 +1944,7 @@ abstract class Float32List implements List<double>, _TypedFloatList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Float64List.
|
||||
abstract class Float64List implements List<double>, _TypedFloatList {
|
||||
abstract final class Float64List implements List<double>, _TypedFloatList {
|
||||
/// Creates a [Float64List] of the specified length (in elements), all of
|
||||
/// whose elements are initially zero.
|
||||
///
|
||||
|
@ -2062,7 +2062,7 @@ abstract class Float64List implements List<double>, _TypedFloatList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Float32x4List.
|
||||
abstract class Float32x4List implements List<Float32x4>, TypedData {
|
||||
abstract final class Float32x4List implements List<Float32x4>, TypedData {
|
||||
/// Creates a [Float32x4List] of the specified length (in elements),
|
||||
/// all of whose elements are initially zero.
|
||||
///
|
||||
|
@ -2183,7 +2183,7 @@ abstract class Float32x4List implements List<Float32x4>, TypedData {
|
|||
///
|
||||
/// For long lists, this implementation will be considerably more
|
||||
/// space- and time-efficient than the default [List] implementation.
|
||||
abstract class Int32x4List implements List<Int32x4>, TypedData {
|
||||
abstract final class Int32x4List implements List<Int32x4>, TypedData {
|
||||
/// Creates a [Int32x4List] of the specified length (in elements),
|
||||
/// all of whose elements are initially zero.
|
||||
///
|
||||
|
@ -2307,7 +2307,7 @@ abstract class Int32x4List implements List<Int32x4>, TypedData {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Float64x2List.
|
||||
abstract class Float64x2List implements List<Float64x2>, TypedData {
|
||||
abstract final class Float64x2List implements List<Float64x2>, TypedData {
|
||||
/// Creates a [Float64x2List] of the specified length (in elements),
|
||||
/// all of whose elements have all lanes set to zero.
|
||||
///
|
||||
|
@ -2430,7 +2430,7 @@ abstract class Float64x2List implements List<Float64x2>, TypedData {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Float32x4.
|
||||
abstract class Float32x4 {
|
||||
abstract final class Float32x4 {
|
||||
external factory Float32x4(double x, double y, double z, double w);
|
||||
external factory Float32x4.splat(double v);
|
||||
external factory Float32x4.zero();
|
||||
|
@ -2800,7 +2800,7 @@ abstract class Float32x4 {
|
|||
///
|
||||
/// Int32x4 stores 4 32-bit bit-masks in "lanes".
|
||||
/// The lanes are "x", "y", "z", and "w" respectively.
|
||||
abstract class Int32x4 {
|
||||
abstract final class Int32x4 {
|
||||
external factory Int32x4(int x, int y, int z, int w);
|
||||
external factory Int32x4.bool(bool x, bool y, bool z, bool w);
|
||||
external factory Int32x4.fromFloat32x4Bits(Float32x4 x);
|
||||
|
@ -3154,7 +3154,7 @@ abstract class Int32x4 {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// Float64x2.
|
||||
abstract class Float64x2 {
|
||||
abstract final class Float64x2 {
|
||||
external factory Float64x2(double x, double y);
|
||||
external factory Float64x2.splat(double v);
|
||||
external factory Float64x2.zero();
|
||||
|
|
|
@ -8,7 +8,7 @@ part of dart.typed_data;
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableByteBufferView.
|
||||
abstract class UnmodifiableByteBufferView implements ByteBuffer {
|
||||
abstract final class UnmodifiableByteBufferView implements ByteBuffer {
|
||||
external factory UnmodifiableByteBufferView(ByteBuffer data);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ abstract class UnmodifiableByteBufferView implements ByteBuffer {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableByteDataView.
|
||||
abstract class UnmodifiableByteDataView implements ByteData {
|
||||
abstract final class UnmodifiableByteDataView implements ByteData {
|
||||
external factory UnmodifiableByteDataView(ByteData data);
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ abstract class UnmodifiableByteDataView implements ByteData {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableUint8ListView.
|
||||
abstract class UnmodifiableUint8ListView implements Uint8List {
|
||||
abstract final class UnmodifiableUint8ListView implements Uint8List {
|
||||
external factory UnmodifiableUint8ListView(Uint8List list);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ abstract class UnmodifiableUint8ListView implements Uint8List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableInt8ListView.
|
||||
abstract class UnmodifiableInt8ListView implements Int8List {
|
||||
abstract final class UnmodifiableInt8ListView implements Int8List {
|
||||
external factory UnmodifiableInt8ListView(Int8List list);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ abstract class UnmodifiableInt8ListView implements Int8List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableUint8ClampedListView.
|
||||
abstract class UnmodifiableUint8ClampedListView implements Uint8ClampedList {
|
||||
abstract final class UnmodifiableUint8ClampedListView implements Uint8ClampedList {
|
||||
external factory UnmodifiableUint8ClampedListView(Uint8ClampedList list);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ abstract class UnmodifiableUint8ClampedListView implements Uint8ClampedList {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableUint16ListView.
|
||||
abstract class UnmodifiableUint16ListView implements Uint16List {
|
||||
abstract final class UnmodifiableUint16ListView implements Uint16List {
|
||||
external factory UnmodifiableUint16ListView(Uint16List list);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ abstract class UnmodifiableUint16ListView implements Uint16List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableInt16ListView.
|
||||
abstract class UnmodifiableInt16ListView implements Int16List {
|
||||
abstract final class UnmodifiableInt16ListView implements Int16List {
|
||||
external factory UnmodifiableInt16ListView(Int16List list);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ abstract class UnmodifiableInt16ListView implements Int16List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableUint32ListView.
|
||||
abstract class UnmodifiableUint32ListView implements Uint32List {
|
||||
abstract final class UnmodifiableUint32ListView implements Uint32List {
|
||||
external factory UnmodifiableUint32ListView(Uint32List list);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ abstract class UnmodifiableUint32ListView implements Uint32List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableInt32ListView.
|
||||
abstract class UnmodifiableInt32ListView implements Int32List {
|
||||
abstract final class UnmodifiableInt32ListView implements Int32List {
|
||||
external factory UnmodifiableInt32ListView(Int32List list);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ abstract class UnmodifiableInt32ListView implements Int32List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableUint64ListView.
|
||||
abstract class UnmodifiableUint64ListView implements Uint64List {
|
||||
abstract final class UnmodifiableUint64ListView implements Uint64List {
|
||||
external factory UnmodifiableUint64ListView(Uint64List list);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ abstract class UnmodifiableUint64ListView implements Uint64List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableInt64ListView.
|
||||
abstract class UnmodifiableInt64ListView implements Int64List {
|
||||
abstract final class UnmodifiableInt64ListView implements Int64List {
|
||||
external factory UnmodifiableInt64ListView(Int64List list);
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ abstract class UnmodifiableInt64ListView implements Int64List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableInt32x4ListView.
|
||||
abstract class UnmodifiableInt32x4ListView implements Int32x4List {
|
||||
abstract final class UnmodifiableInt32x4ListView implements Int32x4List {
|
||||
external factory UnmodifiableInt32x4ListView(Int32x4List list);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ abstract class UnmodifiableInt32x4ListView implements Int32x4List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableFloat32x4ListView.
|
||||
abstract class UnmodifiableFloat32x4ListView implements Float32x4List {
|
||||
abstract final class UnmodifiableFloat32x4ListView implements Float32x4List {
|
||||
external factory UnmodifiableFloat32x4ListView(Float32x4List list);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ abstract class UnmodifiableFloat32x4ListView implements Float32x4List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableFloat64x2ListView.
|
||||
abstract class UnmodifiableFloat64x2ListView implements Float64x2List {
|
||||
abstract final class UnmodifiableFloat64x2ListView implements Float64x2List {
|
||||
external factory UnmodifiableFloat64x2ListView(Float64x2List list);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ abstract class UnmodifiableFloat64x2ListView implements Float64x2List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableFloat32ListView.
|
||||
abstract class UnmodifiableFloat32ListView implements Float32List {
|
||||
abstract final class UnmodifiableFloat32ListView implements Float32List {
|
||||
external factory UnmodifiableFloat32ListView(Float32List list);
|
||||
}
|
||||
|
||||
|
@ -128,6 +128,6 @@ abstract class UnmodifiableFloat32ListView implements Float32List {
|
|||
///
|
||||
/// It is a compile-time error for a class to attempt to extend or implement
|
||||
/// UnmodifiableFloat64ListView.
|
||||
abstract class UnmodifiableFloat64ListView implements Float64List {
|
||||
abstract final class UnmodifiableFloat64ListView implements Float64List {
|
||||
external factory UnmodifiableFloat64ListView(Float64List list);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// 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.
|
||||
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
// Introduce an aliased type.
|
||||
|
@ -14,12 +13,32 @@ typedef T<X> = Function;
|
|||
abstract class C {
|
||||
final T<Null> v7;
|
||||
|
||||
C(): v7 = T();
|
||||
C() : v7 = T();
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
}
|
||||
|
||||
class D1<X> extends T<X> {}
|
||||
// ^^^^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
abstract class D2 extends C with T<int> {}
|
||||
// ^^^^^^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
abstract class D3<X, Y> implements T<T> {}
|
||||
// ^^^^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
abstract class D4 = C with T<void>;
|
||||
// ^^^^^^^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
X foo<X>(X x) => x;
|
||||
|
||||
main() {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// 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.
|
||||
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
// Introduce an aliased type.
|
||||
|
@ -27,7 +26,7 @@ abstract class C {
|
|||
List<T<T>> v6 = [];
|
||||
final T<Null> v7;
|
||||
|
||||
C(): v7 = print;
|
||||
C() : v7 = print;
|
||||
C.name1(this.v5, this.v7);
|
||||
factory C.name2(T<C> arg1, T<Null> arg2) = C1.name1;
|
||||
|
||||
|
@ -43,11 +42,6 @@ class C1 implements C {
|
|||
noSuchMethod(Invocation invocation) => throw 0;
|
||||
}
|
||||
|
||||
class D1<X> extends T<X> {}
|
||||
abstract class D2 extends C with T<int> {}
|
||||
abstract class D3<X, Y> implements T<T> {}
|
||||
abstract class D4 = C with T<void>;
|
||||
|
||||
extension E on T<dynamic> {
|
||||
T<dynamic> foo(T<dynamic> t) => t;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,17 @@ abstract class C {
|
|||
// [cfe] unspecified
|
||||
}
|
||||
|
||||
abstract class D2 extends C with T {}
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
abstract class D4 = C with T;
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
|
||||
X foo<X>(X x) => x;
|
||||
|
||||
main() {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// @dart = 2.9
|
||||
// Requirements=nnbd-weak
|
||||
|
||||
|
||||
// Test that a generic type alias `T` denoting `Function`
|
||||
// can give rise to the expected erros.
|
||||
|
||||
|
@ -47,12 +46,8 @@ class C1 implements C {
|
|||
|
||||
class D1<X> extends T<X> {}
|
||||
|
||||
abstract class D2 extends C with T<int> {}
|
||||
|
||||
abstract class D3<X, Y> implements T<T> {}
|
||||
|
||||
abstract class D4 = C with T<void>;
|
||||
|
||||
extension E on T<dynamic> {
|
||||
T<dynamic> foo(T<dynamic> t) => t;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// @dart = 2.9
|
||||
// Requirements=nnbd-weak
|
||||
|
||||
|
||||
// Test that a type alias `T` denoting `Function` can be used.
|
||||
|
||||
import 'usage_function_lib.dart';
|
||||
|
@ -45,12 +44,8 @@ class C1 implements C {
|
|||
|
||||
class D1 extends T {}
|
||||
|
||||
abstract class D2 extends C with T {}
|
||||
|
||||
abstract class D3 implements T {}
|
||||
|
||||
abstract class D4 = C with T;
|
||||
|
||||
extension E on T {
|
||||
T foo(T t) => t;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// 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.
|
||||
|
||||
|
||||
// Introduce an aliased type.
|
||||
|
||||
typedef T = Function;
|
||||
|
@ -12,12 +11,32 @@ typedef T = Function;
|
|||
abstract class C {
|
||||
final T v12;
|
||||
|
||||
C(): v12 = T();
|
||||
C() : v12 = T();
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
}
|
||||
|
||||
class D1<X> extends T {}
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
abstract class D2 extends C with T {}
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
abstract class D3<X, Y> implements T {}
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
abstract class D4 = C with T;
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
X foo<X>(X x) => x;
|
||||
|
||||
main() {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// 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.
|
||||
|
||||
|
||||
// Introduce an aliased type.
|
||||
|
||||
typedef T = Function;
|
||||
|
@ -25,7 +24,7 @@ abstract class C {
|
|||
List<T> v11 = [];
|
||||
final T v12;
|
||||
|
||||
C(): v12 = (() {});
|
||||
C() : v12 = (() {});
|
||||
C.name1(this.v10, this.v12);
|
||||
factory C.name2(T arg1, T arg2) = C1.name1;
|
||||
|
||||
|
@ -41,14 +40,6 @@ class C1 implements C {
|
|||
noSuchMethod(Invocation invocation) => throw 0;
|
||||
}
|
||||
|
||||
// Awaiting updates in front end to handle crash caused by null from
|
||||
// `ClassHierarchyBuilder.getKernelTypeAsInstanceOf`. So for now the
|
||||
// following are multi-test cases, so that the rest can be tested.
|
||||
class D1 extends T {} //# 01: ok
|
||||
abstract class D2 extends C with T {} //# 02: ok
|
||||
abstract class D3 implements T {} //# 03: ok
|
||||
abstract class D4 = C with T; //# 04: ok
|
||||
|
||||
extension E on T {
|
||||
T foo(T t) => t;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
|
|||
// items in the MEMBERS set if you want that functionality.
|
||||
}
|
||||
|
||||
abstract class CssStyleDeclarationBase {
|
||||
abstract mixin class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName);
|
||||
void setProperty(String propertyName, String$NULLABLE value,
|
||||
[String$NULLABLE priority]);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
part of dart.dom.html;
|
||||
|
||||
abstract class ImmutableListMixin<E> implements List<E> {
|
||||
abstract mixin class ImmutableListMixin<E> implements List<E> {
|
||||
// From Iterable<$E>:
|
||||
Iterator<E> get iterator {
|
||||
// Note: NodeLists are not fixed size. And most probably length shouldn't
|
||||
|
|
|
@ -1855,7 +1855,7 @@ class _CssStyleDeclarationSet extends Object with CssStyleDeclarationBase {
|
|||
// items in the MEMBERS set if you want that functionality.
|
||||
}
|
||||
|
||||
abstract class CssStyleDeclarationBase {
|
||||
abstract mixin class CssStyleDeclarationBase {
|
||||
String getPropertyValue(String propertyName);
|
||||
void setProperty(String propertyName, String$NULLABLE value,
|
||||
[String$NULLABLE priority]);
|
||||
|
|
|
@ -142,9 +142,11 @@ features:
|
|||
|
||||
sealed-class:
|
||||
help: "Sealed class"
|
||||
experimentalReleaseVersion: "3.0.0"
|
||||
|
||||
class-modifiers:
|
||||
help: "Class modifiers"
|
||||
experimentalReleaseVersion: "3.0.0"
|
||||
|
||||
# Experiment flag only used for testing.
|
||||
test-experiment:
|
||||
|
|
Loading…
Reference in a new issue