Change recordScopeDependencies() to return true on type parameter of strict FunctionType.

Change-Id: I92e183baca876f11cf3edd4cb4f8e2059a6ec936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112423
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart b/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart
index ffa6943..789197d 100644
--- a/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/type_utilities.dart
@@ -190,7 +190,12 @@
     // readability to little or no benefit.  It would be good to do this
     // when we know that we can hoist it to an outer scope, but for
     // now we just disable it.
-    if (freeVariables.any((i) => i.enclosingElement is FunctionTypedElement)) {
+    if (freeVariables.any((i) =>
+        i.enclosingElement is FunctionTypedElement ||
+        // Strict function types don't have element, so their type parameters
+        // don't have any enclosing element. Analyzer started returning
+        // strict function types for generic methods.
+        i.enclosingElement == null)) {
       return true;
     }