diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart index 5c293556767..9b8f4842990 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/add_missing_parameter.dart @@ -12,10 +12,11 @@ import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; class AddMissingParameter extends MultiCorrectionProducer { @override Iterable get producers sync* { - if (node is! ArgumentList) { + // node is the unmatched argument. + if (node.parent is! ArgumentList) { return; } - var context = ExecutableParameters(sessionHelper, node.parent); + var context = ExecutableParameters(sessionHelper, node.parent.parent); if (context == null) { return; } @@ -65,7 +66,8 @@ abstract class _AddMissingParameter extends CorrectionProducer { Future _addParameter( ChangeBuilder builder, int offset, String prefix, String suffix) async { - ArgumentList argumentList = node; + // node is the unmatched argument. + ArgumentList argumentList = node.parent; List arguments = argumentList.arguments; var numRequired = context.required.length; if (numRequired >= arguments.length) { diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart index ce315d9d44f..5f627013756 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_named_arguments.dart @@ -16,7 +16,8 @@ class ConvertToNamedArguments extends CorrectionProducer { @override Future compute(ChangeBuilder builder) async { - var argumentList = node; + // node is the unmatched argument. + var argumentList = node.parent; if (argumentList is ArgumentList) { // Prepare parameters. List parameters; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart index af90fd1e8fd..4e397d410d7 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart @@ -24,8 +24,10 @@ class CreateConstructor extends CorrectionProducer { @override Future compute(ChangeBuilder builder) async { - if (node is ArgumentList && node.parent is InstanceCreationExpression) { - await _proposeFromInstanceCreation(builder); + final argumentList = node.parent is ArgumentList ? node.parent : node; + if (argumentList is ArgumentList && + argumentList.parent is InstanceCreationExpression) { + await _proposeFromInstanceCreation(builder, argumentList.parent); } else { await _proposeFromConstructorName(builder); } @@ -90,8 +92,8 @@ class CreateConstructor extends CorrectionProducer { }); } - Future _proposeFromInstanceCreation(ChangeBuilder builder) async { - InstanceCreationExpression instanceCreation = node.parent; + Future _proposeFromInstanceCreation(ChangeBuilder builder, + InstanceCreationExpression instanceCreation) async { _constructorName = instanceCreation.constructorName; // should be synthetic default constructor var constructorElement = _constructorName.staticElement; diff --git a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart index 7ecd51ed161..efe93db2b57 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/data_driven.dart @@ -82,6 +82,8 @@ class DataDriven extends MultiCorrectionProducer { return nameFromParent(node); } else if (node is ArgumentList) { return nameFromParent(node); + } else if (node?.parent is ArgumentList) { + return nameFromParent(node.parent); } return null; } diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart index 054de2a778c..c7345c3e50f 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_template.dart @@ -86,6 +86,8 @@ class TemplateContext { static AstNode _getInvocation(AstNode node) { if (node is ArgumentList) { return node.parent; + } else if (node.parent is ArgumentList) { + return node.parent.parent; } else if (node is InstanceCreationExpression || node is InvocationExpression) { return node; diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart index b73a574e8ab..32d0b8e02f7 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/modify_parameters.dart @@ -238,6 +238,9 @@ class ModifyParameters extends Change<_Data> { if (argumentList is ArgumentList) { return _Data(argumentList); } + } else if (parent?.parent is InvocationExpression) { + var argumentList = (parent.parent as InvocationExpression).argumentList; + return _Data(argumentList); } return null; } diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart index 84018fc88e7..db09ca094fa 100644 --- a/pkg/analyzer/lib/src/error/codes.dart +++ b/pkg/analyzer/lib/src/error/codes.dart @@ -3445,7 +3445,7 @@ class CompileTimeErrorCode extends AnalyzerErrorCode { // ```dart // void f(int a, int b) {} // void g() { - // f[!(1, 2, 3)!]; + // f(1, 2, [!3!]); // } // ``` // @@ -3486,7 +3486,7 @@ class CompileTimeErrorCode extends AnalyzerErrorCode { // %language=2.9 // void f(int a, int b, {int c}) {} // void g() { - // f[!(1, 2, 3)!]; + // f(1, 2, [!3!]); // } // ``` // diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart index 4ffeb7e0f54..2112e2d1c77 100644 --- a/pkg/analyzer/lib/src/generated/resolver.dart +++ b/pkg/analyzer/lib/src/generated/resolver.dart @@ -2215,7 +2215,8 @@ class ResolverVisitor extends ScopedVisitor { /// correspond to the list of arguments. /// /// An error will be reported to [onError] if any of the arguments cannot be - /// matched to a parameter. onError can be null to ignore the error. + /// matched to a parameter. onError will be provided the node of the first + /// argument that is not matched. onError can be null to ignore the error. /// /// Returns the parameters that correspond to the arguments. If no parameter /// matched an argument, that position will be `null` in the list. @@ -2254,6 +2255,7 @@ class ResolverVisitor extends ScopedVisitor { int positionalArgumentCount = 0; HashSet usedNames; bool noBlankArguments = true; + Expression firstUnresolvedArgument; for (int i = 0; i < argumentCount; i++) { Expression argument = arguments[i]; if (argument is NamedExpression) { @@ -2284,6 +2286,8 @@ class ResolverVisitor extends ScopedVisitor { positionalArgumentCount++; if (unnamedIndex < unnamedParameterCount) { resolvedParameters[i] = unnamedParameters[unnamedIndex++]; + } else { + firstUnresolvedArgument ??= argument; } } } @@ -2304,7 +2308,7 @@ class ResolverVisitor extends ScopedVisitor { errorCode = CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS; } if (onError != null) { - onError(errorCode, argumentList, + onError(errorCode, firstUnresolvedArgument, [unnamedParameterCount, positionalArgumentCount]); } } diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart index 7ed306da18d..bf3ee80216c 100644 --- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart +++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart @@ -1039,7 +1039,7 @@ class B extends A { CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, 71, 3), - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 74, 3), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 75, 1), ]); assertMethodInvocation2( @@ -1348,7 +1348,7 @@ main() { } ''', [ error(HintCode.UNUSED_IMPORT, 7, 11), - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 65, 7), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 66, 5), ]); var import = findElement.importFind('dart:math'); diff --git a/pkg/analyzer/test/src/diagnostics/extra_positional_arguments_test.dart b/pkg/analyzer/test/src/diagnostics/extra_positional_arguments_test.dart index 8bb30fbf746..6e7326321b2 100644 --- a/pkg/analyzer/test/src/diagnostics/extra_positional_arguments_test.dart +++ b/pkg/analyzer/test/src/diagnostics/extra_positional_arguments_test.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analyzer/src/error/codes.dart'; +import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; import 'package:test_reflective_loader/test_reflective_loader.dart'; import '../dart/resolution/context_collection_resolution.dart'; @@ -26,8 +27,8 @@ main() { const A(0); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 50, - 3), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 51, + 1), ]); } @@ -40,8 +41,8 @@ class B extends A { const B() : super(0); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 71, - 3), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 72, + 1), ]); } @@ -51,8 +52,8 @@ main() { (int x, {int y}) {} (0, 1); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 31, - 6), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 35, + 1), ]); } @@ -63,8 +64,23 @@ main() { f(0, 1, '2'); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 25, - 11), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 26, + 1), + ]); + } + + test_partiallyTypedName() async { + await assertErrorsInCode(r''' +f({int xx, int yy, int zz}) {} + +main() { + f(xx: 1, yy: 2, z); +} +''', [ + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED, 59, + 1), + error(ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT, 59, 1), + error(CompileTimeErrorCode.UNDEFINED_IDENTIFIER, 59, 1), ]); } } @@ -80,7 +96,7 @@ main() { const A(0); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 43, 3), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 44, 1), ]); } @@ -93,7 +109,7 @@ class B extends A { const B() : super(0); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 64, 3), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 65, 1), ]); } @@ -103,7 +119,7 @@ main() { (int x) {} (0, 1); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 22, 6), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 26, 1), ]); } @@ -114,7 +130,7 @@ main() { f(0, 1, '2'); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 19, 11), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 20, 1), ]); } } diff --git a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart index 1bb51ac062e..a5c4ffc1b63 100644 --- a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart +++ b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart @@ -324,7 +324,7 @@ void f(Never? x) { x.toString(1 + 2); } ''', [ - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 31, 7), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 32, 5), ]); assertMethodInvocation( diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart index c8fda9d9af6..256431b55d2 100644 --- a/pkg/analyzer/test/src/task/strong/checker_test.dart +++ b/pkg/analyzer/test/src/task/strong/checker_test.dart @@ -2278,11 +2278,11 @@ main() { } ''', [ error(HintCode.UNUSED_LOCAL_VARIABLE, 71, 1), - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 117, 9), - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 137, 15), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 124, 1), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 148, 3), error(CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS, 159, 3), error(CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS, 173, 5), - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 189, 9), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 196, 1), error(CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 190, 1), error(CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 193, 1), error(CompileTimeErrorCode.NOT_ENOUGH_POSITIONAL_ARGUMENTS, 209, 3), diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart index b7e16005424..b182fa79db7 100644 --- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart +++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart @@ -689,7 +689,7 @@ main() { } ''', [ error(HintCode.UNUSED_LOCAL_VARIABLE, 29, 1), - error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 38, 4), + error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 39, 2), ]); var a = findLocalVariable(_resultUnit, 'a'); diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md index d395869436f..a4e58e0a59b 100644 --- a/pkg/analyzer/tool/diagnostics/diagnostics.md +++ b/pkg/analyzer/tool/diagnostics/diagnostics.md @@ -3149,7 +3149,7 @@ parameters but is invoked with 3 arguments: {% prettify dart tag=pre+code %} void f(int a, int b) {} void g() { - f[!(1, 2, 3)!]; + f(1, 2, [!3!]); } {% endprettify %} @@ -3183,7 +3183,7 @@ third argument: {% prettify dart tag=pre+code %} void f(int a, int b, {int c}) {} void g() { - f[!(1, 2, 3)!]; + f(1, 2, [!3!]); } {% endprettify %} diff --git a/tests/language/call/method_implicit_invoke_local_test.dart b/tests/language/call/method_implicit_invoke_local_test.dart index 1e58c475550..0e15829e4e8 100644 --- a/tests/language/call/method_implicit_invoke_local_test.dart +++ b/tests/language/call/method_implicit_invoke_local_test.dart @@ -32,7 +32,8 @@ main() { // [analyzer] COMPILE_TIME_ERROR.NOT_ENOUGH_POSITIONAL_ARGUMENTS // [cfe] Too few positional arguments: 1 required, 0 given. c2(3, 4); - //^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + //^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language/compile_time_constant/arguments_test.dart b/tests/language/compile_time_constant/arguments_test.dart index 70d7fd3b464..ca56413f265 100644 --- a/tests/language/compile_time_constant/arguments_test.dart +++ b/tests/language/compile_time_constant/arguments_test.dart @@ -15,8 +15,9 @@ main() { // [analyzer] COMPILE_TIME_ERROR.NOT_ENOUGH_POSITIONAL_ARGUMENTS // [cfe] Too few positional arguments: 1 required, 0 given. const A(1, 2); - // ^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. const A.named(); const A.named(b: 1); @@ -34,7 +35,8 @@ main() { const A.optional(); const A.optional(42); const A.optional(42, 54); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language/constructor/constructor13_test.dart b/tests/language/constructor/constructor13_test.dart index f6790eca580..24b8841bd20 100644 --- a/tests/language/constructor/constructor13_test.dart +++ b/tests/language/constructor/constructor13_test.dart @@ -16,7 +16,8 @@ main() { // [cfe] Too few positional arguments: 1 required, 0 given. new Klass(1); new Klass(1, 2); - // ^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language/constructor/no_such_constructor_test.dart b/tests/language/constructor/no_such_constructor_test.dart index b1062739298..28c05a6d0fc 100644 --- a/tests/language/constructor/no_such_constructor_test.dart +++ b/tests/language/constructor/no_such_constructor_test.dart @@ -8,7 +8,8 @@ class A { main() { new A(42); - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. } diff --git a/tests/language/constructor/redirect2_test.dart b/tests/language/constructor/redirect2_test.dart index 30d7ab6c0f1..85fc2340537 100644 --- a/tests/language/constructor/redirect2_test.dart +++ b/tests/language/constructor/redirect2_test.dart @@ -32,8 +32,9 @@ class A { // ^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.SUPER_IN_REDIRECTING_CONSTRUCTOR // [cfe] A redirecting constructor can't have other initializers. - // ^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. } diff --git a/tests/language/deferred/load_library_wrong_args_test.dart b/tests/language/deferred/load_library_wrong_args_test.dart index c991e2e66a6..3903e19c1f9 100644 --- a/tests/language/deferred/load_library_wrong_args_test.dart +++ b/tests/language/deferred/load_library_wrong_args_test.dart @@ -5,6 +5,6 @@ void main() { lib.loadLibrary(10); //^ // [cfe] 'loadLibrary' takes no arguments. -// ^^^^ +// ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS } diff --git a/tests/language/instance/call_wrong_argument_count_test.dart b/tests/language/instance/call_wrong_argument_count_test.dart index 8f0c7100a7f..62560510567 100644 --- a/tests/language/instance/call_wrong_argument_count_test.dart +++ b/tests/language/instance/call_wrong_argument_count_test.dart @@ -14,7 +14,8 @@ main() { var niederhorn = Niederhorn(); niederhorn.goodCall(1, 2, 3); niederhorn.goodCall(1, 2, 3, 4); - // ^^^^^^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^^^^^ // [cfe] Too many positional arguments: 3 allowed, but 4 found. } diff --git a/tests/language/mixin/illegal_constructor_test.dart b/tests/language/mixin/illegal_constructor_test.dart index 864889f5aad..a4a8723ea03 100644 --- a/tests/language/mixin/illegal_constructor_test.dart +++ b/tests/language/mixin/illegal_constructor_test.dart @@ -97,16 +97,18 @@ main() { new D6(); new C0(1,2,3); - // ^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^ // [cfe] Too many positional arguments: 0 allowed, but 3 found. new C0.named(); // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.NEW_WITH_UNDEFINED_CONSTRUCTOR // [cfe] Method not found: 'C0.named'. new D0(1,2,3); - // ^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^ // [cfe] Too many positional arguments: 0 allowed, but 3 found. new D0.named(); // ^^^^^ diff --git a/tests/language/parameter/bad_named_parameters_test.dart b/tests/language/parameter/bad_named_parameters_test.dart index 35b1e790f3e..9db032b3452 100644 --- a/tests/language/parameter/bad_named_parameters_test.dart +++ b/tests/language/parameter/bad_named_parameters_test.dart @@ -20,14 +20,16 @@ main() { // Parameter b passed twice. np.f42(10, 25, b: 25); - // ^^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. // Parameter x does not exist. np.f42(10, 25, x: 99); - // ^^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_NAMED_PARAMETER @@ -40,8 +42,9 @@ main() { // Too many parameters. np.f42(10, 20, 30, 40); - // ^^^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 4 found. // Too few parameters. diff --git a/tests/language/parameter/named_aggregated_test.dart b/tests/language/parameter/named_aggregated_test.dart index 87e6140e83c..252f67d96c4 100644 --- a/tests/language/parameter/named_aggregated_test.dart +++ b/tests/language/parameter/named_aggregated_test.dart @@ -37,8 +37,9 @@ class NamedParametersAggregatedTests { main() { // Expect compile-time error due to missing comma in function definition. NamedParametersAggregatedTests.f_missing_comma(10, 25); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. // Expect compile-time error due to duplicate named argument. diff --git a/tests/language/parameter/optional_named_test.dart b/tests/language/parameter/optional_named_test.dart index 20413ad5020..56f2adfc3f5 100644 --- a/tests/language/parameter/optional_named_test.dart +++ b/tests/language/parameter/optional_named_test.dart @@ -63,36 +63,42 @@ class OptionalNamedParametersTest { Expect.equals(20, F10()); Expect.equals(20, np.f21()); Expect.equals(20, F10(20)); - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. Expect.equals(20, np.f21(20)); - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. Expect.equals(20, F10(b: 20)); Expect.equals(20, np.f21(b: 20)); Expect.equals(1020, F21(10)); Expect.equals(1020, np.f32(10)); Expect.equals(1025, F21(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(1025, np.f32(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(1025, F21(10, b: 25)); Expect.equals(1025, np.f32(10, b: 25)); Expect.equals(102030, F31(10)); Expect.equals(102030, np.f42(10)); Expect.equals(102530, F31(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102530, np.f42(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102530, F31(10, b: 25)); Expect.equals(102530, np.f42(10, b: 25)); @@ -101,12 +107,14 @@ class OptionalNamedParametersTest { Expect.equals(102535, F31(10, b: 25, c: 35)); Expect.equals(102535, np.f42(10, b: 25, c: 35)); Expect.equals(102535, F31(10, 25, c:35)); - // ^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102535, np.f42(10, 25, c:35)); - // ^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102535, F31(10, c: 35, b: 25)); Expect.equals(102535, np.f42(10, c: 35, b: 25)); @@ -116,8 +124,9 @@ class OptionalNamedParametersTest { Expect.equals(10203540, np.f52(10, c: 35)); Expect.equals(10250045, F41(10, d: 45, b: 25)); Expect.equals(10250045, F41(10, 25, d:45)); - // ^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(10250045, np.f52(10, d: 45, b: 25)); Expect.equals(10253545, F41(10, d: 45, c: 35, b: 25)); diff --git a/tests/language/redirecting/factory_default_values_test.dart b/tests/language/redirecting/factory_default_values_test.dart index 84a7d170a7a..23a0e3c8973 100644 --- a/tests/language/redirecting/factory_default_values_test.dart +++ b/tests/language/redirecting/factory_default_values_test.dart @@ -33,7 +33,8 @@ main() { Expect.equals(x.b, 0); var y = new A.f(42, 43); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language/regress/regress35258_test.dart b/tests/language/regress/regress35258_test.dart index d36f45f87fc..a5707b06894 100644 --- a/tests/language/regress/regress35258_test.dart +++ b/tests/language/regress/regress35258_test.dart @@ -6,7 +6,7 @@ main() { new C(42); // ^ // [cfe] Can't use 'C' because it is declared more than once. - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS } diff --git a/tests/language/static/call_wrong_argument_count_test.dart b/tests/language/static/call_wrong_argument_count_test.dart index 575c4862b59..ca34e7cd1ad 100644 --- a/tests/language/static/call_wrong_argument_count_test.dart +++ b/tests/language/static/call_wrong_argument_count_test.dart @@ -13,7 +13,8 @@ main() { Niesen.goodCall(1, 2, 3); Niesen.goodCall(1, 2, 3, 4); - // ^^^^^^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^^^^^ // [cfe] Too many positional arguments: 3 allowed, but 4 found. } diff --git a/tests/language_2/call/method_implicit_invoke_local_test.dart b/tests/language_2/call/method_implicit_invoke_local_test.dart index 1e58c475550..0e15829e4e8 100644 --- a/tests/language_2/call/method_implicit_invoke_local_test.dart +++ b/tests/language_2/call/method_implicit_invoke_local_test.dart @@ -32,7 +32,8 @@ main() { // [analyzer] COMPILE_TIME_ERROR.NOT_ENOUGH_POSITIONAL_ARGUMENTS // [cfe] Too few positional arguments: 1 required, 0 given. c2(3, 4); - //^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + //^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language_2/compile_time_constant/arguments_test.dart b/tests/language_2/compile_time_constant/arguments_test.dart index 70d7fd3b464..ca56413f265 100644 --- a/tests/language_2/compile_time_constant/arguments_test.dart +++ b/tests/language_2/compile_time_constant/arguments_test.dart @@ -15,8 +15,9 @@ main() { // [analyzer] COMPILE_TIME_ERROR.NOT_ENOUGH_POSITIONAL_ARGUMENTS // [cfe] Too few positional arguments: 1 required, 0 given. const A(1, 2); - // ^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. const A.named(); const A.named(b: 1); @@ -34,7 +35,8 @@ main() { const A.optional(); const A.optional(42); const A.optional(42, 54); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language_2/constructor/constructor13_test.dart b/tests/language_2/constructor/constructor13_test.dart index f6790eca580..24b8841bd20 100644 --- a/tests/language_2/constructor/constructor13_test.dart +++ b/tests/language_2/constructor/constructor13_test.dart @@ -16,7 +16,8 @@ main() { // [cfe] Too few positional arguments: 1 required, 0 given. new Klass(1); new Klass(1, 2); - // ^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language_2/constructor/no_such_constructor_test.dart b/tests/language_2/constructor/no_such_constructor_test.dart index b1062739298..28c05a6d0fc 100644 --- a/tests/language_2/constructor/no_such_constructor_test.dart +++ b/tests/language_2/constructor/no_such_constructor_test.dart @@ -8,7 +8,8 @@ class A { main() { new A(42); - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. } diff --git a/tests/language_2/constructor/redirect2_test.dart b/tests/language_2/constructor/redirect2_test.dart index 30d7ab6c0f1..85fc2340537 100644 --- a/tests/language_2/constructor/redirect2_test.dart +++ b/tests/language_2/constructor/redirect2_test.dart @@ -32,8 +32,9 @@ class A { // ^^^^^^^^ // [analyzer] COMPILE_TIME_ERROR.SUPER_IN_REDIRECTING_CONSTRUCTOR // [cfe] A redirecting constructor can't have other initializers. - // ^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. } diff --git a/tests/language_2/deferred/load_library_wrong_args_test.dart b/tests/language_2/deferred/load_library_wrong_args_test.dart index c991e2e66a6..3903e19c1f9 100644 --- a/tests/language_2/deferred/load_library_wrong_args_test.dart +++ b/tests/language_2/deferred/load_library_wrong_args_test.dart @@ -5,6 +5,6 @@ void main() { lib.loadLibrary(10); //^ // [cfe] 'loadLibrary' takes no arguments. -// ^^^^ +// ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS } diff --git a/tests/language_2/instance/call_wrong_argument_count_test.dart b/tests/language_2/instance/call_wrong_argument_count_test.dart index 8f0c7100a7f..62560510567 100644 --- a/tests/language_2/instance/call_wrong_argument_count_test.dart +++ b/tests/language_2/instance/call_wrong_argument_count_test.dart @@ -14,7 +14,8 @@ main() { var niederhorn = Niederhorn(); niederhorn.goodCall(1, 2, 3); niederhorn.goodCall(1, 2, 3, 4); - // ^^^^^^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^^^^^ // [cfe] Too many positional arguments: 3 allowed, but 4 found. } diff --git a/tests/language_2/mixin/illegal_constructor_test.dart b/tests/language_2/mixin/illegal_constructor_test.dart index b70f7647ca6..ea13e2a337b 100644 --- a/tests/language_2/mixin/illegal_constructor_test.dart +++ b/tests/language_2/mixin/illegal_constructor_test.dart @@ -97,16 +97,18 @@ main() { new D6(); new C0(1,2,3); - // ^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^ // [cfe] Too many positional arguments: 0 allowed, but 3 found. new C0.named(); // ^^^^^ // [analyzer] COMPILE_TIME_ERROR.NEW_WITH_UNDEFINED_CONSTRUCTOR // [cfe] Method not found: 'C0.named'. new D0(1,2,3); - // ^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^ // [cfe] Too many positional arguments: 0 allowed, but 3 found. new D0.named(); // ^^^^^ diff --git a/tests/language_2/parameter/bad_named_parameters_test.dart b/tests/language_2/parameter/bad_named_parameters_test.dart index 173e3402786..aa36c1324e1 100644 --- a/tests/language_2/parameter/bad_named_parameters_test.dart +++ b/tests/language_2/parameter/bad_named_parameters_test.dart @@ -20,14 +20,16 @@ main() { // Parameter b passed twice. np.f42(10, 25, b: 25); - // ^^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. // Parameter x does not exist. np.f42(10, 25, x: 99); - // ^^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. // ^ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_NAMED_PARAMETER @@ -40,8 +42,9 @@ main() { // Too many parameters. np.f42(10, 20, 30, 40); - // ^^^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 4 found. // Too few parameters. diff --git a/tests/language_2/parameter/named_aggregated_test.dart b/tests/language_2/parameter/named_aggregated_test.dart index 1b506df3641..9c2cd707946 100644 --- a/tests/language_2/parameter/named_aggregated_test.dart +++ b/tests/language_2/parameter/named_aggregated_test.dart @@ -37,8 +37,9 @@ class NamedParametersAggregatedTests { main() { // Expect compile-time error due to missing comma in function definition. NamedParametersAggregatedTests.f_missing_comma(10, 25); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. // Expect compile-time error due to duplicate named argument. diff --git a/tests/language_2/parameter/optional_named_test.dart b/tests/language_2/parameter/optional_named_test.dart index d08f3d95b51..ba2af7dfca1 100644 --- a/tests/language_2/parameter/optional_named_test.dart +++ b/tests/language_2/parameter/optional_named_test.dart @@ -63,36 +63,42 @@ class OptionalNamedParametersTest { Expect.equals(20, F10()); Expect.equals(20, np.f21()); Expect.equals(20, F10(20)); - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. Expect.equals(20, np.f21(20)); - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^ // [cfe] Too many positional arguments: 0 allowed, but 1 found. Expect.equals(20, F10(b: 20)); Expect.equals(20, np.f21(b: 20)); Expect.equals(1020, F21(10)); Expect.equals(1020, np.f32(10)); Expect.equals(1025, F21(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(1025, np.f32(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(1025, F21(10, b: 25)); Expect.equals(1025, np.f32(10, b: 25)); Expect.equals(102030, F31(10)); Expect.equals(102030, np.f42(10)); Expect.equals(102530, F31(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102530, np.f42(10, 25)); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102530, F31(10, b: 25)); Expect.equals(102530, np.f42(10, b: 25)); @@ -101,12 +107,14 @@ class OptionalNamedParametersTest { Expect.equals(102535, F31(10, b: 25, c: 35)); Expect.equals(102535, np.f42(10, b: 25, c: 35)); Expect.equals(102535, F31(10, 25, c:35)); - // ^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102535, np.f42(10, 25, c:35)); - // ^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(102535, F31(10, c: 35, b: 25)); Expect.equals(102535, np.f42(10, c: 35, b: 25)); @@ -116,8 +124,9 @@ class OptionalNamedParametersTest { Expect.equals(10203540, np.f52(10, c: 35)); Expect.equals(10250045, F41(10, d: 45, b: 25)); Expect.equals(10250045, F41(10, 25, d:45)); - // ^^^^^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED + // ^^^^^^^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. Expect.equals(10250045, np.f52(10, d: 45, b: 25)); Expect.equals(10253545, F41(10, d: 45, c: 35, b: 25)); diff --git a/tests/language_2/redirecting/factory_default_values_test.dart b/tests/language_2/redirecting/factory_default_values_test.dart index 84a7d170a7a..23a0e3c8973 100644 --- a/tests/language_2/redirecting/factory_default_values_test.dart +++ b/tests/language_2/redirecting/factory_default_values_test.dart @@ -33,7 +33,8 @@ main() { Expect.equals(x.b, 0); var y = new A.f(42, 43); - // ^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^ // [cfe] Too many positional arguments: 1 allowed, but 2 found. } diff --git a/tests/language_2/regress/regress35258_test.dart b/tests/language_2/regress/regress35258_test.dart index d36f45f87fc..a5707b06894 100644 --- a/tests/language_2/regress/regress35258_test.dart +++ b/tests/language_2/regress/regress35258_test.dart @@ -6,7 +6,7 @@ main() { new C(42); // ^ // [cfe] Can't use 'C' because it is declared more than once. - // ^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS } diff --git a/tests/language_2/static/call_wrong_argument_count_test.dart b/tests/language_2/static/call_wrong_argument_count_test.dart index 575c4862b59..ca34e7cd1ad 100644 --- a/tests/language_2/static/call_wrong_argument_count_test.dart +++ b/tests/language_2/static/call_wrong_argument_count_test.dart @@ -13,7 +13,8 @@ main() { Niesen.goodCall(1, 2, 3); Niesen.goodCall(1, 2, 3, 4); - // ^^^^^^^^^^^^ + // ^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS + // ^^^^^^^^^^^^ // [cfe] Too many positional arguments: 3 allowed, but 4 found. } diff --git a/tests/lib/html/js_function_getter_trust_types/compile_test.dart b/tests/lib/html/js_function_getter_trust_types/compile_test.dart index e7481d10079..29f8669761f 100644 --- a/tests/lib/html/js_function_getter_trust_types/compile_test.dart +++ b/tests/lib/html/js_function_getter_trust_types/compile_test.dart @@ -47,6 +47,6 @@ main() { foo.bar.add(4, 5, 10); // ^ // [cfe] Error: Too many positional arguments: 2 allowed, but 3 found. - // ^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS } diff --git a/tests/lib_2/html/js_function_getter_trust_types/compile_test.dart b/tests/lib_2/html/js_function_getter_trust_types/compile_test.dart index e7481d10079..29f8669761f 100644 --- a/tests/lib_2/html/js_function_getter_trust_types/compile_test.dart +++ b/tests/lib_2/html/js_function_getter_trust_types/compile_test.dart @@ -47,6 +47,6 @@ main() { foo.bar.add(4, 5, 10); // ^ // [cfe] Error: Too many positional arguments: 2 allowed, but 3 found. - // ^^^^^^^^^^ + // ^^ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS }