Remove a hack for inferred top-level variable types in LibraryAnalyzer.

We don't need it anymore, a few years as probably.

Change-Id: Ieccb8fa303d8bc4595268ba6bde2b5da8bdc2731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216541
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 6278c6f..0c0000f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -648,17 +648,6 @@
 
     var unitElement = unit.declaredElement as CompilationUnitElementImpl;
 
-    // TODO(scheglov) Hack: set types for top-level variables
-    // Otherwise TypeResolverVisitor will set declared types, and because we
-    // don't run InferStaticVariableTypeTask, we will stuck with these declared
-    // types. And we don't need to run this task - resynthesized elements have
-    // inferred types.
-    for (var e in unitElement.topLevelVariables) {
-      if (!e.isSynthetic) {
-        e.type;
-      }
-    }
-
     unit.accept(
       ResolutionVisitor(
         unitElement: unitElement,
diff --git a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
index 30be965..90b93ea 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
@@ -679,17 +679,6 @@
 
     var unitElement = unit.declaredElement as CompilationUnitElementImpl;
 
-    // TODO(scheglov) Hack: set types for top-level variables
-    // Otherwise TypeResolverVisitor will set declared types, and because we
-    // don't run InferStaticVariableTypeTask, we will stuck with these declared
-    // types. And we don't need to run this task - resynthesized elements have
-    // inferred types.
-    for (var e in unitElement.topLevelVariables) {
-      if (!e.isSynthetic) {
-        e.type;
-      }
-    }
-
     unit.accept(
       ResolutionVisitor(
         unitElement: unitElement,