mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:19:48 +00:00
[cfe/flip-modifiers] Remove error for Function completely. Rely on its modifier errors.
Change-Id: I2532f24b360ea0a2f7afb92f3393719a16fa15e3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286957 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Kallen Tu <kallentu@google.com>
This commit is contained in:
parent
82237f9483
commit
7bae7294c9
|
@ -4045,16 +4045,6 @@ const MessageCode messageExpressionNotMetadata = const MessageCode(
|
|||
problemMessage:
|
||||
r"""This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeExtendFunction = messageExtendFunction;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageExtendFunction = const MessageCode("ExtendFunction",
|
||||
problemMessage:
|
||||
r"""Extending 'Function' is deprecated because 'Function' is final class.""",
|
||||
correctionMessage:
|
||||
r"""Try removing 'Function' from the 'extends' clause.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<Message Function(String name)> templateExtendingEnum =
|
||||
const Template<Message Function(String name)>(
|
||||
|
@ -5662,17 +5652,6 @@ const MessageCode messageIllegalSyncGeneratorVoidReturnType = const MessageCode(
|
|||
problemMessage:
|
||||
r"""Functions marked 'sync*' can't have return type 'void'.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeImplementFunction = messageImplementFunction;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageImplementFunction = const MessageCode(
|
||||
"ImplementFunction",
|
||||
problemMessage:
|
||||
r"""Implementing 'Function' is deprecated because 'Function' is final class.""",
|
||||
correctionMessage:
|
||||
r"""Try removing 'Function' from the 'implements' clause.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeImplementsBeforeExtends = messageImplementsBeforeExtends;
|
||||
|
||||
|
@ -9006,15 +8985,6 @@ const MessageCode messageMixinDeclaresConstructor = const MessageCode(
|
|||
index: 95,
|
||||
problemMessage: r"""Mixins can't declare constructors.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Code<Null> codeMixinFunction = messageMixinFunction;
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const MessageCode messageMixinFunction = const MessageCode("MixinFunction",
|
||||
problemMessage:
|
||||
r"""Mixing in 'Function' is deprecated because 'Function' is final class.""",
|
||||
correctionMessage: r"""Try removing 'Function' from the 'with' clause.""");
|
||||
|
||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
const Template<
|
||||
Message Function(
|
||||
|
|
|
@ -237,10 +237,6 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
}
|
||||
Supertype? supertype = supertypeBuilder?.buildSupertype(libraryBuilder);
|
||||
if (_isFunction(supertype, coreLibrary)) {
|
||||
if (libraryBuilder.libraryFeatures.classModifiers.isEnabled) {
|
||||
libraryBuilder.addProblem(
|
||||
messageExtendFunction, charOffset, noLength, fileUri);
|
||||
}
|
||||
supertype = null;
|
||||
supertypeBuilder = null;
|
||||
}
|
||||
|
@ -269,10 +265,6 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
Supertype? mixedInType =
|
||||
mixedInTypeBuilder?.buildMixedInType(libraryBuilder);
|
||||
if (_isFunction(mixedInType, coreLibrary)) {
|
||||
if (libraryBuilder.libraryFeatures.classModifiers.isEnabled) {
|
||||
libraryBuilder.addProblem(
|
||||
messageMixinFunction, charOffset, noLength, fileUri);
|
||||
}
|
||||
mixedInType = null;
|
||||
mixedInTypeBuilder = null;
|
||||
actualCls.isAnonymousMixin = false;
|
||||
|
@ -323,10 +315,6 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
interfaceBuilders![i].buildSupertype(libraryBuilder);
|
||||
if (supertype != null) {
|
||||
if (_isFunction(supertype, coreLibrary)) {
|
||||
if (libraryBuilder.libraryFeatures.classModifiers.isEnabled) {
|
||||
libraryBuilder.addProblem(
|
||||
messageImplementFunction, charOffset, noLength, fileUri);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// TODO(ahe): Report an error if supertype is null.
|
||||
|
|
|
@ -301,7 +301,6 @@ ExportOptOutFromOptIn/analyzerCode: Fail
|
|||
ExportOptOutFromOptIn/part_wrapped_script: Fail
|
||||
ExpressionNotMetadata/analyzerCode: Fail
|
||||
ExpressionNotMetadata/example: Fail
|
||||
ExtendFunction/analyzerCode: Fail
|
||||
ExtendingEnum/example: Fail
|
||||
ExtendingRestricted/example: Fail
|
||||
ExtendsDynamic/analyzerCode: Fail # Feature not yet in analyzer.
|
||||
|
@ -446,7 +445,6 @@ IllegalRecursiveType/analyzerCode: Fail
|
|||
IllegalRecursiveType/part_wrapped_script: Fail
|
||||
IllegalRecursiveType/script: Fail
|
||||
IllegalSyncGeneratorVoidReturnType/analyzerCode: Fail # The analyzer doesn't report this error.
|
||||
ImplementFunction/analyzerCode: Fail
|
||||
ImplementsBeforeExtends/part_wrapped_script: Fail
|
||||
ImplementsBeforeExtends/script: Fail
|
||||
ImplementsBeforeOn/part_wrapped_script: Fail
|
||||
|
@ -674,9 +672,6 @@ MissingMain/example: Fail
|
|||
MissingPartOf/part_wrapped_script: Fail # Using 'part' in the (now) part.
|
||||
MissingPrefixInDeferredImport/example: Fail
|
||||
MixinDeclaresConstructor/example: Fail
|
||||
MixinFunction/analyzerCode: Fail
|
||||
MixinFunction/part_wrapped_script: Fail
|
||||
MixinFunction/script: Fail
|
||||
MixinInferenceNoMatchingClass/example: Fail
|
||||
ModifierOutOfOrder/part_wrapped_script1: Fail
|
||||
ModifierOutOfOrder/script1: Fail
|
||||
|
|
|
@ -5479,27 +5479,6 @@ ExportOptOutFromOptIn:
|
|||
// @dart=2.5
|
||||
class A {}
|
||||
|
||||
ExtendFunction:
|
||||
problemMessage: "Extending 'Function' is deprecated because 'Function' is final class."
|
||||
correctionMessage: "Try removing 'Function' from the 'extends' clause."
|
||||
experiments: class-modifiers
|
||||
script: |
|
||||
class A extends Function {}
|
||||
|
||||
ImplementFunction:
|
||||
problemMessage: "Implementing 'Function' is deprecated because 'Function' is final class."
|
||||
correctionMessage: "Try removing 'Function' from the 'implements' clause."
|
||||
experiments: class-modifiers
|
||||
script: |
|
||||
class A implements Function {}
|
||||
|
||||
MixinFunction:
|
||||
problemMessage: "Mixing in 'Function' is deprecated because 'Function' is final class."
|
||||
correctionMessage: "Try removing 'Function' from the 'with' clause."
|
||||
experiments: class-modifiers
|
||||
script: |
|
||||
class A extends Object with Function {}
|
||||
|
||||
CannotAssignToFinalVariable:
|
||||
problemMessage: "Can't assign to the final variable '#name'."
|
||||
script: |
|
||||
|
|
|
@ -24,30 +24,11 @@ library /*isNonNullableByDefault*/;
|
|||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:14: Error: The mixin 'Function' can't be mixed-in outside of its library because it's a final mixin.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: The type 'C' must be 'base', 'final' or 'sealed' because the supertype 'Function' is 'final'.
|
||||
// Try adding 'base', 'final', or 'sealed' to the type.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:5:7: Error: Extending 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'extends' clause.
|
||||
// class A extends Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:7:7: Error: Implementing 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'implements' clause.
|
||||
// class B implements Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: Mixing in 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'with' clause.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -24,30 +24,11 @@ library /*isNonNullableByDefault*/;
|
|||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:14: Error: The mixin 'Function' can't be mixed-in outside of its library because it's a final mixin.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: The type 'C' must be 'base', 'final' or 'sealed' because the supertype 'Function' is 'final'.
|
||||
// Try adding 'base', 'final', or 'sealed' to the type.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:5:7: Error: Extending 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'extends' clause.
|
||||
// class A extends Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:7:7: Error: Implementing 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'implements' clause.
|
||||
// class B implements Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: Mixing in 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'with' clause.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -24,30 +24,11 @@ library /*isNonNullableByDefault*/;
|
|||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:14: Error: The mixin 'Function' can't be mixed-in outside of its library because it's a final mixin.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: The type 'C' must be 'base', 'final' or 'sealed' because the supertype 'Function' is 'final'.
|
||||
// Try adding 'base', 'final', or 'sealed' to the type.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:5:7: Error: Extending 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'extends' clause.
|
||||
// class A extends Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:7:7: Error: Implementing 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'implements' clause.
|
||||
// class B implements Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: Mixing in 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'with' clause.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -24,30 +24,11 @@ library /*isNonNullableByDefault*/;
|
|||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:14: Error: The mixin 'Function' can't be mixed-in outside of its library because it's a final mixin.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: The type 'C' must be 'base', 'final' or 'sealed' because the supertype 'Function' is 'final'.
|
||||
// Try adding 'base', 'final', or 'sealed' to the type.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:5:7: Error: Extending 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'extends' clause.
|
||||
// class A extends Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:7:7: Error: Implementing 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'implements' clause.
|
||||
// class B implements Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: Mixing in 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'with' clause.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -24,30 +24,11 @@ library /*isNonNullableByDefault*/;
|
|||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:14: Error: The mixin 'Function' can't be mixed-in outside of its library because it's a final mixin.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: The type 'C' must be 'base', 'final' or 'sealed' because the supertype 'Function' is 'final'.
|
||||
// Try adding 'base', 'final', or 'sealed' to the type.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:5:7: Error: Extending 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'extends' clause.
|
||||
// class A extends Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:7:7: Error: Implementing 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'implements' clause.
|
||||
// class B implements Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: Mixing in 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'with' clause.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -24,30 +24,11 @@ library /*isNonNullableByDefault*/;
|
|||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:14: Error: The mixin 'Function' can't be mixed-in outside of its library because it's a final mixin.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: The type 'C' must be 'base', 'final' or 'sealed' because the supertype 'Function' is 'final'.
|
||||
// Try adding 'base', 'final', or 'sealed' to the type.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:5:7: Error: Extending 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'extends' clause.
|
||||
// class A extends Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:7:7: Error: Implementing 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'implements' clause.
|
||||
// class B implements Function {}
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/class_modifiers/subtype_function.dart:9:7: Error: Mixing in 'Function' is deprecated because 'Function' is final class.
|
||||
// Try removing 'Function' from the 'with' clause.
|
||||
// class C with Function {}
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// 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
|
||||
|
||||
import "dart:core" as core;
|
||||
|
||||
class A implements core.Function {
|
||||
|
@ -19,4 +21,4 @@ class Function {
|
|||
core.bool operator ==(core.Object other) => false;
|
||||
}
|
||||
|
||||
main() {}
|
||||
main() {}
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:18:7: Error: Can't use 'Function' as a name here.
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:20:7: Error: Can't use 'Function' as a name here.
|
||||
// class Function {
|
||||
// ^^^^^^^^
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:18:7: Error: Can't use 'Function' as a name here.
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:20:7: Error: Can't use 'Function' as a name here.
|
||||
// class Function {
|
||||
// ^^^^^^^^
|
||||
//
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @dart = 2.19
|
||||
import "dart:core" as core;
|
||||
|
||||
class A implements core.Function {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @dart = 2.19
|
||||
import "dart:core" as core;
|
||||
|
||||
class A implements core.Function {
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:18:7: Error: Can't use 'Function' as a name here.
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:20:7: Error: Can't use 'Function' as a name here.
|
||||
// class Function {
|
||||
// ^^^^^^^^
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:18:7: Error: Can't use 'Function' as a name here.
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:20:7: Error: Can't use 'Function' as a name here.
|
||||
// class Function {
|
||||
// ^^^^^^^^
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:18:7: Error: Can't use 'Function' as a name here.
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:20:7: Error: Can't use 'Function' as a name here.
|
||||
// class Function {
|
||||
// ^^^^^^^^
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:18:7: Error: Can't use 'Function' as a name here.
|
||||
// pkg/front_end/testcases/general/ignore_function.dart:20:7: Error: Can't use 'Function' as a name here.
|
||||
// class Function {
|
||||
// ^^^^^^^^
|
||||
//
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// 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
|
||||
|
||||
class A implements Function {}
|
||||
|
||||
class B extends Function {}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @dart = 2.19
|
||||
class A implements Function {}
|
||||
|
||||
class B extends Function {}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// @dart = 2.19
|
||||
class A implements Function {}
|
||||
|
||||
class B extends Function {}
|
||||
|
|
Loading…
Reference in a new issue