Skip to content

Argument that is a callback that returns a tuple breaks navigation #8302

Open
@gabrielgarciagava

Description

@gabrielgarciagava

The following example breaks navigation in intellij (cmd + click on _someFunction)

int _someFunction((int a, int b) Function(int) cb) {
  final (a, b) = cb(10);
  return a + b;
}

void _x() {
  print(_someFunction((x) => (x ~/ 2, x * 2)));
}

However, if I extract the signature of the callback to a typedef, the bug is gone

typedef CB = (int a, int b) Function(int);

int _someFunction(CB cb) {
  final (a, b) = cb(10);
  return a + b;
}

void _x() {
  print(_someFunction((x) => (x ~/ 2, x * 2)));
}

If I create some other function before the culprit line, the navigation there works, showing that everything after the culprit is broken.

void _y() {
  print(_someFunction((x) => (x ~/ 2, x * 2)));
}

int _someFunction((int a, int b) Function(int) cb) {
  final (a, b) = cb(10);
  return a + b;
}

void _x() {
  print(_someFunction((x) => (x ~/ 2, x * 2)));
}

I tested the same thing on visual studio code and it worked fine (just to show it is either the analyzer server version or something specific to intellij plugin)

Plugin version used: 86.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions