File tree 2 files changed +34
-1
lines changed
2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -398,7 +398,10 @@ CompletionDetail getCompletionDetail(
398
398
}) {
399
399
final element = suggestion.element;
400
400
var parameters = element? .parameters;
401
- var returnType = element? .returnType;
401
+ // Prefer the element return type (because it's available for things like
402
+ // overrides) but fall back to the suggestion if there isn't one (to handle
403
+ // records).
404
+ var returnType = element? .returnType ?? suggestion.returnType;
402
405
403
406
// Extract the type from setters to be shown in the place a return type
404
407
// would usually be shown.
Original file line number Diff line number Diff line change @@ -598,6 +598,36 @@ bool a = ^
598
598
detail: null ,
599
599
);
600
600
}
601
+
602
+ Future <void > test_record () async {
603
+ final content = r'''
604
+ void f((int, int) record) {
605
+ record.$^
606
+ }
607
+ ''' ;
608
+
609
+ await expectLabels (content,
610
+ label: r'$1' ,
611
+ labelDetail: ' int' ,
612
+ labelDescription: null ,
613
+ filterText: null ,
614
+ detail: 'int' );
615
+ }
616
+
617
+ Future <void > test_variable () async {
618
+ final content = r'''
619
+ void f(int variable) {
620
+ varia^
621
+ }
622
+ ''' ;
623
+
624
+ await expectLabels (content,
625
+ label: 'variable' ,
626
+ labelDetail: ' int' ,
627
+ labelDescription: null ,
628
+ filterText: null ,
629
+ detail: 'int' );
630
+ }
601
631
}
602
632
603
633
@reflectiveTest
You can’t perform that action at this time.
0 commit comments