Skip to content

Poor behavior around parameters that are both deprecated and required #48206

@bwilkerson

Description

@bwilkerson

Given the following code:

void f({@deprecated required int c}) {}
void g() {
  f(c: 2);
}

The analyzer marks the argument named c as being deprecated claiming that it shouldn't be used, but the call site is required to provide a value. There's no way for the user to fix the diagnostic, so we probably shouldn't produce it.

On the other hand, we should probably have a diagnostic indicating that it doesn't make sense to have a parameter that's both deprecated and required and suggest that users remove required and either make the parameter nullable or provide a default value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-uxtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions