Index: pkg/analyzer/lib/src/generated/resolver.dart |
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart |
index d3dbd3d3fde2f25c710476f740488e67670e69f2..d6e8567944d1db1a5597fe8e6ed37ac7cf0ecd80 100644 |
--- a/pkg/analyzer/lib/src/generated/resolver.dart |
+++ b/pkg/analyzer/lib/src/generated/resolver.dart |
@@ -7157,9 +7157,18 @@ class ResolverVisitor extends ScopedVisitor { |
} |
} else if (positionalArgumentCount > unnamedParameterCount && |
noBlankArguments) { |
- ErrorCode errorCode = (reportAsError |
- ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS |
- : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS); |
+ ErrorCode errorCode; |
+ int namedParameterCount = namedParameters?.length ?? 0; |
+ int namedArgumentCount = usedNames?.length ?? 0; |
+ if (namedParameterCount > namedArgumentCount) { |
+ errorCode = (reportAsError |
+ ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED |
+ : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED); |
+ } else { |
+ errorCode = (reportAsError |
+ ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS |
+ : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS); |
+ } |
if (onError != null) { |
onError(errorCode, argumentList, |
[unnamedParameterCount, positionalArgumentCount]); |