mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Remove duplicate 'DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS' already reported by fasta
Fixes #39524 Change-Id: Iaf1c095a9f80809cb8b7e0edd966ab1b22c89abc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127544 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
06c60481da
commit
c01b52cb0f
6 changed files with 0 additions and 36 deletions
|
@ -126,7 +126,6 @@ const List<ErrorCode> errorCodeValues = [
|
|||
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
|
||||
CompileTimeErrorCode.DEFAULT_LIST_CONSTRUCTOR_MISMATCH,
|
||||
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER,
|
||||
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS,
|
||||
CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR,
|
||||
CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER,
|
||||
CompileTimeErrorCode.DEFERRED_IMPORT_OF_EXTENSION,
|
||||
|
|
|
@ -1182,15 +1182,6 @@ class CompileTimeErrorCode extends AnalyzerErrorCode {
|
|||
"length because the initial values would all be 'null'.",
|
||||
correction: "Try removing the argument or using 'List.filled'.");
|
||||
|
||||
/**
|
||||
* 15.3.1 Typedef: It is a compile-time error if any default values are
|
||||
* specified in the signature of a function type alias.
|
||||
*/
|
||||
static const CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS =
|
||||
CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS',
|
||||
"Default parameter values aren't allowed in typedefs.",
|
||||
correction: "Try removing the default value.");
|
||||
|
||||
/**
|
||||
* 6.2.1 Required Formals: By means of a function signature that names the
|
||||
* parameter and describes its type as a function type. It is a compile-time
|
||||
|
|
|
@ -879,7 +879,6 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
|
|||
void visitFunctionTypeAlias(FunctionTypeAlias node) {
|
||||
_checkForBuiltInIdentifierAsName(
|
||||
node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
|
||||
_checkForDefaultValueInFunctionTypeAlias(node);
|
||||
_checkForTypeAliasCannotReferenceItself(node, node.declaredElement);
|
||||
super.visitFunctionTypeAlias(node);
|
||||
}
|
||||
|
@ -2584,25 +2583,6 @@ class ErrorVerifier extends RecursiveAstVisitor<void> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that there are no default parameters in the given function type
|
||||
* [alias].
|
||||
*
|
||||
* See [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS].
|
||||
*/
|
||||
void _checkForDefaultValueInFunctionTypeAlias(FunctionTypeAlias alias) {
|
||||
FormalParameterList formalParameterList = alias.parameters;
|
||||
NodeList<FormalParameter> parameters = formalParameterList.parameters;
|
||||
for (FormalParameter parameter in parameters) {
|
||||
if (parameter is DefaultFormalParameter) {
|
||||
if (parameter.defaultValue != null) {
|
||||
_errorReporter.reportErrorForNode(
|
||||
CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the given default formal [parameter] is not part of a function
|
||||
* typed parameter.
|
||||
|
|
|
@ -1037,7 +1037,6 @@ typedef F = int Function([Map<String, String> m = const {}]);
|
|||
await assertErrorsInCode('''
|
||||
typedef F([x = 0]);
|
||||
''', [
|
||||
error(CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, 0, 19),
|
||||
error(ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE, 13, 1),
|
||||
]);
|
||||
}
|
||||
|
@ -1046,7 +1045,6 @@ typedef F([x = 0]);
|
|||
await assertErrorsInCode('''
|
||||
typedef F([x = 0]);
|
||||
''', [
|
||||
error(CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, 0, 19),
|
||||
error(ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE, 13, 1),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ class TypeTester<T> {}
|
|||
// Expect compile-time error as no default values are allowed
|
||||
// in closure type definitions.
|
||||
typedef void Callback([String msg = ""]);
|
||||
// [error line 10, column 1, length 41]
|
||||
// [analyzer] COMPILE_TIME_ERROR.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS
|
||||
// ^
|
||||
// [analyzer] SYNTACTIC_ERROR.DEFAULT_VALUE_IN_FUNCTION_TYPE
|
||||
// [cfe] Can't have a default value in a function type.
|
||||
|
|
|
@ -8,8 +8,6 @@ import "package:expect/expect.dart";
|
|||
|
||||
// Default values are not allowed on typedefs.
|
||||
typedef F1({x = 3, y});
|
||||
// [error line 10, column 1, length 23]
|
||||
// [analyzer] COMPILE_TIME_ERROR.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS
|
||||
// ^
|
||||
// [analyzer] SYNTACTIC_ERROR.DEFAULT_VALUE_IN_FUNCTION_TYPE
|
||||
// [cfe] Can't have a default value in a function type.
|
||||
|
|
Loading…
Reference in a new issue