Simplify errors on invalid arguments

Change-Id: I1bd94725b4e4e44e706c6d22543bbea22649ec69
Reviewed-on: https://dart-review.googlesource.com/55680
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
This commit is contained in:
Aske Simon Christensen 2018-05-22 11:14:22 +00:00 committed by commit-bot@chromium.org
parent 7ab9ea0e4e
commit e191d4feb5
11 changed files with 112 additions and 353 deletions

View file

@ -1025,30 +1025,6 @@ const MessageCode messageConstMethod = const MessageCode("ConstMethod",
r"""Getters, setters and methods can't be declared to be 'const'.""",
tip: r"""Try removing the 'const' keyword.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(String name)>
templateConstructorHasNoSuchNamedParameter =
const Template<Message Function(String name)>(
messageTemplate:
r"""Constructor has no named parameter with the name '#name'.""",
withArguments: _withArgumentsConstructorHasNoSuchNamedParameter);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)>
codeConstructorHasNoSuchNamedParameter =
const Code<Message Function(String name)>(
"ConstructorHasNoSuchNamedParameter",
templateConstructorHasNoSuchNamedParameter,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsConstructorHasNoSuchNamedParameter(String name) {
return new Message(codeConstructorHasNoSuchNamedParameter,
message: """Constructor has no named parameter with the name '$name'.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateConstructorNotFound =
const Template<Message Function(String name)>(
@ -2558,27 +2534,6 @@ const MessageCode messageForInLoopNotAssignable = const MessageCode(
message:
r"""Can't assign to this, so it can't be used in a for-in loop.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(String name)> templateFunctionHasNoSuchNamedParameter =
const Template<Message Function(String name)>(
messageTemplate:
r"""Function has no named parameter with the name '#name'.""",
withArguments: _withArgumentsFunctionHasNoSuchNamedParameter);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeFunctionHasNoSuchNamedParameter =
const Code<Message Function(String name)>("FunctionHasNoSuchNamedParameter",
templateFunctionHasNoSuchNamedParameter,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsFunctionHasNoSuchNamedParameter(String name) {
return new Message(codeFunctionHasNoSuchNamedParameter,
message: """Function has no named parameter with the name '$name'.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeFunctionTypeDefaultValue = messageFunctionTypeDefaultValue;
@ -3873,27 +3828,6 @@ const MessageCode messageMetadataTypeArguments = const MessageCode(
dart2jsCode: "*ignored*",
message: r"""An annotation (metadata) can't use type arguments.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(String name)> templateMethodHasNoSuchNamedParameter =
const Template<Message Function(String name)>(
messageTemplate:
r"""Method has no named parameter with the name '#name'.""",
withArguments: _withArgumentsMethodHasNoSuchNamedParameter);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeMethodHasNoSuchNamedParameter =
const Code<Message Function(String name)>(
"MethodHasNoSuchNamedParameter", templateMethodHasNoSuchNamedParameter,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsMethodHasNoSuchNamedParameter(String name) {
return new Message(codeMethodHasNoSuchNamedParameter,
message: """Method has no named parameter with the name '$name'.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateMethodNotFound =
const Template<Message Function(String name)>(
@ -4264,6 +4198,25 @@ Message _withArgumentsNoFormals(Token token) {
arguments: {'token': token});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)> templateNoSuchNamedParameter =
const Template<Message Function(String name)>(
messageTemplate: r"""No named parameter with the name '#name'.""",
withArguments: _withArgumentsNoSuchNamedParameter);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(String name)> codeNoSuchNamedParameter =
const Code<Message Function(String name)>(
"NoSuchNamedParameter", templateNoSuchNamedParameter,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsNoSuchNamedParameter(String name) {
return new Message(codeNoSuchNamedParameter,
message: """No named parameter with the name '$name'.""",
arguments: {'name': name});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeNoUnnamedConstructorInObject =
messageNoUnnamedConstructorInObject;
@ -5626,24 +5579,23 @@ const Template<
Message Function(
int count,
int
count2)> templateTooFewArgumentsToConstructor = const Template<
count2)> templateTooFewArguments = const Template<
Message Function(int count, int count2)>(
messageTemplate:
r"""Too few positional arguments to constructor: #count required, #count2 given.""",
withArguments: _withArgumentsTooFewArgumentsToConstructor);
r"""Too few positional arguments: #count required, #count2 given.""",
withArguments: _withArgumentsTooFewArguments);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(int count, int count2)>
codeTooFewArgumentsToConstructor =
const Code<Message Function(int count, int count2)> codeTooFewArguments =
const Code<Message Function(int count, int count2)>(
"TooFewArgumentsToConstructor", templateTooFewArgumentsToConstructor,
"TooFewArguments", templateTooFewArguments,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTooFewArgumentsToConstructor(int count, int count2) {
return new Message(codeTooFewArgumentsToConstructor,
Message _withArgumentsTooFewArguments(int count, int count2) {
return new Message(codeTooFewArguments,
message:
"""Too few positional arguments to constructor: $count required, $count2 given.""",
"""Too few positional arguments: $count required, $count2 given.""",
arguments: {'count': count, 'count2': count2});
}
@ -5652,128 +5604,23 @@ const Template<
Message Function(
int count,
int
count2)> templateTooFewArgumentsToFunction = const Template<
count2)> templateTooManyArguments = const Template<
Message Function(int count, int count2)>(
messageTemplate:
r"""Too few positional arguments to function: #count required, #count2 given.""",
withArguments: _withArgumentsTooFewArgumentsToFunction);
r"""Too many positional arguments: #count allowed, #count2 given.""",
withArguments: _withArgumentsTooManyArguments);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(int count, int count2)>
codeTooFewArgumentsToFunction =
const Code<Message Function(int count, int count2)> codeTooManyArguments =
const Code<Message Function(int count, int count2)>(
"TooFewArgumentsToFunction", templateTooFewArgumentsToFunction,
"TooManyArguments", templateTooManyArguments,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTooFewArgumentsToFunction(int count, int count2) {
return new Message(codeTooFewArgumentsToFunction,
Message _withArgumentsTooManyArguments(int count, int count2) {
return new Message(codeTooManyArguments,
message:
"""Too few positional arguments to function: $count required, $count2 given.""",
arguments: {'count': count, 'count2': count2});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
int count,
int
count2)> templateTooFewArgumentsToMethod = const Template<
Message Function(int count, int count2)>(
messageTemplate:
r"""Too few positional arguments to method: #count required, #count2 given.""",
withArguments: _withArgumentsTooFewArgumentsToMethod);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(int count, int count2)>
codeTooFewArgumentsToMethod =
const Code<Message Function(int count, int count2)>(
"TooFewArgumentsToMethod", templateTooFewArgumentsToMethod,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTooFewArgumentsToMethod(int count, int count2) {
return new Message(codeTooFewArgumentsToMethod,
message:
"""Too few positional arguments to method: $count required, $count2 given.""",
arguments: {'count': count, 'count2': count2});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
int count,
int
count2)> templateTooManyArgumentsToConstructor = const Template<
Message Function(int count, int count2)>(
messageTemplate:
r"""Too many positional arguments to constructor: #count allowed, #count2 given.""",
withArguments: _withArgumentsTooManyArgumentsToConstructor);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(int count, int count2)>
codeTooManyArgumentsToConstructor =
const Code<Message Function(int count, int count2)>(
"TooManyArgumentsToConstructor", templateTooManyArgumentsToConstructor,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTooManyArgumentsToConstructor(int count, int count2) {
return new Message(codeTooManyArgumentsToConstructor,
message:
"""Too many positional arguments to constructor: $count allowed, $count2 given.""",
arguments: {'count': count, 'count2': count2});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
int count,
int
count2)> templateTooManyArgumentsToFunction = const Template<
Message Function(int count, int count2)>(
messageTemplate:
r"""Too many positional arguments to function: #count allowed, #count2 given.""",
withArguments: _withArgumentsTooManyArgumentsToFunction);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(int count, int count2)>
codeTooManyArgumentsToFunction =
const Code<Message Function(int count, int count2)>(
"TooManyArgumentsToFunction", templateTooManyArgumentsToFunction,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTooManyArgumentsToFunction(int count, int count2) {
return new Message(codeTooManyArgumentsToFunction,
message:
"""Too many positional arguments to function: $count allowed, $count2 given.""",
arguments: {'count': count, 'count2': count2});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
int count,
int
count2)> templateTooManyArgumentsToMethod = const Template<
Message Function(int count, int count2)>(
messageTemplate:
r"""Too many positional arguments to method: #count allowed, #count2 given.""",
withArguments: _withArgumentsTooManyArgumentsToMethod);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Message Function(int count, int count2)>
codeTooManyArgumentsToMethod =
const Code<Message Function(int count, int count2)>(
"TooManyArgumentsToMethod", templateTooManyArgumentsToMethod,
severity: Severity.errorLegacyWarning);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsTooManyArgumentsToMethod(int count, int count2) {
return new Message(codeTooManyArgumentsToMethod,
message:
"""Too many positional arguments to method: $count allowed, $count2 given.""",
"""Too many positional arguments: $count allowed, $count2 given.""",
arguments: {'count': count, 'count2': count2});
}

View file

@ -85,10 +85,8 @@ import 'constness.dart' show Constness;
import 'expression_generator.dart'
show
BuilderHelper,
CalleeDesignation,
DeferredAccessGenerator,
ErroneousExpressionGenerator,
FunctionTypeAccessor,
Generator,
IncompleteError,
IncompletePropertyAccessor,
@ -802,10 +800,7 @@ abstract class BodyBuilder<Expression, Statement, Arguments>
Initializer initializer;
Arguments arguments = forest.argumentsEmpty(noLocation);
if (superTarget == null ||
checkArguments(
new FunctionTypeAccessor.fromNode(superTarget.function),
arguments,
CalleeDesignation.Constructor,
checkArgumentsForFunction(superTarget.function, arguments,
builder.charOffset, const <TypeParameter>[]) !=
null) {
String superclass = classBuilder.supertype.fullNameForErrors;
@ -2600,15 +2595,8 @@ abstract class BodyBuilder<Expression, Statement, Arguments>
assert(!target.enclosingClass.isAbstract);
typeParameters = target.enclosingClass.typeParameters;
}
CalleeDesignation calleeKind = target is Constructor
? CalleeDesignation.Constructor
: CalleeDesignation.Method;
LocatedMessage argMessage = checkArguments(
new FunctionTypeAccessor.fromNode(target.function),
arguments,
calleeKind,
charOffset,
typeParameters);
LocatedMessage argMessage = checkArgumentsForFunction(
target.function, arguments, charOffset, typeParameters);
if (argMessage != null) {
return throwNoSuchMethodError(
storeOffset(forest.literalNull(null), charOffset),
@ -2654,65 +2642,29 @@ abstract class BodyBuilder<Expression, Statement, Arguments>
}
@override
LocatedMessage checkArguments(FunctionTypeAccessor function,
Arguments arguments, CalleeDesignation calleeKind, int offset,
[List<TypeParameter> typeParameters]) {
LocatedMessage checkArgumentsForFunction(FunctionNode function,
Arguments arguments, int offset, List<TypeParameter> typeParameters) {
if (forest.argumentsPositional(arguments).length <
function.requiredParameterCount) {
Template<Message Function(int count, int count2)> template;
switch (calleeKind) {
case CalleeDesignation.Function:
template = fasta.templateTooFewArgumentsToFunction;
break;
case CalleeDesignation.Method:
template = fasta.templateTooFewArgumentsToMethod;
break;
case CalleeDesignation.Constructor:
template = fasta.templateTooFewArgumentsToConstructor;
break;
}
return template
return fasta.templateTooFewArguments
.withArguments(function.requiredParameterCount,
forest.argumentsPositional(arguments).length)
.withLocation(uri, offset, noLength);
}
if (forest.argumentsPositional(arguments).length >
function.positionalParameterCount) {
Template<Message Function(int count, int count2)> template;
switch (calleeKind) {
case CalleeDesignation.Function:
template = fasta.templateTooManyArgumentsToFunction;
break;
case CalleeDesignation.Method:
template = fasta.templateTooManyArgumentsToMethod;
break;
case CalleeDesignation.Constructor:
template = fasta.templateTooManyArgumentsToConstructor;
break;
}
return template
.withArguments(function.positionalParameterCount,
function.positionalParameters.length) {
return fasta.templateTooManyArguments
.withArguments(function.positionalParameters.length,
forest.argumentsPositional(arguments).length)
.withLocation(uri, offset, noLength);
}
List named = forest.argumentsNamed(arguments);
if (named.isNotEmpty) {
Set<String> names = function.namedParameterNames;
Set<String> names =
new Set.from(function.namedParameters.map((a) => a.name));
for (NamedExpression argument in named) {
if (!names.remove(argument.name)) {
Template<Message Function(String name)> template;
switch (calleeKind) {
case CalleeDesignation.Function:
template = fasta.templateFunctionHasNoSuchNamedParameter;
break;
case CalleeDesignation.Method:
template = fasta.templateMethodHasNoSuchNamedParameter;
break;
case CalleeDesignation.Constructor:
template = fasta.templateConstructorHasNoSuchNamedParameter;
break;
}
return template
return fasta.templateNoSuchNamedParameter
.withArguments(argument.name)
.withLocation(uri, argument.fileOffset, argument.name.length);
}
@ -2720,7 +2672,7 @@ abstract class BodyBuilder<Expression, Statement, Arguments>
}
List types = forest.argumentsTypeArguments(arguments);
if (typeParameters != null && typeParameters.length != types.length) {
if (typeParameters.length != types.length) {
// TODO(paulberry): Report error in this case as well,
// after https://github.com/dart-lang/sdk/issues/32130 is fixed.
types.clear();
@ -2732,6 +2684,39 @@ abstract class BodyBuilder<Expression, Statement, Arguments>
return null;
}
@override
LocatedMessage checkArgumentsForType(
FunctionType function, Arguments arguments, int offset) {
if (forest.argumentsPositional(arguments).length <
function.requiredParameterCount) {
return fasta.templateTooFewArguments
.withArguments(function.requiredParameterCount,
forest.argumentsPositional(arguments).length)
.withLocation(uri, offset, noLength);
}
if (forest.argumentsPositional(arguments).length >
function.positionalParameters.length) {
return fasta.templateTooManyArguments
.withArguments(function.positionalParameters.length,
forest.argumentsPositional(arguments).length)
.withLocation(uri, offset, noLength);
}
List named = forest.argumentsNamed(arguments);
if (named.isNotEmpty) {
Set<String> names =
new Set.from(function.namedParameters.map((a) => a.name));
for (NamedExpression argument in named) {
if (!names.remove(argument.name)) {
return fasta.templateNoSuchNamedParameter
.withArguments(argument.name)
.withLocation(uri, argument.fileOffset, argument.name.length);
}
}
}
return null;
}
@override
void beginNewExpression(Token token) {
debugEvent("beginNewExpression");

View file

@ -1709,11 +1709,8 @@ class ThisAccessGenerator<Arguments> extends Generator<Arguments> {
Constructor constructor = helper.lookupConstructor(name, isSuper: isSuper);
LocatedMessage argMessage;
if (constructor != null) {
argMessage = helper.checkArguments(
new FunctionTypeAccessor.fromNode(constructor.function),
arguments,
CalleeDesignation.Constructor,
offset, <TypeParameter>[]);
argMessage = helper.checkArgumentsForFunction(
constructor.function, arguments, offset, <TypeParameter>[]);
}
if (constructor == null || argMessage != null) {
return helper.buildInvalidInitializer(

View file

@ -63,9 +63,11 @@ abstract class BuilderHelper<Expression, Statement, Arguments> {
bool isStatic,
LocatedMessage argMessage});
LocatedMessage checkArguments(FunctionTypeAccessor function,
Arguments arguments, CalleeDesignation calleeKind, int offset,
[List<TypeParameter> typeParameters]);
LocatedMessage checkArgumentsForFunction(FunctionNode function,
Arguments arguments, int offset, List<TypeParameter> typeParameters);
LocatedMessage checkArgumentsForType(
FunctionType function, Arguments arguments, int offset);
StaticGet makeStaticGet(Member readTarget, Token token);
@ -111,35 +113,6 @@ abstract class BuilderHelper<Expression, Statement, Arguments> {
T storeOffset<T>(T node, int offset);
}
// The name used to refer to a call target kind
enum CalleeDesignation { Function, Method, Constructor }
// Abstraction over FunctionNode and FunctionType to access the
// number and names of parameters.
class FunctionTypeAccessor {
int requiredParameterCount;
int positionalParameterCount;
List _namedParameters;
Set<String> get namedParameterNames {
return new Set.from(_namedParameters.map((a) => a.name));
}
factory FunctionTypeAccessor.fromNode(FunctionNode node) {
return new FunctionTypeAccessor._(node.requiredParameterCount,
node.positionalParameters.length, node.namedParameters);
}
factory FunctionTypeAccessor.fromType(FunctionType type) {
return new FunctionTypeAccessor._(type.requiredParameterCount,
type.positionalParameters.length, type.namedParameters);
}
FunctionTypeAccessor._(this.requiredParameterCount,
this.positionalParameterCount, this._namedParameters);
}
class IncompleteError<Arguments> extends IncompleteSendGenerator<Arguments>
with ErroneousExpressionGenerator<Arguments> {
final Message message;

View file

@ -62,8 +62,7 @@ import '../../base/instrumentation.dart'
import '../fasta_codes.dart';
import '../kernel/expression_generator.dart'
show BuilderHelper, CalleeDesignation, FunctionTypeAccessor, buildIsNull;
import '../kernel/expression_generator.dart' show BuilderHelper, buildIsNull;
import '../kernel/kernel_shadow_ast.dart'
show
@ -1057,14 +1056,8 @@ abstract class TypeInferrerImpl extends TypeInferrer {
arguments.types.addAll(inferredTypes);
}
if (typeChecksNeeded && !identical(calleeType, unknownFunction)) {
CalleeDesignation calleeKind = receiverType is FunctionType
? CalleeDesignation.Function
: CalleeDesignation.Method;
LocatedMessage argMessage = helper.checkArguments(
new FunctionTypeAccessor.fromType(calleeType),
arguments,
calleeKind,
offset);
LocatedMessage argMessage =
helper.checkArgumentsForType(calleeType, arguments, offset);
if (argMessage != null) {
helper.addProblem(
argMessage.messageObject, argMessage.charOffset, argMessage.length);

View file

@ -83,8 +83,6 @@ ConstEvalInvalidType/example: Fail
ConstEvalNonConstantLiteral/dart2jsCode: Fail
ConstEvalNonConstantLiteral/example: Fail
ConstFieldWithoutInitializer/example: Fail
ConstructorHasNoSuchNamedParameter/analyzerCode: Fail
ConstructorHasNoSuchNamedParameter/example: Fail
ConstructorNotFound/analyzerCode: Fail
ConstructorNotFound/example: Fail
ContinueOutsideOfLoop/script1: Fail
@ -195,8 +193,6 @@ ForInLoopExactlyOneVariable/analyzerCode: Fail # The analyzer doesn't recover we
ForInLoopExactlyOneVariable/statement: Fail # Fasta reports too many errors.
ForInLoopNotAssignable/analyzerCode: Fail # The analyzer reports a different error.
ForInLoopNotAssignable/statement: Fail
FunctionHasNoSuchNamedParameter/analyzerCode: Fail
FunctionHasNoSuchNamedParameter/example: Fail
FunctionTypeDefaultValue/example: Fail
FunctionTypedParameterVar/script1: Fail
GeneratorReturnsValue/example: Fail
@ -258,8 +254,6 @@ MemberWithSameNameAsClass/analyzerCode: Fail
MemberWithSameNameAsClass/example: Fail
MetadataTypeArguments/analyzerCode: Fail
MetadataTypeArguments/example: Fail
MethodHasNoSuchNamedParameter/analyzerCode: Fail
MethodHasNoSuchNamedParameter/example: Fail
MethodNotFound/analyzerCode: Fail
MethodNotFound/example: Fail
MissingAssignableSelector/script1: Fail
@ -280,6 +274,8 @@ MultipleWith/script: Fail
NamedFunctionExpression/example: Fail
NativeClauseShouldBeAnnotation/example: Fail
NoFormals/example: Fail
NoSuchNamedParameter/analyzerCode: Fail
NoSuchNamedParameter/example: Fail
NoUnnamedConstructorInObject/analyzerCode: Fail
NoUnnamedConstructorInObject/example: Fail
NonAsciiIdentifier/expression: Fail
@ -388,18 +384,10 @@ ThisAccessInFieldInitializer/analyzerCode: Fail
ThisAccessInFieldInitializer/example: Fail
ThisAsIdentifier/analyzerCode: Fail
ThisAsIdentifier/example: Fail
TooFewArgumentsToConstructor/analyzerCode: Fail
TooFewArgumentsToConstructor/example: Fail
TooFewArgumentsToFunction/analyzerCode: Fail
TooFewArgumentsToFunction/example: Fail
TooFewArgumentsToMethod/analyzerCode: Fail
TooFewArgumentsToMethod/example: Fail
TooManyArgumentsToConstructor/analyzerCode: Fail
TooManyArgumentsToConstructor/example: Fail
TooManyArgumentsToFunction/analyzerCode: Fail
TooManyArgumentsToFunction/example: Fail
TooManyArgumentsToMethod/analyzerCode: Fail
TooManyArgumentsToMethod/example: Fail
TooFewArguments/analyzerCode: Fail
TooFewArguments/example: Fail
TooManyArguments/analyzerCode: Fail
TooManyArguments/example: Fail
TopLevelOperator/script1: Fail
TopLevelOperator/script2: Fail
TopLevelOperator/script3: Fail

View file

@ -1065,40 +1065,16 @@ CandidateFoundIsDefaultConstructor:
template: "The class '#name' has a constructor that takes no arguments."
severity: CONTEXT
TooFewArgumentsToFunction:
template: "Too few positional arguments to function: #count required, #count2 given."
TooFewArguments:
template: "Too few positional arguments: #count required, #count2 given."
severity: ERROR_LEGACY_WARNING
TooFewArgumentsToMethod:
template: "Too few positional arguments to method: #count required, #count2 given."
TooManyArguments:
template: "Too many positional arguments: #count allowed, #count2 given."
severity: ERROR_LEGACY_WARNING
TooFewArgumentsToConstructor:
template: "Too few positional arguments to constructor: #count required, #count2 given."
severity: ERROR_LEGACY_WARNING
TooManyArgumentsToFunction:
template: "Too many positional arguments to function: #count allowed, #count2 given."
severity: ERROR_LEGACY_WARNING
TooManyArgumentsToMethod:
template: "Too many positional arguments to method: #count allowed, #count2 given."
severity: ERROR_LEGACY_WARNING
TooManyArgumentsToConstructor:
template: "Too many positional arguments to constructor: #count allowed, #count2 given."
severity: ERROR_LEGACY_WARNING
FunctionHasNoSuchNamedParameter:
template: "Function has no named parameter with the name '#name'."
severity: ERROR_LEGACY_WARNING
MethodHasNoSuchNamedParameter:
template: "Method has no named parameter with the name '#name'."
severity: ERROR_LEGACY_WARNING
ConstructorHasNoSuchNamedParameter:
template: "Constructor has no named parameter with the name '#name'."
NoSuchNamedParameter:
template: "No named parameter with the name '#name'."
severity: ERROR_LEGACY_WARNING
AbstractClassInstantiation:

View file

@ -423,13 +423,13 @@ Try removing '+'.
super.m -= 42;
^", "pkg/front_end/testcases/rasta/super.dart:248:15: Error: Superclass has no setter named 'm'.
use(super.m -= 42);
^", "pkg/front_end/testcases/rasta/super.dart:147:11: Error: Too many positional arguments to method: 0 allowed, 1 given.
^", "pkg/front_end/testcases/rasta/super.dart:147:11: Error: Too many positional arguments: 0 allowed, 1 given.
super.m(87);
^", "pkg/front_end/testcases/rasta/super.dart:148:15: Error: Too many positional arguments to method: 0 allowed, 1 given.
^", "pkg/front_end/testcases/rasta/super.dart:148:15: Error: Too many positional arguments: 0 allowed, 1 given.
use(super.m(87));
^", "pkg/front_end/testcases/rasta/super.dart:149:11: Error: Too many positional arguments to method: 0 allowed, 1 given.
^", "pkg/front_end/testcases/rasta/super.dart:149:11: Error: Too many positional arguments: 0 allowed, 1 given.
super.n(87);
^", "pkg/front_end/testcases/rasta/super.dart:150:15: Error: Too many positional arguments to method: 0 allowed, 1 given.
^", "pkg/front_end/testcases/rasta/super.dart:150:15: Error: Too many positional arguments: 0 allowed, 1 given.
use(super.n(87));
^"]/* from null */;
static method use(dynamic x) → dynamic {

View file

@ -17,9 +17,9 @@ static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/re
A.foo() : m = 2;
^", "pkg/front_end/testcases/regress/issue_31299.dart:11:7: Error: Conflicts with constructor 'A.foo'.
int foo(int a, int b) => a + b * m;
^", "pkg/front_end/testcases/regress/issue_31299.dart:18:7: Error: Too many positional arguments to constructor: 0 allowed, 2 given.
^", "pkg/front_end/testcases/regress/issue_31299.dart:18:7: Error: Too many positional arguments: 0 allowed, 2 given.
new A.foo(1, 2);
^", "pkg/front_end/testcases/regress/issue_31299.dart:15:11: Error: Too few positional arguments to method: 2 required, 0 given.
^", "pkg/front_end/testcases/regress/issue_31299.dart:15:11: Error: Too few positional arguments: 2 required, 0 given.
new A().foo();
^"]/* from null */;
static method test() → dynamic {

View file

@ -357,9 +357,9 @@ static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/su
super.m -= 42;
^", "pkg/front_end/testcases/super_rasta_copy.dart:232:15: Error: Superclass has no setter named 'm'.
use(super.m -= 42);
^", "pkg/front_end/testcases/super_rasta_copy.dart:139:11: Error: Too many positional arguments to method: 0 allowed, 1 given.
^", "pkg/front_end/testcases/super_rasta_copy.dart:139:11: Error: Too many positional arguments: 0 allowed, 1 given.
super.m(87);
^", "pkg/front_end/testcases/super_rasta_copy.dart:140:15: Error: Too many positional arguments to method: 0 allowed, 1 given.
^", "pkg/front_end/testcases/super_rasta_copy.dart:140:15: Error: Too many positional arguments: 0 allowed, 1 given.
use(super.m(87));
^"]/* from null */;
static method use(dynamic x) → dynamic {

View file

@ -1622,7 +1622,7 @@ TEST_CASE(IsolateReload_TearOff_Parameter_Count_Mismatch) {
if (TestCase::UsingStrongMode()) {
error =
"file:///test-lib:8:12: Error: Too few positional"
" arguments to function: 1 required, 0 given.\n"
" arguments: 1 required, 0 given.\n"
" return f1();";
} else if (TestCase::UsingDartFrontend()) {
error =