[CFE] Third batch of fixes for requiring explicit types

Change-Id: Ie4c8e66acf942901602c91819640967e49044233
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113822
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart b/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart
index e17c773..29ae839 100644
--- a/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart
+++ b/pkg/front_end/lib/src/fasta/flow_analysis/flow_analysis.dart
@@ -26,7 +26,7 @@
   }
 
   void beginStatement() {
-    var set = Set<Variable>.identity();
+    Set<Variable> set = Set<Variable>.identity();
     _stack.add(set);
   }
 
@@ -35,7 +35,7 @@
   }
 
   void write(Variable variable) {
-    for (var i = 0; i < _stack.length; ++i) {
+    for (int i = 0; i < _stack.length; ++i) {
       _stack[i].add(variable);
     }
   }
@@ -100,7 +100,8 @@
     TypeOperations<Variable, Type> typeOperations,
     FunctionBodyAccess<Variable> functionBody,
   ) {
-    var emptySet = FlowModel<Variable, Type>(false).notAssigned;
+    _VariableSet<Variable> emptySet =
+        FlowModel<Variable, Type>(false).notAssigned;
     return FlowAnalysis._(
       nodeOperations,
       typeOperations,
@@ -139,8 +140,8 @@
   }
 
   void conditional_elseBegin(Expression thenExpression) {
-    var afterThen = _current;
-    var falseCondition = _stack.removeLast();
+    FlowModel<Variable, Type> afterThen = _current;
+    FlowModel<Variable, Type> falseCondition = _stack.removeLast();
 
     _conditionalEnd(thenExpression);
     // Tail of the stack: falseThen, trueThen
@@ -151,20 +152,20 @@
 
   void conditional_end(
       Expression conditionalExpression, Expression elseExpression) {
-    var afterThen = _stack.removeLast();
-    var afterElse = _current;
+    FlowModel<Variable, Type> afterThen = _stack.removeLast();
+    FlowModel<Variable, Type> afterElse = _current;
 
     _conditionalEnd(elseExpression);
     // Tail of the stack: falseThen, trueThen, falseElse, trueElse
 
-    var trueElse = _stack.removeLast();
-    var falseElse = _stack.removeLast();
+    FlowModel<Variable, Type> trueElse = _stack.removeLast();
+    FlowModel<Variable, Type> falseElse = _stack.removeLast();
 
-    var trueThen = _stack.removeLast();
-    var falseThen = _stack.removeLast();
+    FlowModel<Variable, Type> trueThen = _stack.removeLast();
+    FlowModel<Variable, Type> falseThen = _stack.removeLast();
 
-    var trueResult = _join(trueThen, trueElse);
-    var falseResult = _join(falseThen, falseElse);
+    FlowModel<Variable, Type> trueResult = _join(trueThen, trueElse);
+    FlowModel<Variable, Type> falseResult = _join(falseThen, falseElse);
 
     _condition = conditionalExpression;
     _conditionTrue = trueResult;
@@ -177,7 +178,7 @@
     _conditionalEnd(condition);
     // Tail of the stack: falseCondition, trueCondition
 
-    var trueCondition = _stack.removeLast();
+    FlowModel<Variable, Type> trueCondition = _stack.removeLast();
     _current = trueCondition;
   }
 
@@ -191,7 +192,8 @@
     }
 
     _condition = binaryExpression;
-    var currentPromoted = _current.markNonNullable(typeOperations, variable);
+    FlowModel<Variable, Type> currentPromoted =
+        _current.markNonNullable(typeOperations, variable);
     if (notEqual) {
       _conditionTrue = currentPromoted;
       _conditionFalse = _current;
@@ -214,7 +216,7 @@
   void doStatement_conditionBegin() {
     // Tail of the stack: break, continue
 
-    var continueState = _stack.removeLast();
+    FlowModel<Variable, Type> continueState = _stack.removeLast();
     _current = _join(_current, continueState);
   }
 
@@ -223,8 +225,8 @@
     // Tail of the stack:  break, falseCondition, trueCondition
 
     _stack.removeLast(); // trueCondition
-    var falseCondition = _stack.removeLast();
-    var breakState = _stack.removeLast();
+    FlowModel<Variable, Type> falseCondition = _stack.removeLast();
+    FlowModel<Variable, Type> breakState = _stack.removeLast();
 
     _current = _join(falseCondition, breakState);
   }
@@ -234,7 +236,7 @@
   void finish() {
     assert(_stack.isEmpty);
     assert(() {
-      var variablesNotAdded =
+      Set<Variable> variablesNotAdded =
           _referencedVariables.difference(Set<Variable>.from(_addedVariables));
       assert(variablesNotAdded.isEmpty,
           'Variables not passed to add: $variablesNotAdded');
@@ -249,7 +251,7 @@
   }
 
   void forEachStatement_end() {
-    var afterIterable = _stack.removeLast();
+    FlowModel<Variable, Type> afterIterable = _stack.removeLast();
     _current = _join(_current, afterIterable);
   }
 
@@ -257,7 +259,7 @@
     _conditionalEnd(condition);
     // Tail of the stack: falseCondition, trueCondition
 
-    var trueCondition = _stack.removeLast();
+    FlowModel<Variable, Type> trueCondition = _stack.removeLast();
 
     _statementToStackIndex[node] = _stack.length;
     _stack.add(null); // break
@@ -273,16 +275,16 @@
 
   void forStatement_end() {
     // Tail of the stack: falseCondition, break
-    var breakState = _stack.removeLast();
-    var falseCondition = _stack.removeLast();
+    FlowModel<Variable, Type> breakState = _stack.removeLast();
+    FlowModel<Variable, Type> falseCondition = _stack.removeLast();
 
     _current = _join(falseCondition, breakState);
   }
 
   void forStatement_updaterBegin() {
     // Tail of the stack: falseCondition, break, continue
-    var afterBody = _current;
-    var continueState = _stack.removeLast();
+    FlowModel<Variable, Type> afterBody = _current;
+    FlowModel<Variable, Type> continueState = _stack.removeLast();
 
     _current = _join(afterBody, continueState);
   }
@@ -291,9 +293,9 @@
     _stack.add(_current);
 
     Set<Variable> notPromoted = null;
-    for (var entry in _current.promoted.entries) {
-      var variable = entry.key;
-      var promotedType = entry.value;
+    for (MapEntry<Variable, Type> entry in _current.promoted.entries) {
+      Variable variable = entry.key;
+      Type promotedType = entry.value;
       if (promotedType != null &&
           functionBody.isPotentiallyMutatedInScope(variable)) {
         notPromoted ??= Set<Variable>.identity();
@@ -311,7 +313,7 @@
   }
 
   void handleBreak(Statement target) {
-    var breakIndex = _statementToStackIndex[target];
+    int breakIndex = _statementToStackIndex[target];
     if (breakIndex != null) {
       _stack[breakIndex] = _join(_stack[breakIndex], _current);
     }
@@ -319,9 +321,9 @@
   }
 
   void handleContinue(Statement target) {
-    var breakIndex = _statementToStackIndex[target];
+    int breakIndex = _statementToStackIndex[target];
     if (breakIndex != null) {
-      var continueIndex = breakIndex + 1;
+      int continueIndex = breakIndex + 1;
       _stack[continueIndex] = _join(_stack[continueIndex], _current);
     }
     _current = _current.setReachable(false);
@@ -334,7 +336,7 @@
   }
 
   void ifNullExpression_end() {
-    var afterLeft = _stack.removeLast();
+    FlowModel<Variable, Type> afterLeft = _stack.removeLast();
     _current = _join(_current, afterLeft);
   }
 
@@ -343,8 +345,8 @@
   }
 
   void ifStatement_elseBegin() {
-    var afterThen = _current;
-    var falseCondition = _stack.removeLast();
+    FlowModel<Variable, Type> afterThen = _current;
+    FlowModel<Variable, Type> falseCondition = _stack.removeLast();
     _stack.add(afterThen);
     _current = falseCondition;
   }
@@ -366,7 +368,7 @@
     _conditionalEnd(condition);
     // Tail of the stack:  falseCondition, trueCondition
 
-    var trueCondition = _stack.removeLast();
+    FlowModel<Variable, Type> trueCondition = _stack.removeLast();
     _current = trueCondition;
   }
 
@@ -398,11 +400,11 @@
     _conditionalEnd(rightOperand);
     // Tail of the stack: falseLeft, trueLeft, falseRight, trueRight
 
-    var trueRight = _stack.removeLast();
-    var falseRight = _stack.removeLast();
+    FlowModel<Variable, Type> trueRight = _stack.removeLast();
+    FlowModel<Variable, Type> falseRight = _stack.removeLast();
 
-    var trueLeft = _stack.removeLast();
-    var falseLeft = _stack.removeLast();
+    FlowModel<Variable, Type> trueLeft = _stack.removeLast();
+    FlowModel<Variable, Type> falseLeft = _stack.removeLast();
 
     FlowModel<Variable, Type> trueResult;
     FlowModel<Variable, Type> falseResult;
@@ -414,7 +416,7 @@
       falseResult = falseRight;
     }
 
-    var afterResult = _join(trueResult, falseResult);
+    FlowModel<Variable, Type> afterResult = _join(trueResult, falseResult);
 
     _condition = wholeExpression;
     _conditionTrue = trueResult;
@@ -429,18 +431,18 @@
     // Tail of the stack: falseLeft, trueLeft
 
     if (isAnd) {
-      var trueLeft = _stack.last;
+      FlowModel<Variable, Type> trueLeft = _stack.last;
       _current = trueLeft;
     } else {
-      var falseLeft = _stack[_stack.length - 2];
+      FlowModel<Variable, Type> falseLeft = _stack[_stack.length - 2];
       _current = falseLeft;
     }
   }
 
   void logicalNot_end(Expression notExpression, Expression operand) {
     _conditionalEnd(operand);
-    var trueExpr = _stack.removeLast();
-    var falseExpr = _stack.removeLast();
+    FlowModel<Variable, Type> trueExpr = _stack.removeLast();
+    FlowModel<Variable, Type> falseExpr = _stack.removeLast();
 
     _condition = notExpression;
     _conditionTrue = falseExpr;
@@ -465,9 +467,9 @@
 
   void switchStatement_end(Statement switchStatement, bool hasDefault) {
     // Tail of the stack: break, continue, afterExpression
-    var afterExpression = _current = _stack.removeLast();
+    FlowModel<Variable, Type> afterExpression = _current = _stack.removeLast();
     _stack.removeLast(); // continue
-    var breakState = _stack.removeLast();
+    FlowModel<Variable, Type> breakState = _stack.removeLast();
 
     if (hasDefault) {
       // breakState should not be null because we should have joined it with
@@ -493,25 +495,26 @@
 
   void tryCatchStatement_bodyEnd(Set<Variable> assignedInBody) {
     _variablesReferenced(assignedInBody);
-    var beforeBody = _stack.removeLast();
-    var beforeCatch = beforeBody.removePromotedAll(assignedInBody);
+    FlowModel<Variable, Type> beforeBody = _stack.removeLast();
+    FlowModel<Variable, Type> beforeCatch =
+        beforeBody.removePromotedAll(assignedInBody);
     _stack.add(beforeCatch);
     _stack.add(_current); // afterBodyAndCatches
     // Tail of the stack: beforeCatch, afterBodyAndCatches
   }
 
   void tryCatchStatement_catchBegin() {
-    var beforeCatch = _stack[_stack.length - 2];
+    FlowModel<Variable, Type> beforeCatch = _stack[_stack.length - 2];
     _current = beforeCatch;
   }
 
   void tryCatchStatement_catchEnd() {
-    var afterBodyAndCatches = _stack.last;
+    FlowModel<Variable, Type> afterBodyAndCatches = _stack.last;
     _stack.last = _join(afterBodyAndCatches, _current);
   }
 
   void tryCatchStatement_end() {
-    var afterBodyAndCatches = _stack.removeLast();
+    FlowModel<Variable, Type> afterBodyAndCatches = _stack.removeLast();
     _stack.removeLast(); // beforeCatch
     _current = afterBodyAndCatches;
   }
@@ -522,7 +525,7 @@
 
   void tryFinallyStatement_end(Set<Variable> assignedInFinally) {
     _variablesReferenced(assignedInFinally);
-    var afterBody = _stack.removeLast();
+    FlowModel<Variable, Type> afterBody = _stack.removeLast();
     _current = _current.restrict(
       typeOperations,
       _emptySet,
@@ -533,8 +536,8 @@
 
   void tryFinallyStatement_finallyBegin(Set<Variable> assignedInBody) {
     _variablesReferenced(assignedInBody);
-    var beforeTry = _stack.removeLast();
-    var afterBody = _current;
+    FlowModel<Variable, Type> beforeTry = _stack.removeLast();
+    FlowModel<Variable, Type> afterBody = _current;
     _stack.add(afterBody);
     _current = _join(afterBody, beforeTry.removePromotedAll(assignedInBody));
   }
@@ -544,7 +547,7 @@
     _conditionalEnd(condition);
     // Tail of the stack: falseCondition, trueCondition
 
-    var trueCondition = _stack.removeLast();
+    FlowModel<Variable, Type> trueCondition = _stack.removeLast();
 
     _statementToStackIndex[whileStatement] = _stack.length;
     _stack.add(null); // break
@@ -560,8 +563,8 @@
 
   void whileStatement_end() {
     _stack.removeLast(); // continue
-    var breakState = _stack.removeLast();
-    var falseCondition = _stack.removeLast();
+    FlowModel<Variable, Type> breakState = _stack.removeLast();
+    FlowModel<Variable, Type> falseCondition = _stack.removeLast();
 
     _current = _join(falseCondition, breakState);
   }
@@ -657,8 +660,9 @@
   /// optional [assigned] boolean indicates whether the variable is assigned at
   /// the point of declaration.
   FlowModel<Variable, Type> add(Variable variable, {bool assigned: false}) {
-    var newNotAssigned = assigned ? notAssigned : notAssigned.add(variable);
-    var newPromoted = Map<Variable, Type>.from(promoted);
+    _VariableSet<Variable> newNotAssigned =
+        assigned ? notAssigned : notAssigned.add(variable);
+    Map<Variable, Type> newPromoted = Map<Variable, Type>.from(promoted);
     newPromoted[variable] = null;
 
     return FlowModel<Variable, Type>._(
@@ -675,12 +679,12 @@
   /// assigned?  Does it matter?
   FlowModel<Variable, Type> markNonNullable(
       TypeOperations<Variable, Type> typeOperations, Variable variable) {
-    var previousType = promoted[variable];
+    Type previousType = promoted[variable];
     previousType ??= typeOperations.variableType(variable);
-    var type = typeOperations.promoteToNonNull(previousType);
+    Type type = typeOperations.promoteToNonNull(previousType);
 
     if (!typeOperations.isSameType(type, previousType)) {
-      var newPromoted = <Variable, Type>{}..addAll(promoted);
+      Map<Variable, Type> newPromoted = <Variable, Type>{}..addAll(promoted);
       newPromoted[variable] = type;
       return FlowModel<Variable, Type>._(
         reachable,
@@ -706,12 +710,12 @@
     Variable variable,
     Type type,
   ) {
-    var previousType = promoted[variable];
+    Type previousType = promoted[variable];
     previousType ??= typeOperations.variableType(variable);
 
     if (typeOperations.isSubtypeOf(type, previousType) &&
         !typeOperations.isSameType(type, previousType)) {
-      var newPromoted = <Variable, Type>{}..addAll(promoted);
+      Map<Variable, Type> newPromoted = <Variable, Type>{}..addAll(promoted);
       newPromoted[variable] = type;
       return FlowModel<Variable, Type>._(
         reachable,
@@ -743,7 +747,7 @@
   /// later in the loop body.  If we switch to a fixed point analysis, we should
   /// be able to remove this method.
   FlowModel<Variable, Type> removePromotedAll(Set<Variable> variables) {
-    var newPromoted = _removePromotedAll(promoted, variables);
+    Map<Variable, Type> newPromoted = _removePromotedAll(promoted, variables);
 
     if (identical(newPromoted, promoted)) return this;
 
@@ -780,8 +784,8 @@
     FlowModel<Variable, Type> other,
     Set<Variable> unsafe,
   ) {
-    var newReachable = reachable && other.reachable;
-    var newNotAssigned = notAssigned.intersect(
+    bool newReachable = reachable && other.reachable;
+    _VariableSet<Variable> newNotAssigned = notAssigned.intersect(
       empty: emptySet,
       other: other.notAssigned,
     );
@@ -792,13 +796,13 @@
       newNotAssigned = other.notAssigned;
     }
 
-    var newPromoted = <Variable, Type>{};
+    Map<Variable, Type> newPromoted = <Variable, Type>{};
     bool promotedMatchesThis = true;
     bool promotedMatchesOther = other.promoted.length == promoted.length;
-    for (var entry in promoted.entries) {
-      var variable = entry.key;
-      var thisType = entry.value;
-      var otherType = other.promoted[variable];
+    for (MapEntry<Variable, Type> entry in promoted.entries) {
+      Variable variable = entry.key;
+      Type thisType = entry.value;
+      Type otherType = other.promoted[variable];
       if (!unsafe.contains(variable)) {
         if (otherType != null &&
             (thisType == null ||
@@ -867,11 +871,12 @@
   /// TODO(paulberry): allow for writes that preserve type promotions.
   FlowModel<Variable, Type> write(TypeOperations<Variable, Type> typeOperations,
       _VariableSet<Variable> emptySet, Variable variable) {
-    var newNotAssigned = typeOperations.isLocalVariable(variable)
-        ? notAssigned.remove(emptySet, variable)
-        : notAssigned;
+    _VariableSet<Variable> newNotAssigned =
+        typeOperations.isLocalVariable(variable)
+            ? notAssigned.remove(emptySet, variable)
+            : notAssigned;
 
-    var newPromoted = _removePromoted(promoted, variable);
+    Map<Variable, Type> newPromoted = _removePromoted(promoted, variable);
 
     if (identical(newNotAssigned, notAssigned) &&
         identical(newPromoted, promoted)) {
@@ -891,7 +896,7 @@
       Map<Variable, Type> map, Variable variable) {
     if (map[variable] == null) return map;
 
-    var result = Map<Variable, Type>.from(map);
+    Map<Variable, Type> result = Map<Variable, Type>.from(map);
     result[variable] = null;
     return result;
   }
@@ -905,11 +910,11 @@
     if (map.isEmpty) return const {};
     if (variables.isEmpty) return map;
 
-    var result = <Variable, Type>{};
-    var noChanges = true;
-    for (var entry in map.entries) {
-      var variable = entry.key;
-      var promotedType = entry.value;
+    Map<Variable, Type> result = <Variable, Type>{};
+    bool noChanges = true;
+    for (MapEntry<Variable, Type> entry in map.entries) {
+      Variable variable = entry.key;
+      Type promotedType = entry.value;
       if (variables.contains(variable) && promotedType != null) {
         result[variable] = null;
         noChanges = false;
@@ -943,9 +948,10 @@
     if (first.reachable && !second.reachable) return first;
     if (!first.reachable && second.reachable) return second;
 
-    var newReachable = first.reachable || second.reachable;
-    var newNotAssigned = first.notAssigned.union(second.notAssigned);
-    var newPromoted =
+    bool newReachable = first.reachable || second.reachable;
+    _VariableSet<Variable> newNotAssigned =
+        first.notAssigned.union(second.notAssigned);
+    Map<Variable, Type> newPromoted =
         FlowModel.joinPromoted(typeOperations, first.promoted, second.promoted);
 
     return FlowModel._identicalOrNew(
@@ -967,16 +973,16 @@
     if (identical(first, second)) return first;
     if (first.isEmpty || second.isEmpty) return const {};
 
-    var result = <Variable, Type>{};
-    var alwaysFirst = true;
-    var alwaysSecond = true;
-    for (var entry in first.entries) {
-      var variable = entry.key;
+    Map<Variable, Type> result = <Variable, Type>{};
+    bool alwaysFirst = true;
+    bool alwaysSecond = true;
+    for (MapEntry<Variable, Type> entry in first.entries) {
+      Variable variable = entry.key;
       if (!second.containsKey(variable)) {
         alwaysFirst = false;
       } else {
-        var firstType = entry.value;
-        var secondType = second[variable];
+        Type firstType = entry.value;
+        Type secondType = second[variable];
         if (identical(firstType, secondType)) {
           result[variable] = firstType;
         } else if (firstType == null) {
@@ -1039,9 +1045,9 @@
       Map<Variable, Type> p2) {
     if (p1.length != p2.length) return false;
     if (!p1.keys.toSet().containsAll(p2.keys)) return false;
-    for (var entry in p1.entries) {
-      var p1Value = entry.value;
-      var p2Value = p2[entry.key];
+    for (MapEntry<Variable, Type> entry in p1.entries) {
+      Type p1Value = entry.value;
+      Type p2Value = p2[entry.key];
       if (p1Value == null) {
         if (p2Value != null) return false;
       } else {
@@ -1098,9 +1104,9 @@
       return this;
     }
 
-    var length = variables.length;
-    var newVariables = List<Variable>(length + 1);
-    for (var i = 0; i < length; ++i) {
+    int length = variables.length;
+    List<Variable> newVariables = List<Variable>(length + 1);
+    for (int i = 0; i < length; ++i) {
       newVariables[i] = variables[i];
     }
     newVariables[length] = addedVariable;
@@ -1108,16 +1114,16 @@
   }
 
   _VariableSet<Variable> addAll(Iterable<Variable> variables) {
-    var result = this;
-    for (var variable in variables) {
+    _VariableSet<Variable> result = this;
+    for (Variable variable in variables) {
       result = result.add(variable);
     }
     return result;
   }
 
   bool contains(Variable variable) {
-    var length = variables.length;
-    for (var i = 0; i < length; ++i) {
+    int length = variables.length;
+    for (int i = 0; i < length; ++i) {
       if (identical(variables[i], variable)) {
         return true;
       }
@@ -1133,7 +1139,7 @@
     if (identical(this, other)) return this;
 
     // TODO(scheglov) optimize
-    var newVariables =
+    List<Variable> newVariables =
         variables.toSet().intersection(other.variables.toSet()).toList();
 
     if (newVariables.isEmpty) return empty;
@@ -1148,15 +1154,15 @@
       return this;
     }
 
-    var length = variables.length;
+    int length = variables.length;
     if (length == 1) {
       return empty;
     }
 
-    var newVariables = List<Variable>(length - 1);
-    var newIndex = 0;
-    for (var i = 0; i < length; ++i) {
-      var variable = variables[i];
+    List<Variable> newVariables = List<Variable>(length - 1);
+    int newIndex = 0;
+    for (int i = 0; i < length; ++i) {
+      Variable variable = variables[i];
       if (!identical(variable, removedVariable)) {
         newVariables[newIndex++] = variable;
       }
@@ -1173,10 +1179,10 @@
       return this;
     }
 
-    var result = this;
-    var otherVariables = other.variables;
-    for (var i = 0; i < otherVariables.length; ++i) {
-      var otherVariable = otherVariables[i];
+    _VariableSet<Variable> result = this;
+    List<Variable> otherVariables = other.variables;
+    for (int i = 0; i < otherVariables.length; ++i) {
+      Variable otherVariable = otherVariables[i];
       result = result.add(otherVariable);
     }
     return result;
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index c15646d..5d697e6 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -740,7 +740,7 @@
     debugEvent("endInitializer");
     inFieldInitializer = false;
     assert(!inInitializer);
-    final member = this.member;
+    final ModifierBuilder member = this.member;
     Object node = pop();
     Initializer initializer;
     if (node is Initializer) {
@@ -2507,7 +2507,7 @@
   @override
   void endForControlFlow(Token token) {
     debugEvent("ForControlFlow");
-    var entry = pop();
+    Object entry = pop();
     int updateExpressionCount = pop();
     pop(); // left separator
     pop(); // left parenthesis
@@ -2638,7 +2638,7 @@
     List<Expression> expressions =
         new List<Expression>.filled(count, null, growable: true);
     for (int i = count - 1; i >= 0; i--) {
-      var elem = pop();
+      Object elem = pop();
       if (elem != invalidCollectionElement) {
         expressions[i] = toValue(elem);
       } else {
@@ -2691,9 +2691,9 @@
       typeArgument = implicitTypeArgument;
     }
 
-    var expressions = <Expression>[];
+    List<Expression> expressions = <Expression>[];
     if (setOrMapEntries != null) {
-      for (var entry in setOrMapEntries) {
+      for (dynamic entry in setOrMapEntries) {
         if (entry is MapEntry) {
           // TODO(danrubel): report the error on the colon
           addProblem(fasta.templateExpectedButGot.withArguments(','),
@@ -2730,9 +2730,10 @@
   ) {
     debugEvent("LiteralSetOrMap");
 
-    var setOrMapEntries = new List<dynamic>.filled(count, null, growable: true);
+    List<dynamic> setOrMapEntries =
+        new List<dynamic>.filled(count, null, growable: true);
     for (int i = count - 1; i >= 0; i--) {
-      var elem = pop();
+      Object elem = pop();
       // TODO(danrubel): Revise this to handle control flow and spread
       if (elem == invalidCollectionElement) {
         setOrMapEntries.removeAt(i);
@@ -2751,7 +2752,7 @@
     // TODO(danrubel): Since type resolution is needed to disambiguate
     // set or map in some situations, consider always deferring determination
     // until the type resolution phase.
-    final typeArgCount = typeArguments?.length;
+    final int typeArgCount = typeArguments?.length;
     bool isSet = typeArgCount == 1 ? true : typeArgCount != null ? false : null;
 
     for (int i = 0; i < setOrMapEntries.length; ++i) {
@@ -3981,8 +3982,8 @@
   @override
   void endIfControlFlow(Token token) {
     debugEvent("endIfControlFlow");
-    var entry = pop();
-    var condition = pop(); // parenthesized expression
+    Object entry = pop();
+    Object condition = pop(); // parenthesized expression
     Token ifToken = pop();
     typePromoter?.enterElse();
     typePromoter?.exitConditional();
@@ -4020,9 +4021,9 @@
   @override
   void endIfElseControlFlow(Token token) {
     debugEvent("endIfElseControlFlow");
-    var elseEntry = pop(); // else entry
-    var thenEntry = pop(); // then entry
-    var condition = pop(); // parenthesized expression
+    Object elseEntry = pop(); // else entry
+    Object thenEntry = pop(); // then entry
+    Object condition = pop(); // parenthesized expression
     Token ifToken = pop();
     typePromoter?.exitConditional();
     if (!library.loader.target.enableControlFlowCollections) {
@@ -4098,7 +4099,7 @@
   @override
   void handleSpreadExpression(Token spreadToken) {
     debugEvent("SpreadExpression");
-    var expression = pop();
+    Object expression = pop();
     if (!library.loader.target.enableSpreadCollections) {
       handleRecoverableError(
           fasta.templateUnexpectedToken.withArguments(spreadToken),
@@ -4418,7 +4419,7 @@
   @override
   void endForInControlFlow(Token token) {
     debugEvent("ForInControlFlow");
-    var entry = pop();
+    Object entry = pop();
     Token inToken = pop();
     Token forToken = pop();
     Token awaitToken = pop(NullValue.AwaitToken);
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index a025fd0..d9ba7e9 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -11,6 +11,7 @@
     show
         Constructor,
         Field,
+        IntLiteral,
         InvalidExpression,
         Let,
         Node,
@@ -85,6 +86,9 @@
 
 import '../scope.dart';
 
+import '../type_inference/type_promotion.dart'
+    show TypePromotionFact, TypePromotionScope;
+
 import 'body_builder.dart' show noLocation;
 
 import 'constness.dart' show Constness;
@@ -194,7 +198,7 @@
   /// The returned expression evaluates to the assigned value, unless
   /// [voidContext] is true, in which case it may evaluate to anything.
   Expression buildAssignment(Expression value, {bool voidContext: false}) {
-    var complexAssignment = startComplexAssignment(value);
+    ComplexAssignmentJudgment complexAssignment = startComplexAssignment(value);
     return _finish(_makeSimpleWrite(value, voidContext, complexAssignment),
         complexAssignment);
   }
@@ -215,9 +219,9 @@
   Expression buildNullAwareAssignment(
       Expression value, DartType type, int offset,
       {bool voidContext: false}) {
-    var complexAssignment = startComplexAssignment(value);
+    ComplexAssignmentJudgment complexAssignment = startComplexAssignment(value);
     if (voidContext) {
-      var nullAwareCombiner = _forest.createConditionalExpression(
+      Expression nullAwareCombiner = _forest.createConditionalExpression(
           buildIsNull(_makeRead(complexAssignment), offset, _helper),
           null,
           _makeWrite(value, false, complexAssignment),
@@ -227,8 +231,9 @@
       complexAssignment?.nullAwareCombiner = nullAwareCombiner;
       return _finish(nullAwareCombiner, complexAssignment);
     }
-    var tmp = new VariableDeclaration.forValue(_makeRead(complexAssignment));
-    var nullAwareCombiner = _forest.createConditionalExpression(
+    VariableDeclaration tmp =
+        new VariableDeclaration.forValue(_makeRead(complexAssignment));
+    Expression nullAwareCombiner = _forest.createConditionalExpression(
         buildIsNull(new VariableGet(tmp), offset, _helper),
         null,
         _makeWrite(value, false, complexAssignment),
@@ -247,11 +252,11 @@
       Procedure interfaceTarget,
       bool isPreIncDec: false,
       bool isPostIncDec: false}) {
-    var complexAssignment = startComplexAssignment(value);
+    ComplexAssignmentJudgment complexAssignment = startComplexAssignment(value);
     complexAssignment?.isPreIncDec = isPreIncDec;
     complexAssignment?.isPostIncDec = isPostIncDec;
-    var combiner = makeBinary(_makeRead(complexAssignment), binaryOperator,
-        interfaceTarget, value, _helper,
+    Expression combiner = makeBinary(_makeRead(complexAssignment),
+        binaryOperator, interfaceTarget, value, _helper,
         offset: offset);
     complexAssignment?.combiner = combiner;
     return _finish(_makeWrite(combiner, voidContext, complexAssignment),
@@ -286,18 +291,20 @@
           interfaceTarget: interfaceTarget,
           isPostIncDec: true);
     }
-    var rhs = _forest.createIntLiteral(1, null)..fileOffset = offset;
-    var complexAssignment = startComplexAssignment(rhs);
-    var value = new VariableDeclaration.forValue(_makeRead(complexAssignment));
+    IntLiteral rhs = _forest.createIntLiteral(1, null)..fileOffset = offset;
+    ComplexAssignmentJudgment complexAssignment = startComplexAssignment(rhs);
+    VariableDeclaration value =
+        new VariableDeclaration.forValue(_makeRead(complexAssignment));
     valueAccess() => new VariableGet(value);
-    var combiner = makeBinary(
+    Expression combiner = makeBinary(
         valueAccess(), binaryOperator, interfaceTarget, rhs, _helper,
         offset: offset);
     complexAssignment?.combiner = combiner;
     complexAssignment?.isPostIncDec = true;
-    var dummy = new VariableDeclarationJudgment.forValue(
-        _makeWrite(combiner, true, complexAssignment),
-        _helper.functionNestingLevel);
+    VariableDeclarationJudgment dummy =
+        new VariableDeclarationJudgment.forValue(
+            _makeWrite(combiner, true, complexAssignment),
+            _helper.functionNestingLevel);
     return _finish(
         makeLet(value, makeLet(dummy, valueAccess())), complexAssignment);
   }
@@ -531,10 +538,10 @@
 
   @override
   Expression _makeRead(ComplexAssignmentJudgment complexAssignment) {
-    var fact = _helper.typePromoter
+    TypePromotionFact fact = _helper.typePromoter
         ?.getFactForAccess(variable, _helper.functionNestingLevel);
-    var scope = _helper.typePromoter?.currentScope;
-    var read = new VariableGetJudgment(variable, fact, scope)
+    TypePromotionScope scope = _helper.typePromoter?.currentScope;
+    VariableGetJudgment read = new VariableGetJudgment(variable, fact, scope)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.read = read;
     return read;
@@ -664,7 +671,7 @@
   @override
   Expression _makeSimpleWrite(Expression value, bool voidContext,
       ComplexAssignmentJudgment complexAssignment) {
-    var write = new PropertySet(receiver, name, value, setter)
+    PropertySet write = new PropertySet(receiver, name, value, setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
     return write;
@@ -672,7 +679,7 @@
 
   @override
   Expression _makeRead(ComplexAssignmentJudgment complexAssignment) {
-    var read = new PropertyGet(receiverAccess(), name, getter)
+    PropertyGet read = new PropertyGet(receiverAccess(), name, getter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.read = read;
     return read;
@@ -681,7 +688,7 @@
   @override
   Expression _makeWrite(Expression value, bool voidContext,
       ComplexAssignmentJudgment complexAssignment) {
-    var write = new PropertySet(receiverAccess(), name, value, setter)
+    PropertySet write = new PropertySet(receiverAccess(), name, value, setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
     return write;
@@ -780,7 +787,7 @@
     if (getter == null) {
       _helper.warnUnresolvedGet(name, offsetForToken(token));
     }
-    var read =
+    PropertyGet read =
         new PropertyGet(_forest.createThisExpression(token), name, getter)
           ..fileOffset = offsetForToken(token);
     complexAssignment?.read = read;
@@ -793,7 +800,7 @@
     if (setter == null) {
       _helper.warnUnresolvedSet(name, offsetForToken(token));
     }
-    var write = new PropertySet(
+    PropertySet write = new PropertySet(
         _forest.createThisExpression(token), name, value, setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
@@ -866,7 +873,7 @@
 
   @override
   Expression _makeRead(ComplexAssignmentJudgment complexAssignment) {
-    var read = new PropertyGet(receiverAccess(), name, getter)
+    PropertyGet read = new PropertyGet(receiverAccess(), name, getter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.read = read;
     return read;
@@ -875,7 +882,7 @@
   @override
   Expression _makeWrite(Expression value, bool voidContext,
       ComplexAssignmentJudgment complexAssignment) {
-    var write = new PropertySet(receiverAccess(), name, value, setter)
+    PropertySet write = new PropertySet(receiverAccess(), name, value, setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
     return write;
@@ -884,8 +891,8 @@
   @override
   Expression _finish(
       Expression body, ComplexAssignmentJudgment complexAssignment) {
-    var offset = offsetForToken(token);
-    var nullAwareGuard = _forest.createConditionalExpression(
+    int offset = offsetForToken(token);
+    Expression nullAwareGuard = _forest.createConditionalExpression(
         buildIsNull(receiverAccess(), offset, _helper),
         null,
         _forest.createNullLiteral(null)..fileOffset = offset,
@@ -955,8 +962,9 @@
       _helper.warnUnresolvedGet(name, offsetForToken(token), isSuper: true);
     }
     // TODO(ahe): Use [DirectPropertyGet] when possible.
-    var read = new SuperPropertyGetJudgment(name, interfaceTarget: getter)
-      ..fileOffset = offsetForToken(token);
+    SuperPropertyGetJudgment read =
+        new SuperPropertyGetJudgment(name, interfaceTarget: getter)
+          ..fileOffset = offsetForToken(token);
     complexAssignment?.read = read;
     return read;
   }
@@ -968,7 +976,7 @@
       _helper.warnUnresolvedSet(name, offsetForToken(token), isSuper: true);
     }
     // TODO(ahe): Use [DirectPropertySet] when possible.
-    var write = new SuperPropertySet(name, value, setter)
+    SuperPropertySet write = new SuperPropertySet(name, value, setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
     return write;
@@ -1048,8 +1056,8 @@
 
   @override
   Expression _makeSimpleRead() {
-    var read = new MethodInvocationJudgment(receiver, indexGetName,
-        _forest.createArguments(<Expression>[index], token),
+    MethodInvocationJudgment read = new MethodInvocationJudgment(receiver,
+        indexGetName, _forest.createArguments(<Expression>[index], token),
         interfaceTarget: getter)
       ..fileOffset = offsetForToken(token);
     return read;
@@ -1059,7 +1067,9 @@
   Expression _makeSimpleWrite(Expression value, bool voidContext,
       ComplexAssignmentJudgment complexAssignment) {
     if (!voidContext) return _makeWriteAndReturn(value, complexAssignment);
-    var write = new MethodInvocationJudgment(receiver, indexSetName,
+    MethodInvocationJudgment write = new MethodInvocationJudgment(
+        receiver,
+        indexSetName,
         _forest.createArguments(<Expression>[index, value], token),
         interfaceTarget: setter)
       ..fileOffset = offsetForToken(token);
@@ -1069,7 +1079,9 @@
 
   @override
   Expression _makeRead(ComplexAssignmentJudgment complexAssignment) {
-    var read = new MethodInvocationJudgment(receiverAccess(), indexGetName,
+    MethodInvocationJudgment read = new MethodInvocationJudgment(
+        receiverAccess(),
+        indexGetName,
         _forest.createArguments(<Expression>[indexAccess()], token),
         interfaceTarget: getter)
       ..fileOffset = offsetForToken(token);
@@ -1081,7 +1093,9 @@
   Expression _makeWrite(Expression value, bool voidContext,
       ComplexAssignmentJudgment complexAssignment) {
     if (!voidContext) return _makeWriteAndReturn(value, complexAssignment);
-    var write = new MethodInvocationJudgment(receiverAccess(), indexSetName,
+    MethodInvocationJudgment write = new MethodInvocationJudgment(
+        receiverAccess(),
+        indexSetName,
         _forest.createArguments(<Expression>[indexAccess(), value], token),
         interfaceTarget: setter)
       ..fileOffset = offsetForToken(token);
@@ -1095,8 +1109,8 @@
       Expression value, ComplexAssignmentJudgment complexAssignment) {
     // The call to []= does not return the value like direct-style assignments
     // do.  We need to bind the value in a let.
-    var valueVariable = new VariableDeclaration.forValue(value);
-    var write = new MethodInvocationJudgment(
+    VariableDeclaration valueVariable = new VariableDeclaration.forValue(value);
+    MethodInvocationJudgment write = new MethodInvocationJudgment(
         receiverAccess(),
         indexSetName,
         _forest.createArguments(
@@ -1104,8 +1118,9 @@
         interfaceTarget: setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
-    var dummy = new VariableDeclarationJudgment.forValue(
-        write, _helper.functionNestingLevel);
+    VariableDeclarationJudgment dummy =
+        new VariableDeclarationJudgment.forValue(
+            write, _helper.functionNestingLevel);
     return makeLet(
         valueVariable, makeLet(dummy, new VariableGet(valueVariable)));
   }
@@ -1194,8 +1209,8 @@
 
   Expression _makeWriteAndReturn(
       Expression value, ComplexAssignmentJudgment complexAssignment) {
-    var valueVariable = new VariableDeclaration.forValue(value);
-    var write = new MethodInvocationJudgment(
+    VariableDeclaration valueVariable = new VariableDeclaration.forValue(value);
+    MethodInvocationJudgment write = new MethodInvocationJudgment(
         _forest.createThisExpression(token),
         indexSetName,
         _forest.createArguments(
@@ -1203,7 +1218,7 @@
         interfaceTarget: setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
-    var dummy = new VariableDeclaration.forValue(write);
+    VariableDeclaration dummy = new VariableDeclaration.forValue(write);
     return makeLet(
         valueVariable, makeLet(dummy, new VariableGet(valueVariable)));
   }
@@ -1220,7 +1235,7 @@
   Expression _makeSimpleWrite(Expression value, bool voidContext,
       ComplexAssignmentJudgment complexAssignment) {
     if (!voidContext) return _makeWriteAndReturn(value, complexAssignment);
-    var write = new MethodInvocationJudgment(
+    MethodInvocationJudgment write = new MethodInvocationJudgment(
         _forest.createThisExpression(token),
         indexSetName,
         _forest.createArguments(<Expression>[index, value], token),
@@ -1232,7 +1247,7 @@
 
   @override
   Expression _makeRead(ComplexAssignmentJudgment complexAssignment) {
-    var read = new MethodInvocationJudgment(
+    MethodInvocationJudgment read = new MethodInvocationJudgment(
         _forest.createThisExpression(token),
         indexGetName,
         _forest.createArguments(<Expression>[indexAccess()], token),
@@ -1246,7 +1261,7 @@
   Expression _makeWrite(Expression value, bool voidContext,
       ComplexAssignmentJudgment complexAssignment) {
     if (!voidContext) return _makeWriteAndReturn(value, complexAssignment);
-    var write = new MethodInvocationJudgment(
+    MethodInvocationJudgment write = new MethodInvocationJudgment(
         _forest.createThisExpression(token),
         indexSetName,
         _forest.createArguments(<Expression>[indexAccess(), value], token),
@@ -1311,19 +1326,19 @@
 
   Expression _makeWriteAndReturn(
       Expression value, ComplexAssignmentJudgment complexAssignment) {
-    var valueVariable = new VariableDeclaration.forValue(value);
+    VariableDeclaration valueVariable = new VariableDeclaration.forValue(value);
     if (setter == null) {
       _helper.warnUnresolvedMethod(indexSetName, offsetForToken(token),
           isSuper: true);
     }
-    var write = new SuperMethodInvocation(
+    SuperMethodInvocation write = new SuperMethodInvocation(
         indexSetName,
         _forest.createArguments(
             <Expression>[indexAccess(), new VariableGet(valueVariable)], token),
         setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
-    var dummy = new VariableDeclaration.forValue(write);
+    VariableDeclaration dummy = new VariableDeclaration.forValue(write);
     return makeLet(
         valueVariable, makeLet(dummy, new VariableGet(valueVariable)));
   }
@@ -1349,7 +1364,7 @@
       _helper.warnUnresolvedMethod(indexSetName, offsetForToken(token),
           isSuper: true);
     }
-    var write = new SuperMethodInvocation(indexSetName,
+    SuperMethodInvocation write = new SuperMethodInvocation(indexSetName,
         _forest.createArguments(<Expression>[index, value], token), setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
@@ -1362,7 +1377,7 @@
       _helper.warnUnresolvedMethod(indexGetName, offsetForToken(token),
           isSuper: true);
     }
-    var read = new SuperMethodInvocation(indexGetName,
+    SuperMethodInvocation read = new SuperMethodInvocation(indexGetName,
         _forest.createArguments(<Expression>[indexAccess()], token), getter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.read = read;
@@ -1377,7 +1392,7 @@
       _helper.warnUnresolvedMethod(indexSetName, offsetForToken(token),
           isSuper: true);
     }
-    var write = new SuperMethodInvocation(
+    SuperMethodInvocation write = new SuperMethodInvocation(
         indexSetName,
         _forest.createArguments(<Expression>[indexAccess(), value], token),
         setter)
@@ -1802,7 +1817,7 @@
   @override
   Expression _makeRead(ComplexAssignmentJudgment complexAssignment) {
     builder.importDependency.targetLibrary;
-    var read = new LoadLibraryTearOffJudgment(
+    LoadLibraryTearOffJudgment read = new LoadLibraryTearOffJudgment(
         builder.importDependency, builder.createTearoffMethod(_helper.forest))
       ..fileOffset = offsetForToken(token);
     complexAssignment?.read = read;
@@ -3266,7 +3281,7 @@
     sink.write(", name: ");
     sink.write(name.name);
     sink.write(", arguments: ");
-    var node = arguments;
+    Arguments node = arguments;
     if (node is Node) {
       printNodeOn(node, sink);
     } else {
diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
index 2c7a1d3..dcfc73d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -56,9 +56,9 @@
   }
 
   void visitAssertStatementJudgment(AssertStatementJudgment node) {
-    var conditionJudgment = node.conditionJudgment;
-    var messageJudgment = node.messageJudgment;
-    var expectedType = inferrer.coreTypes.boolClass.rawType;
+    Expression conditionJudgment = node.conditionJudgment;
+    Expression messageJudgment = node.messageJudgment;
+    InterfaceType expectedType = inferrer.coreTypes.boolClass.rawType;
     inferrer.inferExpression(
         conditionJudgment, expectedType, !inferrer.isTopLevel);
     inferrer.ensureAssignable(
@@ -77,7 +77,7 @@
     if (!inferrer.typeSchemaEnvironment.isEmptyContext(typeContext)) {
       typeContext = inferrer.wrapFutureOrType(typeContext);
     }
-    var operand = node.operand;
+    Expression operand = node.operand;
     inferrer.inferExpression(operand, typeContext, true, isVoidAllowed: true);
     inferrer.storeInferredType(
         node,
@@ -86,7 +86,7 @@
   }
 
   void visitBlockJudgment(BlockJudgment node) {
-    for (var judgment in node.judgments) {
+    for (Statement judgment in node.judgments) {
       inferrer.inferStatement(judgment);
     }
   }
@@ -103,7 +103,7 @@
     node.inferredType =
         inferrer.inferExpression(node.targetJudgment, typeContext, true);
     node.variable.type = getInferredType(node, inferrer);
-    for (var judgment in node.cascadeJudgments) {
+    for (Expression judgment in node.cascadeJudgments) {
       inferrer.inferExpression(
           judgment, const UnknownType(), !inferrer.isTopLevel,
           isVoidAllowed: true);
@@ -114,10 +114,10 @@
   @override
   void visitConditionalExpression(
       ConditionalExpression node, DartType typeContext) {
-    var condition = node.condition;
-    var then = node.then;
-    var otherwise = node.otherwise;
-    var expectedType = inferrer.coreTypes.boolClass.rawType;
+    Expression condition = node.condition;
+    Expression then = node.then;
+    Expression otherwise = node.otherwise;
+    InterfaceType expectedType = inferrer.coreTypes.boolClass.rawType;
     inferrer.inferExpression(condition, expectedType, !inferrer.isTopLevel);
     inferrer.ensureAssignable(
         expectedType,
@@ -135,7 +135,7 @@
   @override
   void visitConstructorInvocation(
       ConstructorInvocation node, DartType typeContext) {
-    var library = inferrer.engine.beingInferred[node.target];
+    LibraryBuilder library = inferrer.engine.beingInferred[node.target];
     if (library != null) {
       // There is a cyclic dependency where inferring the types of the
       // initializing formals of a constructor required us to infer the
@@ -152,26 +152,30 @@
           node.target.fileOffset,
           name.length,
           node.target.fileUri);
-      for (var declaration in node.target.function.positionalParameters) {
+      for (VariableDeclaration declaration
+          in node.target.function.positionalParameters) {
         declaration.type ??= const InvalidType();
       }
-      for (var declaration in node.target.function.namedParameters) {
+      for (VariableDeclaration declaration
+          in node.target.function.namedParameters) {
         declaration.type ??= const InvalidType();
       }
     } else if ((library = inferrer.engine.toBeInferred[node.target]) != null) {
       inferrer.engine.toBeInferred.remove(node.target);
       inferrer.engine.beingInferred[node.target] = library;
-      for (var declaration in node.target.function.positionalParameters) {
+      for (VariableDeclaration declaration
+          in node.target.function.positionalParameters) {
         inferrer.engine.inferInitializingFormal(declaration, node.target);
       }
-      for (var declaration in node.target.function.namedParameters) {
+      for (VariableDeclaration declaration
+          in node.target.function.namedParameters) {
         inferrer.engine.inferInitializingFormal(declaration, node.target);
       }
       inferrer.engine.beingInferred.remove(node.target);
     }
     bool hasExplicitTypeArguments =
         getExplicitTypeArguments(node.arguments) != null;
-    var inferenceResult = inferrer.inferInvocation(
+    ExpressionInferenceResult inferenceResult = inferrer.inferInvocation(
         typeContext,
         node.fileOffset,
         node.target.function.functionType,
@@ -196,16 +200,16 @@
       DeferredCheckJudgment node, DartType typeContext) {
     // Since the variable is not used in the body we don't need to type infer
     // it.  We can just type infer the body.
-    var judgment = node.judgment;
+    Expression judgment = node.judgment;
     inferrer.inferExpression(judgment, typeContext, true, isVoidAllowed: true);
     node.inferredType = getInferredType(judgment, inferrer);
     return null;
   }
 
   void visitDoJudgment(DoJudgment node) {
-    var conditionJudgment = node.conditionJudgment;
+    Expression conditionJudgment = node.conditionJudgment;
     inferrer.inferStatement(node.body);
-    var boolType = inferrer.coreTypes.boolClass.rawType;
+    InterfaceType boolType = inferrer.coreTypes.boolClass.rawType;
     inferrer.inferExpression(conditionJudgment, boolType, !inferrer.isTopLevel);
     inferrer.ensureAssignable(
         boolType,
@@ -232,7 +236,7 @@
       FactoryConstructorInvocationJudgment node, DartType typeContext) {
     bool hadExplicitTypeArguments =
         getExplicitTypeArguments(node.arguments) != null;
-    var inferenceResult = inferrer.inferInvocation(
+    ExpressionInferenceResult inferenceResult = inferrer.inferInvocation(
         typeContext,
         node.fileOffset,
         node.target.function.functionType,
@@ -252,7 +256,7 @@
   }
 
   void visitShadowFieldInitializer(ShadowFieldInitializer node) {
-    var initializerType =
+    DartType initializerType =
         inferrer.inferExpression(node.value, node.field.type, true);
     inferrer.ensureAssignable(
         node.field.type, initializerType, node.value, node.fileOffset);
@@ -410,7 +414,7 @@
   }
 
   void visitForJudgment(ForJudgment node) {
-    var conditionJudgment = node.conditionJudgment;
+    Expression conditionJudgment = node.conditionJudgment;
     for (VariableDeclaration variable in node.variables) {
       if (variable.name == null) {
         Expression initializer = variable.initializer;
@@ -424,7 +428,7 @@
       }
     }
     if (conditionJudgment != null) {
-      var expectedType = inferrer.coreTypes.boolClass.rawType;
+      InterfaceType expectedType = inferrer.coreTypes.boolClass.rawType;
       inferrer.inferExpression(
           conditionJudgment, expectedType, !inferrer.isTopLevel);
       inferrer.ensureAssignable(
@@ -433,7 +437,7 @@
           node.condition,
           node.condition.fileOffset);
     }
-    for (var update in node.updateJudgments) {
+    for (Expression update in node.updateJudgments) {
       inferrer.inferExpression(
           update, const UnknownType(), !inferrer.isTopLevel,
           isVoidAllowed: true);
@@ -454,22 +458,22 @@
     inferrer.inferMetadataKeepingHelper(node.variable.annotations);
     DartType returnContext =
         node._hasImplicitReturnType ? null : node.function.returnType;
-    var inferenceResult = visitFunctionNodeJudgment(
+    ExpressionInferenceResult inferenceResult = visitFunctionNodeJudgment(
         node.functionJudgment, null, returnContext, node.fileOffset);
     node.variable.type = inferenceResult.type;
   }
 
   @override
   void visitFunctionExpression(FunctionExpression node, DartType typeContext) {
-    var inferenceResult = visitFunctionNodeJudgment(
+    ExpressionInferenceResult inferenceResult = visitFunctionNodeJudgment(
         node.function, typeContext, null, node.fileOffset);
     inferrer.storeInferredType(node, inferenceResult.type);
   }
 
   void visitInvalidSuperInitializerJudgment(
       InvalidSuperInitializerJudgment node) {
-    var substitution = Substitution.fromSupertype(inferrer.classHierarchy
-        .getClassAsInstanceOf(
+    Substitution substitution = Substitution.fromSupertype(
+        inferrer.classHierarchy.getClassAsInstanceOf(
             inferrer.thisType.classNode, node.target.enclosingClass));
     inferrer.inferInvocation(
         null,
@@ -482,12 +486,12 @@
   }
 
   void visitIfNullJudgment(IfNullJudgment node, DartType typeContext) {
-    var leftJudgment = node.leftJudgment;
-    var rightJudgment = node.rightJudgment;
+    Expression leftJudgment = node.leftJudgment;
+    Expression rightJudgment = node.rightJudgment;
     // To infer `e0 ?? e1` in context K:
     // - Infer e0 in context K to get T0
     inferrer.inferExpression(leftJudgment, typeContext, true);
-    var lhsType = getInferredType(leftJudgment, inferrer);
+    DartType lhsType = getInferredType(leftJudgment, inferrer);
     node.variable.type = lhsType;
     // - Let J = T0 if K is `?` else K.
     // - Infer e1 in context J to get T1
@@ -498,7 +502,7 @@
       inferrer.inferExpression(rightJudgment, typeContext, true,
           isVoidAllowed: true);
     }
-    var rhsType = getInferredType(rightJudgment, inferrer);
+    DartType rhsType = getInferredType(rightJudgment, inferrer);
     // - Let T = greatest closure of K with respect to `?` if K is not `_`, else
     //   UP(t0, t1)
     // - Then the inferred type is T.
@@ -509,8 +513,8 @@
   }
 
   void visitIfJudgment(IfJudgment node) {
-    var conditionJudgment = node.conditionJudgment;
-    var expectedType = inferrer.coreTypes.boolClass.rawType;
+    Expression conditionJudgment = node.conditionJudgment;
+    InterfaceType expectedType = inferrer.coreTypes.boolClass.rawType;
     inferrer.inferExpression(
         conditionJudgment, expectedType, !inferrer.isTopLevel);
     inferrer.ensureAssignable(
@@ -539,13 +543,13 @@
 
   void visitIndexAssignmentJudgment(
       IndexAssignmentJudgment node, DartType typeContext) {
-    var receiverType = node._inferReceiver(inferrer);
-    var writeMember =
+    DartType receiverType = node._inferReceiver(inferrer);
+    Object writeMember =
         inferrer.findMethodInvocationMember(receiverType, node.write);
     // To replicate analyzer behavior, we base type inference on the write
     // member.  TODO(paulberry): would it be better to use the read member
     // when doing compound assignment?
-    var calleeType = inferrer.getCalleeFunctionType(
+    FunctionType calleeType = inferrer.getCalleeFunctionType(
         inferrer.getCalleeType(writeMember, receiverType), false);
     DartType expectedIndexTypeForWrite;
     DartType indexContext = const UnknownType();
@@ -558,7 +562,7 @@
       writeContext = calleeType.positionalParameters[1];
     }
     inferrer.inferExpression(node.index, indexContext, true);
-    var indexType = getInferredType(node.index, inferrer);
+    DartType indexType = getInferredType(node.index, inferrer);
     node._storeLetType(inferrer, node.index, indexType);
     if (writeContext is! UnknownType) {
       inferrer.ensureAssignable(
@@ -570,9 +574,9 @@
     InvocationExpression read = node.read;
     DartType readType;
     if (read != null) {
-      var readMember = inferrer.findMethodInvocationMember(receiverType, read,
-          instrumented: false);
-      var calleeFunctionType = inferrer.getCalleeFunctionType(
+      Object readMember = inferrer
+          .findMethodInvocationMember(receiverType, read, instrumented: false);
+      FunctionType calleeFunctionType = inferrer.getCalleeFunctionType(
           inferrer.getCalleeType(readMember, receiverType), false);
       inferrer.ensureAssignable(
           getPositionalParameterType(calleeFunctionType, 0),
@@ -580,10 +584,12 @@
           node._getInvocationArguments(inferrer, read).positional[0],
           read.fileOffset);
       readType = calleeFunctionType.returnType;
-      var desugaredInvocation = read is MethodInvocation ? read : null;
-      var checkKind = inferrer.preCheckInvocationContravariance(node.receiver,
-          receiverType, readMember, desugaredInvocation, read.arguments, read);
-      var replacedRead = inferrer.handleInvocationContravariance(
+      MethodInvocation desugaredInvocation =
+          read is MethodInvocation ? read : null;
+      MethodContravarianceCheckKind checkKind =
+          inferrer.preCheckInvocationContravariance(node.receiver, receiverType,
+              readMember, desugaredInvocation, read.arguments, read);
+      Expression replacedRead = inferrer.handleInvocationContravariance(
           checkKind,
           desugaredInvocation,
           read.arguments,
@@ -855,8 +861,8 @@
 
   void visitListLiteralJudgment(
       ListLiteralJudgment node, DartType typeContext) {
-    var listClass = inferrer.coreTypes.listClass;
-    var listType = listClass.thisType;
+    Class listClass = inferrer.coreTypes.listClass;
+    InterfaceType listType = listClass.thisType;
     List<DartType> inferredTypes;
     DartType inferredTypeArgument;
     List<DartType> formalTypes;
@@ -930,9 +936,9 @@
 
   @override
   void visitLogicalExpression(LogicalExpression node, DartType typeContext) {
-    var boolType = inferrer.coreTypes.boolClass.rawType;
-    var left = node.left;
-    var right = node.right;
+    InterfaceType boolType = inferrer.coreTypes.boolClass.rawType;
+    Expression left = node.left;
+    Expression right = node.right;
     inferrer.inferExpression(left, boolType, !inferrer.isTopLevel);
     inferrer.inferExpression(right, boolType, !inferrer.isTopLevel);
     inferrer.ensureAssignable(boolType, getInferredType(left, inferrer),
@@ -1267,8 +1273,8 @@
   }
 
   void visitMapLiteralJudgment(MapLiteralJudgment node, DartType typeContext) {
-    var mapClass = inferrer.coreTypes.mapClass;
-    var mapType = mapClass.thisType;
+    Class mapClass = inferrer.coreTypes.mapClass;
+    InterfaceType mapType = mapClass.thisType;
     List<DartType> inferredTypes;
     DartType inferredKeyType;
     DartType inferredValueType;
@@ -1551,7 +1557,7 @@
         }
       }
     }
-    var inferenceResult = inferrer.inferMethodInvocation(
+    ExpressionInferenceResult inferenceResult = inferrer.inferMethodInvocation(
         node, node.receiver, node.fileOffset, node._isImplicitCall, typeContext,
         desugaredInvocation: node);
     node.inferredType = inferenceResult.type;
@@ -1568,8 +1574,8 @@
 
   @override
   void visitNot(Not node, DartType typeContext) {
-    var operand = node.operand;
-    var boolType = inferrer.coreTypes.boolClass.rawType;
+    Expression operand = node.operand;
+    InterfaceType boolType = inferrer.coreTypes.boolClass.rawType;
     inferrer.inferExpression(operand, boolType, !inferrer.isTopLevel);
     inferrer.ensureAssignable(boolType, getInferredType(operand, inferrer),
         node.operand, node.fileOffset);
@@ -1577,7 +1583,7 @@
 
   void visitNullAwareMethodInvocationJudgment(
       NullAwareMethodInvocationJudgment node, DartType typeContext) {
-    var inferenceResult = inferrer.inferMethodInvocation(
+    ExpressionInferenceResult inferenceResult = inferrer.inferMethodInvocation(
         node, node.variable.initializer, node.fileOffset, false, typeContext,
         receiverVariable: node.variable,
         desugaredInvocation: node._desugaredInvocation);
@@ -1615,12 +1621,12 @@
 
   void visitPropertyAssignmentJudgment(
       PropertyAssignmentJudgment node, DartType typeContext) {
-    var receiverType = node._inferReceiver(inferrer);
+    DartType receiverType = node._inferReceiver(inferrer);
 
     DartType readType;
     if (node.read != null) {
-      var readMember = inferrer.findPropertyGetMember(receiverType, node.read,
-          instrumented: false);
+      Object readMember = inferrer
+          .findPropertyGetMember(receiverType, node.read, instrumented: false);
       readType = inferrer.getCalleeType(readMember, receiverType);
       inferrer.handlePropertyGetContravariance(
           node.receiver,
@@ -1638,7 +1644,7 @@
     // To replicate analyzer behavior, we base type inference on the write
     // member.  TODO(paulberry): would it be better to use the read member when
     // doing compound assignment?
-    var writeContext = inferrer.getSetterType(writeMember, receiverType);
+    DartType writeContext = inferrer.getSetterType(writeMember, receiverType);
     node._inferRhs(inferrer, readType, writeContext);
     node.nullAwareGuard?.staticType = node.inferredType;
     node._replaceWithDesugared();
@@ -1676,8 +1682,8 @@
   void visitRethrow(Rethrow node, DartType typeContext) {}
 
   void visitReturnJudgment(ReturnJudgment node) {
-    var judgment = node.judgment;
-    var closureContext = inferrer.closureContext;
+    Expression judgment = node.judgment;
+    ClosureContext closureContext = inferrer.closureContext;
     DartType typeContext = !closureContext.isGenerator
         ? closureContext.returnOrYieldContext
         : const UnknownType();
@@ -1694,8 +1700,8 @@
   }
 
   void visitSetLiteralJudgment(SetLiteralJudgment node, DartType typeContext) {
-    var setClass = inferrer.coreTypes.setClass;
-    var setType = setClass.thisType;
+    Class setClass = inferrer.coreTypes.setClass;
+    InterfaceType setType = setClass.thisType;
     List<DartType> inferredTypes;
     DartType inferredTypeArgument;
     List<DartType> formalTypes;
@@ -1772,14 +1778,14 @@
   void visitStaticAssignmentJudgment(
       StaticAssignmentJudgment node, DartType typeContext) {
     DartType readType = const DynamicType(); // Only used in error recovery
-    var read = node.read;
+    Expression read = node.read;
     if (read is StaticGet) {
       readType = read.target.getterType;
       node._storeLetType(inferrer, read, readType);
     }
     Member writeMember;
     DartType writeContext = const UnknownType();
-    var write = node.write;
+    Expression write = node.write;
     if (write is StaticSet) {
       writeContext = write.target.setterType;
       writeMember = write.target;
@@ -1792,9 +1798,9 @@
 
   @override
   void visitStaticGet(StaticGet node, DartType typeContext) {
-    var target = node.target;
+    Member target = node.target;
     TypeInferenceEngine.resolveInferenceNode(target);
-    var type = target.getterType;
+    DartType type = target.getterType;
     if (target is Procedure && target.kind == ProcedureKind.Method) {
       type = inferrer.instantiateTearOff(type, typeContext, node);
     }
@@ -1808,8 +1814,12 @@
         : new FunctionType([], const DynamicType());
     bool hadExplicitTypeArguments =
         getExplicitTypeArguments(node.arguments) != null;
-    var inferenceResult = inferrer.inferInvocation(typeContext, node.fileOffset,
-        calleeType, calleeType.returnType, node.arguments);
+    ExpressionInferenceResult inferenceResult = inferrer.inferInvocation(
+        typeContext,
+        node.fileOffset,
+        calleeType,
+        calleeType.returnType,
+        node.arguments);
     inferrer.storeInferredType(node, inferenceResult.type);
     if (!hadExplicitTypeArguments && node.target != null) {
       inferrer.library?.checkBoundsInStaticInvocation(
@@ -1822,7 +1832,7 @@
   void visitStringConcatenation(
       StringConcatenation node, DartType typeContext) {
     if (!inferrer.isTopLevel) {
-      for (var expression in node.expressions) {
+      for (Expression expression in node.expressions) {
         inferrer.inferExpression(
             expression, const UnknownType(), !inferrer.isTopLevel);
       }
@@ -1833,8 +1843,8 @@
   void visitStringLiteral(StringLiteral node, DartType typeContext) {}
 
   void visitSuperInitializerJudgment(SuperInitializerJudgment node) {
-    var substitution = Substitution.fromSupertype(inferrer.classHierarchy
-        .getClassAsInstanceOf(
+    Substitution substitution = Substitution.fromSupertype(
+        inferrer.classHierarchy.getClassAsInstanceOf(
             inferrer.thisType.classNode, node.target.enclosingClass));
     inferrer.inferInvocation(
         null,
@@ -1852,7 +1862,7 @@
       inferrer.instrumentation?.record(inferrer.uri, node.fileOffset, 'target',
           new InstrumentationValueForMember(node.interfaceTarget));
     }
-    var inferenceResult = inferrer.inferMethodInvocation(
+    ExpressionInferenceResult inferenceResult = inferrer.inferMethodInvocation(
         node, null, node.fileOffset, false, typeContext,
         interfaceMember: node.interfaceTarget,
         methodName: node.name,
@@ -1871,12 +1881,12 @@
   }
 
   void visitSwitchStatementJudgment(SwitchStatementJudgment node) {
-    var expressionJudgment = node.expressionJudgment;
+    Expression expressionJudgment = node.expressionJudgment;
     inferrer.inferExpression(expressionJudgment, const UnknownType(), true);
-    var expressionType = getInferredType(expressionJudgment, inferrer);
+    DartType expressionType = getInferredType(expressionJudgment, inferrer);
 
-    for (var switchCase in node.caseJudgments) {
-      for (var caseExpression in switchCase.expressionJudgments) {
+    for (SwitchCaseJudgment switchCase in node.caseJudgments) {
+      for (Expression caseExpression in switchCase.expressionJudgments) {
         DartType caseExpressionType =
             inferrer.inferExpression(caseExpression, expressionType, true);
 
@@ -1958,7 +1968,7 @@
 
   void visitTryCatchJudgment(TryCatchJudgment node) {
     inferrer.inferStatement(node.body);
-    for (var catch_ in node.catchJudgments) {
+    for (CatchJudgment catch_ in node.catchJudgments) {
       visitCatchJudgment(catch_);
     }
   }
@@ -1977,12 +1987,12 @@
   void visitVariableAssignmentJudgment(
       VariableAssignmentJudgment node, DartType typeContext) {
     DartType readType;
-    var read = node.read;
+    Expression read = node.read;
     if (read is VariableGet) {
       readType = read.promotedType ?? read.variable.type;
     }
     DartType writeContext = const UnknownType();
-    var write = node.write;
+    Expression write = node.write;
     if (write is VariableSet) {
       writeContext = write.variable.type;
       if (read != null) {
@@ -1995,8 +2005,9 @@
   }
 
   void visitVariableDeclarationJudgment(VariableDeclarationJudgment node) {
-    var initializerJudgment = node.initializerJudgment;
-    var declaredType = node._implicitlyTyped ? const UnknownType() : node.type;
+    Expression initializerJudgment = node.initializerJudgment;
+    DartType declaredType =
+        node._implicitlyTyped ? const UnknownType() : node.type;
     DartType inferredType;
     DartType initializerType;
     if (initializerJudgment != null) {
@@ -2014,7 +2025,7 @@
       node.type = inferredType;
     }
     if (node.initializer != null) {
-      var replacedInitializer = inferrer.ensureAssignable(
+      Expression replacedInitializer = inferrer.ensureAssignable(
           node.type, initializerType, node.initializer, node.fileOffset,
           isVoidAllowed: node.type is VoidType);
       if (replacedInitializer != null) {
@@ -2033,7 +2044,7 @@
 
   void visitUnresolvedTargetInvocationJudgment(
       UnresolvedTargetInvocationJudgment node, DartType typeContext) {
-    var result = visitSyntheticExpressionJudgment(node, typeContext);
+    void result = visitSyntheticExpressionJudgment(node, typeContext);
     inferrer.inferInvocation(
         typeContext,
         node.fileOffset,
@@ -2065,7 +2076,7 @@
           'promotedType', new InstrumentationValueForType(promotedType));
     }
     node.promotedType = promotedType;
-    var type = promotedType ?? declaredOrInferredType;
+    DartType type = promotedType ?? declaredOrInferredType;
     if (variable._isLocalFunction) {
       type = inferrer.instantiateTearOff(type, typeContext, node);
     }
@@ -2074,8 +2085,8 @@
   }
 
   void visitWhileJudgment(WhileJudgment node) {
-    var conditionJudgment = node.conditionJudgment;
-    var expectedType = inferrer.coreTypes.boolClass.rawType;
+    Expression conditionJudgment = node.conditionJudgment;
+    InterfaceType expectedType = inferrer.coreTypes.boolClass.rawType;
     inferrer.inferExpression(
         conditionJudgment, expectedType, !inferrer.isTopLevel);
     inferrer.ensureAssignable(
@@ -2087,10 +2098,10 @@
   }
 
   void visitYieldJudgment(YieldJudgment node) {
-    var judgment = node.judgment;
-    var closureContext = inferrer.closureContext;
+    Expression judgment = node.judgment;
+    ClosureContext closureContext = inferrer.closureContext;
     if (closureContext.isGenerator) {
-      var typeContext = closureContext.returnOrYieldContext;
+      DartType typeContext = closureContext.returnOrYieldContext;
       if (node.isYieldStar && typeContext != null) {
         typeContext = inferrer.wrapType(
             typeContext,
@@ -2111,7 +2122,7 @@
     node.inferredType =
         inferrer.typeSchemaEnvironment.futureType(const DynamicType());
     if (node.arguments != null) {
-      var calleeType = new FunctionType([], node.inferredType);
+      FunctionType calleeType = new FunctionType([], node.inferredType);
       inferrer.inferInvocation(typeContext, node.fileOffset, calleeType,
           calleeType.returnType, node.argumentJudgments);
     }
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index db9a1c5..00f8141 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -33,6 +33,8 @@
         InstrumentationValueForType,
         InstrumentationValueForTypeArgs;
 
+import '../builder/library_builder.dart' show LibraryBuilder;
+
 import '../fasta_codes.dart'
     show
         messageCantDisambiguateAmbiguousInformation,
@@ -65,7 +67,12 @@
     show IncludesTypeParametersNonCovariantly, TypeInferenceEngine;
 
 import '../type_inference/type_inferrer.dart'
-    show ExpressionInferenceResult, TypeInferrer, TypeInferrerImpl;
+    show
+        ClosureContext,
+        ExpressionInferenceResult,
+        MethodContravarianceCheckKind,
+        TypeInferrer,
+        TypeInferrerImpl;
 
 import '../type_inference/type_promotion.dart'
     show TypePromoter, TypePromoterImpl, TypePromotionFact, TypePromotionScope;
@@ -323,7 +330,7 @@
   ComplexAssignmentJudgment._(this.rhs) : super._(null);
 
   String toString() {
-    var parts = _getToStringParts();
+    List<String> parts = _getToStringParts();
     return '${runtimeType}(${parts.join(', ')})';
   }
 
@@ -350,7 +357,7 @@
       inferrer.helper
           ?.addProblem(messageVoidExpression, read.fileOffset, noLength);
     }
-    var writeOffset = write == null ? -1 : write.fileOffset;
+    int writeOffset = write == null ? -1 : write.fileOffset;
     Procedure combinerMember;
     DartType combinedType;
     if (combiner != null) {
@@ -362,7 +369,7 @@
             .isOverloadedArithmeticOperatorAndType(combinerMember, readType);
       }
       DartType rhsType;
-      var combinerType = inferrer.getCalleeFunctionType(
+      FunctionType combinerType = inferrer.getCalleeFunctionType(
           inferrer.getCalleeType(combinerMember, readType), false);
       if (isPreIncDec || isPostIncDec) {
         rhsType = inferrer.coreTypes.intClass.rawType;
@@ -377,7 +384,7 @@
         rhsType = getInferredType(rhs, inferrer);
         // Do not use rhs after this point because it may be a Shadow node
         // that has been replaced in the tree with its desugaring.
-        var expectedType = getPositionalParameterType(combinerType, 0);
+        DartType expectedType = getPositionalParameterType(combinerType, 0);
         inferrer.ensureAssignable(expectedType, rhsType,
             combiner.arguments.positional.first, combiner.fileOffset);
       }
@@ -387,9 +394,10 @@
       } else {
         combinedType = combinerType.returnType;
       }
-      var checkKind = inferrer.preCheckInvocationContravariance(read, readType,
-          combinerMember, combiner, combiner.arguments, combiner);
-      var replacedCombiner = inferrer.handleInvocationContravariance(
+      MethodContravarianceCheckKind checkKind =
+          inferrer.preCheckInvocationContravariance(read, readType,
+              combinerMember, combiner, combiner.arguments, combiner);
+      Expression replacedCombiner = inferrer.handleInvocationContravariance(
           checkKind,
           combiner,
           combiner.arguments,
@@ -397,7 +405,7 @@
           combinedType,
           combinerType,
           combiner.fileOffset);
-      var replacedCombiner2 = inferrer.ensureAssignable(
+      Expression replacedCombiner2 = inferrer.ensureAssignable(
           writeContext, combinedType, replacedCombiner, writeOffset);
       if (replacedCombiner2 != null) {
         replacedCombiner = replacedCombiner2;
@@ -406,8 +414,8 @@
     } else {
       inferrer.inferExpression(rhs, writeContext ?? const UnknownType(), true,
           isVoidAllowed: true);
-      var rhsType = getInferredType(rhs, inferrer);
-      var replacedRhs = inferrer.ensureAssignable(
+      DartType rhsType = getInferredType(rhs, inferrer);
+      Expression replacedRhs = inferrer.ensureAssignable(
           writeContext, rhsType, rhs, writeOffset,
           isVoidAllowed: writeContext is VoidType);
       _storeLetType(inferrer, replacedRhs ?? rhs, rhsType);
@@ -453,7 +461,7 @@
 
   @override
   List<String> _getToStringParts() {
-    var parts = super._getToStringParts();
+    List<String> parts = super._getToStringParts();
     if (receiver != null) parts.add('receiver=$receiver');
     if (isSuper) parts.add('isSuper=true');
     return parts;
@@ -462,7 +470,7 @@
   DartType _inferReceiver(ShadowTypeInferrer inferrer) {
     if (receiver != null) {
       inferrer.inferExpression(receiver, const UnknownType(), true);
-      var receiverType = getInferredType(receiver, inferrer);
+      DartType receiverType = getInferredType(receiver, inferrer);
       _storeLetType(inferrer, receiver, receiverType);
       return receiverType;
     } else if (isSuper) {
@@ -750,7 +758,7 @@
 
   @override
   List<String> _getToStringParts() {
-    var parts = super._getToStringParts();
+    List<String> parts = super._getToStringParts();
     if (index != null) parts.add('index=$index');
     return parts;
   }
@@ -1029,7 +1037,7 @@
 
   @override
   List<String> _getToStringParts() {
-    var parts = super._getToStringParts();
+    List<String> parts = super._getToStringParts();
     if (nullAwareGuard != null) parts.add('nullAwareGuard=$nullAwareGuard');
     return parts;
   }
@@ -1256,7 +1264,7 @@
     while (true) {
       if (desugared is Let) {
         Let desugaredLet = desugared;
-        var variable = desugaredLet.variable;
+        VariableDeclaration variable = desugaredLet.variable;
         if (identical(variable.initializer, expression)) {
           variable.type = type;
           return;
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 7b7f7a7..affb84563 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -688,8 +688,9 @@
   /// Recover given out-of-order clauses in an import directive where [token] is
   /// the import keyword.
   Token parseImportRecovery(Token token) {
-    final primaryListener = listener;
-    final recoveryListener = new ImportRecoveryListener();
+    final Listener primaryListener = listener;
+    final ImportRecoveryListener recoveryListener =
+        new ImportRecoveryListener();
 
     // Reparse to determine which clauses have already been parsed
     // but intercept the events so they are not sent to the primary listener
@@ -1817,8 +1818,9 @@
 
   /// Recover given out-of-order clauses in a class header.
   Token parseClassHeaderRecovery(Token token, Token begin, Token classKeyword) {
-    final primaryListener = listener;
-    final recoveryListener = new ClassHeaderRecoveryListener();
+    final Listener primaryListener = listener;
+    final ClassHeaderRecoveryListener recoveryListener =
+        new ClassHeaderRecoveryListener();
 
     // Reparse to determine which clauses have already been parsed
     // but intercept the events so they are not sent to the primary listener.
@@ -1977,8 +1979,9 @@
 
   Token parseMixinHeaderRecovery(
       Token token, Token mixinKeyword, Token headerStart) {
-    final primaryListener = listener;
-    final recoveryListener = new MixinHeaderRecoveryListener();
+    final Listener primaryListener = listener;
+    final MixinHeaderRecoveryListener recoveryListener =
+        new MixinHeaderRecoveryListener();
 
     // Reparse to determine which clauses have already been parsed
     // but intercept the events so they are not sent to the primary listener.
@@ -3729,7 +3732,7 @@
       return parseExpressionStatementOrDeclarationAfterModifiers(
           token, token, null, null, null, false);
     }
-    final value = token.next.stringValue;
+    final String value = token.next.stringValue;
     if (identical(value, '{')) {
       // The scanner ensures that `{` always has a closing `}`.
       return parseBlock(token, null);
@@ -4243,7 +4246,7 @@
   }
 
   Token parsePrimary(Token token, IdentifierContext context) {
-    final kind = token.next.kind;
+    final int kind = token.next.kind;
     if (kind == IDENTIFIER_TOKEN) {
       return parseSendOrFunctionLiteral(token, context);
     } else if (kind == INT_TOKEN || kind == HEXADECIMAL_TOKEN) {
@@ -4468,8 +4471,8 @@
         }
         // This looks like the start of an expression.
         // Report an error, insert the comma, and continue parsing.
-        var comma = new SyntheticToken(TokenType.COMMA, next.offset);
-        var message = ifCount > 0
+        SyntheticToken comma = new SyntheticToken(TokenType.COMMA, next.offset);
+        Message message = ifCount > 0
             ? fasta.messageExpectedElseOrComma
             : fasta.templateExpectedButGot.withArguments(',');
         next = rewriteAndRecover(token, message, comma);
@@ -4492,7 +4495,7 @@
       return next;
     }
 
-    final old = mayParseFunctionExpressions;
+    final bool old = mayParseFunctionExpressions;
     mayParseFunctionExpressions = true;
     int count = 0;
     // TODO(danrubel): hasSetEntry parameter exists for replicating existing
@@ -4506,7 +4509,7 @@
         // TODO(danrubel): Remove this section and use the while loop below
         // once hasSetEntry is no longer needed.
         token = parseExpression(token);
-        var isMapEntry = optional(':', token.next);
+        bool isMapEntry = optional(':', token.next);
         hasSetEntry ??= !isMapEntry;
         if (isMapEntry) {
           Token colon = token.next;
@@ -4550,8 +4553,9 @@
           // If this looks like the start of an expression,
           // then report an error, insert the comma, and continue parsing.
           // TODO(danrubel): Consider better error message
-          var comma = new SyntheticToken(TokenType.COMMA, next.offset);
-          var message = ifCount > 0
+          SyntheticToken comma =
+              new SyntheticToken(TokenType.COMMA, next.offset);
+          Message message = ifCount > 0
               ? fasta.messageExpectedElseOrComma
               : fasta.templateExpectedButGot.withArguments(',');
           token = rewriteAndRecover(token, message, comma);
@@ -4868,7 +4872,7 @@
     // Parsing the prefix, for instance 'x of 'x${id}y${id}z'
     int interpolationCount = 0;
     Token next = token.next;
-    var kind = next.kind;
+    int kind = next.kind;
     while (kind != EOF_TOKEN) {
       if (identical(kind, STRING_INTERPOLATION_TOKEN)) {
         // Parsing ${expression}.
@@ -5285,7 +5289,7 @@
         // look past the next expression
         // to determine if this is part of a conditional expression
         //
-        final originalListener = listener;
+        Listener originalListener = listener;
         listener = new ForwardingListener();
         // TODO(danrubel): consider using TokenStreamGhostWriter here
         Token afterExpression =
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
index a10dea0..dab1b69 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
@@ -67,11 +67,12 @@
 
   /// Returns the set of type constraints that was gathered.
   Map<TypeParameter, TypeConstraint> computeConstraints() {
-    var result = <TypeParameter, TypeConstraint>{};
-    for (var parameter in _parametersToConstrain) {
+    Map<TypeParameter, TypeConstraint> result =
+        <TypeParameter, TypeConstraint>{};
+    for (TypeParameter parameter in _parametersToConstrain) {
       result[parameter] = new TypeConstraint();
     }
-    for (var protoConstraint in _protoConstraints) {
+    for (_ProtoConstraint protoConstraint in _protoConstraints) {
       if (protoConstraint.isUpper) {
         addUpperBound(result[protoConstraint.parameter], protoConstraint.bound);
       } else {
@@ -133,9 +134,11 @@
       return false;
     }
     if (subtype.typeParameters.isNotEmpty) {
-      var subtypeSubstitution = <TypeParameter, DartType>{};
-      var supertypeSubstitution = <TypeParameter, DartType>{};
-      var freshTypeVariables = <TypeParameter>[];
+      Map<TypeParameter, DartType> subtypeSubstitution =
+          <TypeParameter, DartType>{};
+      Map<TypeParameter, DartType> supertypeSubstitution =
+          <TypeParameter, DartType>{};
+      List<TypeParameter> freshTypeVariables = <TypeParameter>[];
       if (!_matchTypeFormals(subtype.typeParameters, supertype.typeParameters,
           subtypeSubstitution, supertypeSubstitution, freshTypeVariables)) {
         return false;
@@ -155,8 +158,8 @@
 
     // Test the parameter types.
     for (int i = 0; i < supertype.positionalParameters.length; ++i) {
-      var supertypeParameter = supertype.positionalParameters[i];
-      var subtypeParameter = subtype.positionalParameters[i];
+      DartType supertypeParameter = supertype.positionalParameters[i];
+      DartType subtypeParameter = subtype.positionalParameters[i];
       // Termination: Both types shrink in size.
       if (!_isSubtypeMatch(supertypeParameter, subtypeParameter)) {
         return false;
@@ -201,7 +204,7 @@
     // of supertypes of a given type more than once, the order of the checks
     // above is irrelevant; we just need to find the matched superclass,
     // substitute, and then iterate through type variables.
-    var matchingSupertypeOfSubtype =
+    InterfaceType matchingSupertypeOfSubtype =
         getTypeAsInstanceOf(subtype, supertype.classNode);
     if (matchingSupertypeOfSubtype == null) return false;
     for (int i = 0; i < supertype.classNode.typeParameters.length; i++) {
@@ -266,14 +269,14 @@
     // Handle FutureOr<T> union type.
     if (subtype is InterfaceType &&
         identical(subtype.classNode, futureOrClass)) {
-      var subtypeArg = subtype.typeArguments[0];
+      DartType subtypeArg = subtype.typeArguments[0];
       if (supertype is InterfaceType &&
           identical(supertype.classNode, futureOrClass)) {
         // `FutureOr<P>` is a subtype match for `FutureOr<Q>` with respect to
         // `L` under constraints `C`:
         // - If `P` is a subtype match for `Q` with respect to `L` under
         //   constraints `C`.
-        var supertypeArg = supertype.typeArguments[0];
+        DartType supertypeArg = supertype.typeArguments[0];
         return _isSubtypeMatch(subtypeArg, supertypeArg);
       }
 
@@ -283,7 +286,7 @@
       //   constraints `C0`.
       // - And `P` is a subtype match for `Q` with respect to `L` under
       //   constraints `C1`.
-      var subtypeFuture = futureType(subtypeArg);
+      InterfaceType subtypeFuture = futureType(subtypeArg);
       return _isSubtypeMatch(subtypeFuture, supertype) &&
           _isSubtypeMatch(subtypeArg, supertype);
     }
@@ -298,8 +301,8 @@
       //   under constraints `C`
       //   - And `P` is a subtype match for `Q` with respect to `L` under
       //     constraints `C`
-      var supertypeArg = supertype.typeArguments[0];
-      var supertypeFuture = futureType(supertypeArg);
+      DartType supertypeArg = supertype.typeArguments[0];
+      InterfaceType supertypeFuture = futureType(supertypeArg);
       return trySubtypeMatch(subtype, supertypeFuture) ||
           _isSubtypeMatch(subtype, supertypeArg);
     }
@@ -342,9 +345,9 @@
     //   and `F` is a subtype match for a type `Q` with respect to `L` under
     //   constraints `C`.
     if (subtype is InterfaceType) {
-      var callMember = getInterfaceMember(subtype.classNode, callName);
+      Member callMember = getInterfaceMember(subtype.classNode, callName);
       if (callMember is Procedure && !callMember.isGetter) {
-        var callType = callMember.getterType;
+        DartType callType = callMember.getterType;
         if (callType != null) {
           callType =
               Substitution.fromInterfaceType(subtype).substituteType(callType);
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 0bd0d70..7c8edce 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -56,7 +56,7 @@
 import 'package:kernel/core_types.dart' show CoreTypes;
 
 import 'package:kernel/type_algebra.dart'
-    show getFreshTypeParameters, Substitution;
+    show FreshTypeParameters, getFreshTypeParameters, Substitution;
 
 import 'package:kernel/src/bounds_checks.dart' show calculateBounds;
 
@@ -132,13 +132,14 @@
     show
         getNamedParameterType,
         getPositionalParameterType,
+        TypeConstraint,
         TypeVariableEliminator,
         TypeSchemaEnvironment;
 
 /// Given a [FunctionNode], gets the named parameter identified by [name], or
 /// `null` if there is no parameter with the given name.
 VariableDeclaration getNamedFormal(FunctionNode function, String name) {
-  for (var formal in function.namedParameters) {
+  for (VariableDeclaration formal in function.namedParameters) {
     if (formal.name == name) return formal;
   }
   return null;
@@ -245,7 +246,7 @@
       ReturnStatement statement, DartType expressionType) {
     // The rules for valid returns for functions with return type T and possibly
     // a return expression with static type S.
-    var flattenedReturnType = isAsync
+    DartType flattenedReturnType = isAsync
         ? inferrer.typeSchemaEnvironment.unfutureType(returnType)
         : returnType;
     if (statement.expression == null) {
@@ -273,7 +274,7 @@
 
     // Sync: invalid if T is void and S is not void, dynamic, or Null
     // Async: invalid if T is void and flatten(S) is not void, dynamic, or Null.
-    var flattenedExpressionType = isAsync
+    DartType flattenedExpressionType = isAsync
         ? inferrer.typeSchemaEnvironment.unfutureType(expressionType)
         : expressionType;
     if (returnType is VoidType &&
@@ -332,7 +333,7 @@
         // Not assignable, use the expectation.
         type = greatestClosure(inferrer.coreTypes, returnOrYieldContext);
       }
-      var unwrappedType = type;
+      DartType unwrappedType = type;
       if (isAsync) {
         unwrappedType = inferrer.typeSchemaEnvironment.unfutureType(type);
       }
@@ -359,7 +360,7 @@
   void handleYield(TypeInferrerImpl inferrer, bool isYieldStar, DartType type,
       Expression expression, int fileOffset) {
     if (!isGenerator) return;
-    var expectedType = isYieldStar
+    DartType expectedType = isYieldStar
         ? _wrapAsyncOrGenerator(inferrer, returnOrYieldContext)
         : returnOrYieldContext;
     if (inferrer.ensureAssignable(expectedType, type, expression, fileOffset,
@@ -368,7 +369,7 @@
       type = greatestClosure(inferrer.coreTypes, expectedType);
     }
     if (_needToInferReturnType) {
-      var unwrappedType = type;
+      DartType unwrappedType = type;
       if (isYieldStar) {
         unwrappedType = inferrer.getDerivedTypeArgumentOf(
                 type,
@@ -633,23 +634,29 @@
     // should tear off `.call`.
     // TODO(paulberry): use resolveTypeParameter.  See findInterfaceMember.
     if (actualType is InterfaceType) {
-      var classNode = (actualType as InterfaceType).classNode;
-      var callMember = classHierarchy.getInterfaceMember(classNode, callName);
+      Class classNode = (actualType as InterfaceType).classNode;
+      Member callMember =
+          classHierarchy.getInterfaceMember(classNode, callName);
       if (callMember is Procedure && callMember.kind == ProcedureKind.Method) {
         if (_shouldTearOffCall(expectedType, actualType)) {
           // Replace expression with:
           // `let t = expression in t == null ? null : t.call`
-          var parent = expression.parent;
-          var t = new VariableDeclaration.forValue(expression, type: actualType)
-            ..fileOffset = fileOffset;
-          var nullCheck = buildIsNull(new VariableGet(t), fileOffset, helper);
-          var tearOff =
+          TreeNode parent = expression.parent;
+          VariableDeclaration t =
+              new VariableDeclaration.forValue(expression, type: actualType)
+                ..fileOffset = fileOffset;
+          Expression nullCheck =
+              buildIsNull(new VariableGet(t), fileOffset, helper);
+          PropertyGet tearOff =
               new PropertyGet(new VariableGet(t), callName, callMember)
                 ..fileOffset = fileOffset;
           actualType = getCalleeType(callMember, actualType);
-          var conditional = new ConditionalExpression(nullCheck,
-              new NullLiteral()..fileOffset = fileOffset, tearOff, actualType);
-          var let = new Let(t, conditional)..fileOffset = fileOffset;
+          ConditionalExpression conditional = new ConditionalExpression(
+              nullCheck,
+              new NullLiteral()..fileOffset = fileOffset,
+              tearOff,
+              actualType);
+          Let let = new Let(t, conditional)..fileOffset = fileOffset;
           parent?.replaceChild(expression, let);
           expression = let;
         }
@@ -673,7 +680,7 @@
 
     if (!typeSchemaEnvironment.isSubtypeOf(expectedType, actualType)) {
       // Error: not assignable.  Perform error recovery.
-      var parent = expression.parent;
+      TreeNode parent = expression.parent;
       Expression errorNode = new AsExpression(
           expression,
           // TODO(ahe): The outline phase doesn't correctly remove invalid
@@ -693,21 +700,23 @@
       parent?.replaceChild(expression, errorNode);
       return errorNode;
     } else {
-      var template = _getPreciseTypeErrorTemplate(expression);
+      Template<Message Function(DartType, DartType)> template =
+          _getPreciseTypeErrorTemplate(expression);
       if (template != null) {
         // The type of the expression is known precisely, so an implicit
         // downcast is guaranteed to fail.  Insert a compile-time error.
-        var parent = expression.parent;
-        var errorNode = helper.wrapInProblem(expression,
+        TreeNode parent = expression.parent;
+        Expression errorNode = helper.wrapInProblem(expression,
             template.withArguments(actualType, expectedType), noLength);
         parent?.replaceChild(expression, errorNode);
         return errorNode;
       } else {
         // Insert an implicit downcast.
-        var parent = expression.parent;
-        var typeCheck = new AsExpression(expression, initialExpectedType)
-          ..isTypeError = true
-          ..fileOffset = fileOffset;
+        TreeNode parent = expression.parent;
+        AsExpression typeCheck =
+            new AsExpression(expression, initialExpectedType)
+              ..isTypeError = true
+              ..fileOffset = fileOffset;
         parent?.replaceChild(expression, typeCheck);
         return typeCheck;
       }
@@ -785,21 +794,21 @@
     // TODO(paulberry): could we add getters to InvocationExpression to make
     // these is-checks unnecessary?
     if (methodInvocation is MethodInvocation) {
-      var interfaceMember = findInterfaceMember(
+      Object interfaceMember = findInterfaceMember(
           receiverType, methodInvocation.name, methodInvocation.fileOffset,
           errorTemplate: templateUndefinedMethod,
           expression: methodInvocation,
           receiver: methodInvocation.receiver,
           instrumented: instrumented);
       if (receiverType == const DynamicType() && interfaceMember is Procedure) {
-        var arguments = methodInvocation.arguments;
-        var signature = interfaceMember.function;
+        Arguments arguments = methodInvocation.arguments;
+        FunctionNode signature = interfaceMember.function;
         if (arguments.positional.length < signature.requiredParameterCount ||
             arguments.positional.length >
                 signature.positionalParameters.length) {
           return null;
         }
-        for (var argument in arguments.named) {
+        for (kernel.NamedExpression argument in arguments.named) {
           if (!signature.namedParameters
               .any((declaration) => declaration.name == argument.name)) {
             return null;
@@ -816,7 +825,7 @@
       return interfaceMember;
     } else if (methodInvocation is SuperMethodInvocation) {
       assert(receiverType != const DynamicType());
-      var interfaceMember = findInterfaceMember(
+      Object interfaceMember = findInterfaceMember(
           receiverType, methodInvocation.name, methodInvocation.fileOffset,
           instrumented: instrumented);
       if (interfaceMember is Member) {
@@ -836,7 +845,7 @@
     // TODO(paulberry): could we add a common base class to PropertyGet and
     // SuperPropertyGet to make these is-checks unnecessary?
     if (propertyGet is PropertyGet) {
-      var interfaceMember = findInterfaceMember(
+      Object interfaceMember = findInterfaceMember(
           receiverType, propertyGet.name, propertyGet.fileOffset,
           errorTemplate: templateUndefinedGetter,
           expression: propertyGet,
@@ -854,7 +863,7 @@
       return interfaceMember;
     } else if (propertyGet is SuperPropertyGet) {
       assert(receiverType != const DynamicType());
-      var interfaceMember = findInterfaceMember(
+      Object interfaceMember = findInterfaceMember(
           receiverType, propertyGet.name, propertyGet.fileOffset,
           instrumented: instrumented);
       if (interfaceMember is Member) {
@@ -872,7 +881,7 @@
   Object findPropertySetMember(DartType receiverType, Expression propertySet,
       {bool instrumented: true}) {
     if (propertySet is PropertySet) {
-      var interfaceMember = findInterfaceMember(
+      Object interfaceMember = findInterfaceMember(
           receiverType, propertySet.name, propertySet.fileOffset,
           errorTemplate: templateUndefinedSetter,
           expression: propertySet,
@@ -891,7 +900,7 @@
       return interfaceMember;
     } else if (propertySet is SuperPropertySet) {
       assert(receiverType != const DynamicType());
-      var interfaceMember = findInterfaceMember(
+      Object interfaceMember = findInterfaceMember(
           receiverType, propertySet.name, propertySet.fileOffset,
           setter: true, instrumented: instrumented);
       if (interfaceMember is Member) {
@@ -908,9 +917,9 @@
     if (calleeType is FunctionType) {
       return calleeType;
     } else if (followCall && calleeType is InterfaceType) {
-      var member =
+      Member member =
           _getInterfaceMember(calleeType.classNode, callName, false, -1);
-      var callType = getCalleeType(member, calleeType);
+      DartType callType = getCalleeType(member, calleeType);
       if (callType is FunctionType) {
         return callType;
       }
@@ -924,7 +933,7 @@
     } else if (interfaceMember == null) {
       return const DynamicType();
     } else if (interfaceMember is Member) {
-      var memberClass = interfaceMember.enclosingClass;
+      Class memberClass = interfaceMember.enclosingClass;
       DartType calleeType;
       if (interfaceMember is Procedure) {
         if (interfaceMember.kind == ProcedureKind.Getter) {
@@ -941,7 +950,7 @@
       if (memberClass.typeParameters.isNotEmpty) {
         receiverType = resolveTypeParameter(receiverType);
         if (receiverType is InterfaceType) {
-          var castedType =
+          InterfaceType castedType =
               classHierarchy.getTypeAsInstanceOf(receiverType, memberClass);
           calleeType = Substitution.fromInterfaceType(castedType)
               .substituteType(calleeType);
@@ -956,7 +965,7 @@
 
   DartType getDerivedTypeArgumentOf(DartType type, Class class_) {
     if (type is InterfaceType) {
-      var typeAsInstanceOfClass =
+      InterfaceType typeAsInstanceOfClass =
           classHierarchy.getTypeAsInstanceOf(type, class_);
       if (typeAsInstanceOfClass != null) {
         return typeAsInstanceOfClass.typeArguments[0];
@@ -984,11 +993,12 @@
     } else if (interfaceMember == null) {
       return const DynamicType();
     } else if (interfaceMember is Member) {
-      var memberClass = interfaceMember.enclosingClass;
+      Class memberClass = interfaceMember.enclosingClass;
       DartType setterType;
       if (interfaceMember is Procedure) {
         assert(interfaceMember.kind == ProcedureKind.Setter);
-        var setterParameters = interfaceMember.function.positionalParameters;
+        List<VariableDeclaration> setterParameters =
+            interfaceMember.function.positionalParameters;
         setterType = setterParameters.length > 0
             ? setterParameters[0].type
             : const DynamicType();
@@ -1001,7 +1011,7 @@
       if (memberClass.typeParameters.isNotEmpty) {
         receiverType = resolveTypeParameter(receiverType);
         if (receiverType is InterfaceType) {
-          var castedType =
+          InterfaceType castedType =
               classHierarchy.getTypeAsInstanceOf(receiverType, memberClass);
           setterType = Substitution.fromInterfaceType(castedType)
               .substituteType(setterType);
@@ -1035,13 +1045,14 @@
       DartType inferredType,
       FunctionType functionType,
       int fileOffset) {
-    var expressionToReplace = desugaredInvocation ?? expression;
+    Expression expressionToReplace = desugaredInvocation ?? expression;
     switch (checkKind) {
       case MethodContravarianceCheckKind.checkMethodReturn:
-        var parent = expressionToReplace.parent;
-        var replacement = new AsExpression(expressionToReplace, inferredType)
-          ..isTypeError = true
-          ..fileOffset = fileOffset;
+        TreeNode parent = expressionToReplace.parent;
+        AsExpression replacement =
+            new AsExpression(expressionToReplace, inferredType)
+              ..isTypeError = true
+              ..fileOffset = fileOffset;
         parent.replaceChild(expressionToReplace, replacement);
         if (instrumentation != null) {
           int offset = arguments.fileOffset == -1
@@ -1052,13 +1063,13 @@
         }
         return replacement;
       case MethodContravarianceCheckKind.checkGetterReturn:
-        var parent = expressionToReplace.parent;
-        var propertyGet = new PropertyGet(desugaredInvocation.receiver,
+        TreeNode parent = expressionToReplace.parent;
+        PropertyGet propertyGet = new PropertyGet(desugaredInvocation.receiver,
             desugaredInvocation.name, desugaredInvocation.interfaceTarget);
-        var asExpression = new AsExpression(propertyGet, functionType)
+        AsExpression asExpression = new AsExpression(propertyGet, functionType)
           ..isTypeError = true
           ..fileOffset = fileOffset;
-        var replacement = new MethodInvocation(
+        MethodInvocation replacement = new MethodInvocation(
             asExpression, callName, desugaredInvocation.arguments);
         parent.replaceChild(expressionToReplace, replacement);
         if (instrumentation != null) {
@@ -1099,10 +1110,10 @@
             interfaceMember.enclosingClass, interfaceMember.type);
       }
     }
-    var replacedExpression = desugaredGet ?? expression;
+    Expression replacedExpression = desugaredGet ?? expression;
     if (checkReturn) {
-      var expressionToReplace = replacedExpression;
-      var parent = expressionToReplace.parent;
+      Expression expressionToReplace = replacedExpression;
+      TreeNode parent = expressionToReplace.parent;
       replacedExpression = new AsExpression(expressionToReplace, inferredType)
         ..isTypeError = true
         ..fileOffset = fileOffset;
@@ -1151,7 +1162,7 @@
     assert(closureContext == null);
     assert(!isTopLevel);
     this.helper = helper;
-    var actualType =
+    DartType actualType =
         inferExpression(initializer, context, true, isVoidAllowed: true);
     ensureAssignable(context, actualType, initializer, initializer.fileOffset,
         isVoidAllowed: context is VoidType);
@@ -1190,7 +1201,7 @@
       // type parameters for the callee (see dartbug.com/31759).
       // TODO(paulberry): is it possible to find a narrower set of circumstances
       // in which me must do this, to avoid a performance regression?
-      var fresh = getFreshTypeParameters(calleeTypeParameters);
+      FreshTypeParameters fresh = getFreshTypeParameters(calleeTypeParameters);
       calleeType = fresh.applyToFunctionType(calleeType);
       returnType = fresh.substitute(returnType);
       calleeTypeParameters = fresh.freshTypeParameters;
@@ -1239,7 +1250,7 @@
       DartType inferredFormalType = substitution != null
           ? substitution.substituteType(formalType)
           : formalType;
-      var expressionType = inferExpression(
+      DartType expressionType = inferExpression(
           expression,
           inferredFormalType,
           inferenceNeeded ||
@@ -1256,28 +1267,30 @@
     });
 
     // Check for and remove duplicated named arguments.
-    var named = arguments.named;
+    List<kernel.NamedExpression> named = arguments.named;
     if (named.length == 2) {
       if (named[0].name == named[1].name) {
-        var name = named[1].name;
-        var error = helper.desugarSyntheticExpression(helper.buildProblem(
-            templateDuplicatedNamedArgument.withArguments(name),
-            named[1].fileOffset,
-            name.length));
+        String name = named[1].name;
+        Expression error = helper.desugarSyntheticExpression(
+            helper.buildProblem(
+                templateDuplicatedNamedArgument.withArguments(name),
+                named[1].fileOffset,
+                name.length));
         arguments.named = [new kernel.NamedExpression(named[1].name, error)];
         formalTypes.removeLast();
         actualTypes.removeLast();
       }
     } else if (named.length > 2) {
-      var seenNames = <String, kernel.NamedExpression>{};
-      var hasProblem = false;
-      var namedTypeIndex = arguments.positional.length;
-      var uniqueNamed = <kernel.NamedExpression>[];
-      for (var expression in named) {
-        var name = expression.name;
+      Map<String, kernel.NamedExpression> seenNames =
+          <String, kernel.NamedExpression>{};
+      bool hasProblem = false;
+      int namedTypeIndex = arguments.positional.length;
+      List<kernel.NamedExpression> uniqueNamed = <kernel.NamedExpression>[];
+      for (kernel.NamedExpression expression in named) {
+        String name = expression.name;
         if (seenNames.containsKey(name)) {
           hasProblem = true;
-          var prevNamedExpression = seenNames[name];
+          kernel.NamedExpression prevNamedExpression = seenNames[name];
           prevNamedExpression.value = helper.desugarSyntheticExpression(
               helper.buildProblem(
                   templateDuplicatedNamedArgument.withArguments(name),
@@ -1322,12 +1335,12 @@
         // Argument counts and names match. Compare types.
         int numPositionalArgs = arguments.positional.length;
         for (int i = 0; i < formalTypes.length; i++) {
-          var formalType = formalTypes[i];
-          var expectedType = substitution != null
+          DartType formalType = formalTypes[i];
+          DartType expectedType = substitution != null
               ? substitution.substituteType(formalType)
               : formalType;
-          var actualType = actualTypes[i];
-          var expression = i < numPositionalArgs
+          DartType actualType = actualTypes[i];
+          Expression expression = i < numPositionalArgs
               ? arguments.positional[i]
               : arguments.named[i - numPositionalArgs].value;
           ensureAssignable(
@@ -1354,15 +1367,16 @@
       returnContext = const DynamicType();
     }
     if (!isTopLevel) {
-      var positionalParameters = function.positionalParameters;
-      for (var i = 0; i < positionalParameters.length; i++) {
-        var parameter = positionalParameters[i];
+      List<VariableDeclaration> positionalParameters =
+          function.positionalParameters;
+      for (int i = 0; i < positionalParameters.length; i++) {
+        VariableDeclaration parameter = positionalParameters[i];
         inferMetadataKeepingHelper(parameter.annotations);
         if (parameter.initializer != null) {
           inferExpression(parameter.initializer, parameter.type, !isTopLevel);
         }
       }
-      for (var parameter in function.namedParameters) {
+      for (VariableDeclaration parameter in function.namedParameters) {
         inferMetadataKeepingHelper(parameter.annotations);
         inferExpression(parameter.initializer, parameter.type, !isTopLevel);
       }
@@ -1404,7 +1418,8 @@
 
       // Let `[T/S]` denote the type substitution where each `Si` is replaced
       // with the corresponding `Ti`.
-      var substitutionMap = <TypeParameter, DartType>{};
+      Map<TypeParameter, DartType> substitutionMap =
+          <TypeParameter, DartType>{};
       for (int i = 0; i < typeContext.typeParameters.length; i++) {
         substitutionMap[typeContext.typeParameters[i]] =
             i < typeParameters.length
@@ -1497,9 +1512,9 @@
       // Place annotations in a temporary list literal so that they will have a
       // parent.  This is necessary in case any of the annotations need to get
       // replaced during type inference.
-      var parents = annotations.map((e) => e.parent).toList();
+      List<TreeNode> parents = annotations.map((e) => e.parent).toList();
       new ListLiteral(annotations);
-      for (var annotation in annotations) {
+      for (Expression annotation in annotations) {
         inferExpression(annotation, const UnknownType(), !isTopLevel);
       }
       for (int i = 0; i < annotations.length; ++i) {
@@ -1522,7 +1537,7 @@
       Name methodName,
       Arguments arguments}) {
     // First infer the receiver so we can look up the method that was invoked.
-    var receiverType = receiver == null
+    DartType receiverType = receiver == null
         ? thisType
         : inferExpression(receiver, const UnknownType(), true);
     receiverVariable?.type = receiverType;
@@ -1535,26 +1550,32 @@
     bool isOverloadedArithmeticOperator = interfaceMember is Procedure &&
         typeSchemaEnvironment.isOverloadedArithmeticOperatorAndType(
             interfaceMember, receiverType);
-    var calleeType = getCalleeType(interfaceMember, receiverType);
-    var functionType = getCalleeFunctionType(calleeType, !isImplicitCall);
+    DartType calleeType = getCalleeType(interfaceMember, receiverType);
+    FunctionType functionType =
+        getCalleeFunctionType(calleeType, !isImplicitCall);
 
     if (interfaceMember != null &&
         calleeType is! DynamicType &&
         calleeType != coreTypes.functionClass.rawType &&
         identical(functionType, unknownFunction)) {
-      var parent = expression.parent;
+      TreeNode parent = expression.parent;
       kernel.Expression error = helper.wrapInProblem(expression,
           templateInvokeNonFunction.withArguments(methodName.name), noLength);
       parent?.replaceChild(expression, error);
       return new ExpressionInferenceResult(null, const DynamicType());
     }
-    var checkKind = preCheckInvocationContravariance(receiver, receiverType,
-        interfaceMember, desugaredInvocation, arguments, expression);
-    var inferenceResult = inferInvocation(typeContext, fileOffset, functionType,
-        functionType.returnType, arguments,
+    MethodContravarianceCheckKind checkKind = preCheckInvocationContravariance(
+        receiver,
+        receiverType,
+        interfaceMember,
+        desugaredInvocation,
+        arguments,
+        expression);
+    ExpressionInferenceResult inferenceResult = inferInvocation(typeContext,
+        fileOffset, functionType, functionType.returnType, arguments,
         isOverloadedArithmeticOperator: isOverloadedArithmeticOperator,
         receiverType: receiverType);
-    var inferredType = inferenceResult.type;
+    DartType inferredType = inferenceResult.type;
     if (methodName.name == '==') {
       inferredType = coreTypes.boolClass.rawType;
     }
@@ -1567,8 +1588,8 @@
               interfaceMember.kind == ProcedureKind.Method) &&
           receiverType is! DynamicType &&
           receiverType != typeSchemaEnvironment.rawFunctionType) {
-        var parent = expression.parent;
-        var errorNode = helper.wrapInProblem(
+        TreeNode parent = expression.parent;
+        Expression errorNode = helper.wrapInProblem(
             expression,
             templateImplicitCallOfNonMethod.withArguments(receiverType),
             noLength);
@@ -1619,7 +1640,7 @@
     assert(closureContext == null);
     this.helper = helper;
     assert(declaredType != null);
-    var actualType = inferExpression(initializer, declaredType, true);
+    DartType actualType = inferExpression(initializer, declaredType, true);
     ensureAssignable(
         declaredType, actualType, initializer, initializer.fileOffset);
     this.helper = null;
@@ -1657,8 +1678,8 @@
         desugaredGet.interfaceTarget = interfaceMember;
       }
     }
-    var inferredType = getCalleeType(interfaceMember, receiverType);
-    var replacedExpression = handlePropertyGetContravariance(receiver,
+    DartType inferredType = getCalleeType(interfaceMember, receiverType);
+    Expression replacedExpression = handlePropertyGetContravariance(receiver,
         interfaceMember, desugaredGet, expression, inferredType, fileOffset);
     if ((interfaceMember is Procedure &&
         interfaceMember.kind == ProcedureKind.Method)) {
@@ -1686,21 +1707,21 @@
     if (tearoffType is FunctionType &&
         context is FunctionType &&
         context.typeParameters.isEmpty) {
-      var typeParameters = tearoffType.typeParameters;
+      List<TypeParameter> typeParameters = tearoffType.typeParameters;
       if (typeParameters.isNotEmpty) {
-        var inferredTypes = new List<DartType>.filled(
+        List<DartType> inferredTypes = new List<DartType>.filled(
             typeParameters.length, const UnknownType());
-        var instantiatedType = tearoffType.withoutTypeParameters;
+        FunctionType instantiatedType = tearoffType.withoutTypeParameters;
         typeSchemaEnvironment.inferGenericFunctionOrType(
             instantiatedType, typeParameters, [], [], context, inferredTypes);
         if (!isTopLevel) {
-          var parent = expression.parent;
+          TreeNode parent = expression.parent;
           parent.replaceChild(
               expression,
               new Instantiation(expression, inferredTypes)
                 ..fileOffset = expression.fileOffset);
         }
-        var substitution =
+        Substitution substitution =
             Substitution.fromPairs(typeParameters, inferredTypes);
         return substitution.substituteType(instantiatedType);
       }
@@ -1745,7 +1766,7 @@
     if (interfaceMember is Field ||
         interfaceMember is Procedure &&
             interfaceMember.kind == ProcedureKind.Getter) {
-      var getType = getCalleeType(interfaceMember, receiverType);
+      DartType getType = getCalleeType(interfaceMember, receiverType);
       if (getType is DynamicType) {
         return MethodContravarianceCheckKind.none;
       }
@@ -1781,7 +1802,7 @@
       }
     }
 
-    var resolved = resolveOneStep(type);
+    DartType resolved = resolveOneStep(type);
     if (resolved == null) return type;
 
     // Detect circularities using the tortoise-and-hare algorithm.
@@ -1795,9 +1816,9 @@
       }
 
       // Hare takes two steps
-      var step1 = resolveOneStep(hare);
+      DartType step1 = resolveOneStep(hare);
       if (step1 == null) return hare;
-      var step2 = resolveOneStep(step1);
+      DartType step2 = resolveOneStep(step1);
       if (step2 == null) return hare;
       hare = step2;
 
@@ -1818,7 +1839,7 @@
   }
 
   DartType wrapFutureType(DartType type) {
-    var typeWithoutFutureOr = type ?? const DynamicType();
+    DartType typeWithoutFutureOr = type ?? const DynamicType();
     return new InterfaceType(
         coreTypes.futureClass, <DartType>[typeWithoutFutureOr]);
   }
@@ -1829,10 +1850,10 @@
 
   void _forEachArgument(
       Arguments arguments, void callback(String name, Expression expression)) {
-    for (var expression in arguments.positional) {
+    for (Expression expression in arguments.positional) {
       callback(null, expression);
     }
-    for (var namedExpression in arguments.named) {
+    for (kernel.NamedExpression namedExpression in arguments.named) {
       callback(namedExpression.name, namedExpression.value);
     }
   }
@@ -1872,7 +1893,7 @@
       return templateInvalidCastNewExpr;
     }
     if (expression is StaticGet) {
-      var target = expression.target;
+      Member target = expression.target;
       if (target is Procedure && target.kind == ProcedureKind.Method) {
         if (target.enclosingClass != null) {
           return templateInvalidCastStaticMethod;
@@ -1883,7 +1904,7 @@
       return null;
     }
     if (expression is VariableGet) {
-      var variable = expression.variable;
+      VariableDeclaration variable = expression.variable;
       if (variable is VariableDeclarationJudgment &&
           VariableDeclarationJudgment.isLocalFunction(variable)) {
         return templateInvalidCastLocalFunction;
@@ -1949,7 +1970,7 @@
       // abstract class S0&S1<...> extends Object implements S0, S1 {}
       // abstract class S0&S1<...> = S0 with S1;
       // abstract class S0&S1<...> extends S0 implements S1 {}
-      var mixinSuperclass = mixinSupertype.classNode;
+      Class mixinSuperclass = mixinSupertype.classNode;
       if (mixinSuperclass.mixedInType == null &&
           mixinSuperclass.implementedTypes.length != 1 &&
           (mixinSuperclass.superclass != coreTypes.objectClass ||
@@ -1962,7 +1983,7 @@
             mixinSuperclass.fileOffset,
             mixinSuperclass.fileUri);
       }
-      var substitution = Substitution.fromSupertype(mixinSupertype);
+      Substitution substitution = Substitution.fromSupertype(mixinSupertype);
       Supertype s0, s1;
       if (mixinSuperclass.implementedTypes.length == 2) {
         s0 = mixinSuperclass.implementedTypes[0];
@@ -2015,10 +2036,10 @@
     generateConstraints(mixinClass, baseType, mixinSupertype);
     // Solve them to get a map from type parameters to upper and lower
     // bounds.
-    var result = gatherer.computeConstraints();
+    Map<TypeParameter, TypeConstraint> result = gatherer.computeConstraints();
     // Generate new type parameters with the solution as bounds.
     List<TypeParameter> parameters = mixinClass.typeParameters.map((p) {
-      var constraint = result[p];
+      TypeConstraint constraint = result[p];
       // Because we solved for equality, a valid solution has a parameter
       // either unconstrained or else with identical upper and lower bounds.
       if (constraint != null && constraint.upper != constraint.lower) {
@@ -2036,9 +2057,10 @@
     }).toList();
     // Bounds might mention the mixin class's type parameters so we have to
     // substitute them before calling instantiate to bounds.
-    var substitution = Substitution.fromPairs(mixinClass.typeParameters,
+    Substitution substitution = Substitution.fromPairs(
+        mixinClass.typeParameters,
         parameters.map((p) => new TypeParameterType(p)).toList());
-    for (var p in parameters) {
+    for (TypeParameter p in parameters) {
       p.bound = substitution.substituteType(p.bound);
     }
     // Use instantiate to bounds.
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart b/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
index 69c352e..f8f0ff5 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_promotion.dart
@@ -230,8 +230,8 @@
   void enterLogicalExpression(Expression lhs, String operator) {
     debugEvent('enterLogicalExpression');
     // Figure out what the facts are based on possible LHS outcomes.
-    var trueFacts = _factsWhenTrue(lhs);
-    var falseFacts = _factsWhenFalse(lhs);
+    TypePromotionFact trueFacts = _factsWhenTrue(lhs);
+    TypePromotionFact falseFacts = _factsWhenFalse(lhs);
     // Record the fact that we are entering a new scope, and save the
     // appropriate facts for the case where the expression gets short-cut.
     bool isAnd = identical(operator, '&&');
@@ -246,8 +246,8 @@
   void enterThen(Expression condition) {
     debugEvent('enterThen');
     // Figure out what the facts are based on possible condition outcomes.
-    var trueFacts = _factsWhenTrue(condition);
-    var falseFacts = _factsWhenFalse(condition);
+    TypePromotionFact trueFacts = _factsWhenTrue(condition);
+    TypePromotionFact falseFacts = _factsWhenFalse(condition);
     // Record the fact that we are entering a new scope, and save the "false"
     // facts for when we enter the "else" branch.
     _currentScope = new _ConditionalScope(_currentScope, falseFacts);
@@ -295,7 +295,7 @@
   TypePromotionFact getFactForAccess(
       VariableDeclaration variable, int functionNestingLevel) {
     debugEvent('getFactForAccess');
-    var fact = _computeCurrentFactMap()[variable];
+    TypePromotionFact fact = _computeCurrentFactMap()[variable];
     TypePromotionFact._recordAccessedInScope(
         fact, _currentScope, functionNestingLevel);
     return fact;
@@ -309,7 +309,7 @@
       VariableDeclaration variable, DartType type, int functionNestingLevel) {
     debugEvent('handleIsCheck');
     if (!isPromotionCandidate(variable)) return;
-    var isCheck = new _IsCheck(
+    _IsCheck isCheck = new _IsCheck(
         ++_lastFactSequenceNumber,
         variable,
         _currentFacts,
@@ -333,7 +333,7 @@
   /// mutated.
   void mutateVariable(VariableDeclaration variable, int functionNestingLevel) {
     debugEvent('mutateVariable');
-    var fact = _computeCurrentFactMap()[variable];
+    TypePromotionFact fact = _computeCurrentFactMap()[variable];
     TypePromotionFact._recordMutatedInScope(fact, _currentScope);
     if (getVariableFunctionNestingLevel(variable) < functionNestingLevel) {
       setVariableMutatedInClosure(variable);
@@ -386,7 +386,7 @@
     for (TypePromotionFact newState = _currentFacts;
         !identical(newState, commonAncestor);
         newState = newState.previous) {
-      var currentlyCached = _factCache[newState.variable];
+      TypePromotionFact currentlyCached = _factCache[newState.variable];
       // Note: Since we roll forward the most recent facts first, we need to be
       // careful not write an older fact over a newer one.
       if (currentlyCached == null ||
@@ -654,13 +654,13 @@
   @override
   DartType _computePromotedType(
       TypePromoterImpl promoter, TypePromotionScope scope) {
-    var previousPromotedType =
+    DartType previousPromotedType =
         previousForVariable?._computePromotedType(promoter, scope);
 
     // If the variable was mutated somewhere in the scope of the potential
     // promotion, promotion does not occur.
     if (_mutatedInScopes != null) {
-      for (var assignmentScope in _mutatedInScopes) {
+      for (TypePromotionScope assignmentScope in _mutatedInScopes) {
         if (assignmentScope.containsScope(scope)) {
           return previousPromotedType;
         }
@@ -672,7 +672,7 @@
     // not occur.
     if (promoter.wasVariableMutatedAnywhere(variable) &&
         _accessedInClosureInScopes != null) {
-      for (var accessScope in _accessedInClosureInScopes) {
+      for (TypePromotionScope accessScope in _accessedInClosureInScopes) {
         if (accessScope.containsScope(scope)) {
           return previousPromotedType;
         }
@@ -681,7 +681,7 @@
 
     // What we do now depends on the relationship between the previous type of
     // the variable and the type we are checking against.
-    var previousType = previousPromotedType ?? variable.type;
+    DartType previousType = previousPromotedType ?? variable.type;
     if (promoter.typeSchemaEnvironment.isSubtypeOf(checkedType, previousType)) {
       // The type we are checking against is a subtype of the previous type of
       // the variable, so this is a refinement; we can promote.
diff --git a/pkg/front_end/test/lint_test.status b/pkg/front_end/test/lint_test.status
index 606ccfd..e22cfe5 100644
--- a/pkg/front_end/test/lint_test.status
+++ b/pkg/front_end/test/lint_test.status
@@ -1,13 +1,3 @@
 # Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE.md file.
-
-src/fasta/flow_analysis/flow_analysis: Fail
-src/fasta/kernel/body_builder: Fail
-src/fasta/kernel/expression_generator: Fail
-src/fasta/kernel/inference_visitor: Fail
-src/fasta/kernel/kernel_shadow_ast: Fail
-src/fasta/parser/parser: Fail
-src/fasta/type_inference/type_constraint_gatherer: Fail
-src/fasta/type_inference/type_inferrer: Fail
-src/fasta/type_inference/type_promotion: Fail