Skip to content

unnecessary_lambdas should not trigger on extension type external methods #57131

@a14n

Description

@a14n

With the following code:

extension type MapType._(JSObject _) implements JSObject {
  @JS('f')
  external void _f();
  void Function() get f => () => _f();
}

a lint unnecessary_lambdas appears on f getter.

But if I use a tear-off:

extension type MapType._(JSObject _) implements JSObject {
  @JS('f')
  external void _f();
  void Function() get f => _f;
}

then I get an error:

Error: Tear-offs of external extension type interop member '_f' are disallowed.

So unnecessary_lambdas should not trigger on extension type external methods

(Dart 3.4.4)

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-linterIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.type-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