-
Notifications
You must be signed in to change notification settings - Fork 344
Closed
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone
Description
Is your feature request related to a problem? Please describe.
It would be helpful to easily see (and navigate) to inferred types for patterns (switch, if-case, destructuring, etc.)
For now it's only possible to see inferred type from hover popup.
Describe the solution you'd like
Make inlay hints for patterns behave like for generics (like #4366)
Describe alternatives you've considered
Not really.
Additional context
Also inferred patterns are not navigable, in example hint Box<int> allows to navigate to int, but Box<(int, int)> both ints are not navigable.
And probably inferred single element pattern should be (Type,) instead of (Type).
final class Box<T> {
const Box(this.value);
final T value;
}
void main() {
{
{ // actual
final (i, j) = (1, 2);
}
{ // expected
final (int i, int j) = (1, 2);
}
}
{
final pattern = (test: (10,), 2);
{ // actual
if (pattern case final p) {}
final (_, :test,) = pattern;
final Null _switch = switch (pattern) {
(:final test, var i) => null,
};
}
{ // expected
if (pattern case final (int, {(int,) test}) p) {}
final (_, :(int,) test,) = pattern;
final Null _switch = switch (pattern) {
(:final (int,) test, var /*int*/ i) => null,
};
}
}
{
const simple = Box(2);
const pattern = Box((1,2));
{ // actual
if (simple case Box(:final value)) {}
if (pattern case Box(:final value)) {}
if (pattern case Box(value: final test)) {}
}
{ // expected
if (simple case Box<int>(:final int value)) {}
if (pattern case Box<(int, int)>(:final (int, int) value)) {}
if (pattern case Box<(int, int)>(value: final (int, int) test)) {}
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serverSomething to be fixed in the Dart analysis serveris enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become availableSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
