[analysis_server] Don't generate inline values inside function types

We shouldn't treat parameter names inside function types as if they are references to other parameters/variables of that name.

Fixes https://github.com/dart-lang/sdk/issues/61099

Change-Id: Iadc97723a87af1ddbbde618d1c9c8e5b51499a6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/440160
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart
index 58816cd..2492c3c 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_inline_value.dart
@@ -336,6 +336,12 @@
   }
 
   @override
+  void visitGenericFunctionType(GenericFunctionType node) {
+    // Don't descent into function types or we may generate values
+    // for their parameters.
+  }
+
+  @override
   void visitPrefixedIdentifier(PrefixedIdentifier node) {
     if (experimentalInlineValuesProperties) {
       // Don't create values for excluded types or access of their properties.
diff --git a/pkg/analysis_server/test/lsp/inline_value_test.dart b/pkg/analysis_server/test/lsp/inline_value_test.dart
index 5a8004f..b6c275e 100644
--- a/pkg/analysis_server/test/lsp/inline_value_test.dart
+++ b/pkg/analysis_server/test/lsp/inline_value_test.dart
@@ -120,6 +120,20 @@
     await verify_values(code, ofType: InlineValueVariableLookup);
   }
 
+  Future<void> test_parameter_nestedInFunctionType() async {
+    // A parameter nested inside a function type should not produce a value.
+    code = TestCode.parse(r'''
+void f(
+  int /*[0*/value/*0]*/, {
+  required void Function(int value) /*[1*/func/*1]*/,
+}) {
+  ^
+}
+''');
+
+    await verify_values(code, ofType: InlineValueVariableLookup);
+  }
+
   Future<void> test_parameter_read() async {
     code = TestCode.parse(r'''
 void f(int aaa, int bbb) {