[analysis_server] Include types in tooltips for record fields in patterns

Change-Id: I768fe2b44a25b43c36c65414807b2201ebe97665
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/computer/computer_hover.dart b/pkg/analysis_server/lib/src/computer/computer_hover.dart
index 073a965..54ae90d 100644
--- a/pkg/analysis_server/lib/src/computer/computer_hover.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_hover.dart
@@ -176,8 +176,8 @@
           if (staticType != null && staticType.isDynamic) {
             staticType = null;
           }
-        } else if (node is PatternField && parent is RecordPattern) {
-          // TODO(dantup): Get the type of this field.
+        } else if (node is PatternFieldName && parent is PatternField) {
+          staticType = parent.pattern.matchedValueType;
         }
         hover.staticType = _typeDisplayString(staticType);
       }
diff --git a/pkg/analysis_server/test/lsp/hover_test.dart b/pkg/analysis_server/test/lsp/hover_test.dart
index 0ad7666..2279cef 100644
--- a/pkg/analysis_server/test/lsp/hover_test.dart
+++ b/pkg/analysis_server/test/lsp/hover_test.dart
@@ -405,9 +405,6 @@
         contains('A square.'),
       );
 
-  @FailingTest(
-    reason: 'Needs a way to get type from RecordPatternField in ComputerHover',
-  )
   Future<void> test_pattern_record_fieldName() => assertStringContents(
         '''
 void f(({int foo}) x, num a) {