Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra_positional_arguments triggers only once #60272

Open
FMorschel opened this issue Mar 7, 2025 · 1 comment
Open

extra_positional_arguments triggers only once #60272

FMorschel opened this issue Mar 7, 2025 · 1 comment
Labels
area-devexp Developer experience items (DevTools, IDEs, analysis server, completions, refactorings, ...).

Comments

@FMorschel
Copy link
Contributor

Repro:

void f() {}

void main() {
  f(1); // extra_positional_arguments
  f(1, 2); // extra_positional_arguments, nothing
}

I'd say that 2 should also trigger this diagnostic.

CC @bwilkerson

@FMorschel FMorschel added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label Mar 7, 2025
@bwilkerson
Copy link
Member

My first reaction was that the message is fairly clear about there being one or more extra positional arguments and that it wouldn't add any value to the user to have two diagnostics.

However, as I thought about it I realized that the current diagnostic doesn't work as well if there are named arguments between positional arguments. It might well be better to change the diagnostic to be singular and to report each unmatched argument separately.

The biggest remaining reason that I can think of to not do this is that it would be more work for the user to apply the "convert positional arguments to named arguments" fix. If they're separate diagnostics then we'd need the fix to fix a single argument. This isn't a heavily used fix, so it's possible that this wouldn't inconvenience too many users, but it would impact some users. Maybe they could offer some insight.

@bwilkerson bwilkerson added area-devexp Developer experience items (DevTools, IDEs, analysis server, completions, refactorings, ...). and removed area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp Developer experience items (DevTools, IDEs, analysis server, completions, refactorings, ...).
Projects
None yet
Development

No branches or pull requests

2 participants