Version 2.11.0-203.0.dev

Merge commit '057ac51f12cbf007cb07f62ade9b0e1931ffb2fe' into 'dev'
diff --git a/DEPS b/DEPS
index b5cc604..eaa25b8 100644
--- a/DEPS
+++ b/DEPS
@@ -144,7 +144,7 @@
   "source_maps_rev": "53eb92ccfe6e64924054f83038a534b959b12b3e",
   "source_span_rev": "cc7c4288a83f71ecef3414199947b52a8c112c65",
   "sse_tag": "e5cf68975e8e87171a3dc297577aa073454a91dc",
-  "stack_trace_tag": "a958966148516dfa64e2b54c14492175da5cc8e1",
+  "stack_trace_tag": "45319bfd2a6da228d8c32b06e1da02ad199373c7",
   "stagehand_tag": "v3.3.9",
   "stream_channel_tag": "c446774fd077c9bdbd6235a7aadc661ef60a9727",
   "string_scanner_rev": "1b63e6e5db5933d7be0a45da6e1129fe00262734",
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 336445e..ee58748 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -425,9 +425,6 @@
     configs = []  # Prevent list overwriting warning.
     configs = invoker.configs
 
-    # See above call.
-    set_sources_assignment_filter([])
-
     if (defined(invoker.all_dependent_configs)) {
       all_dependent_configs = invoker.all_dependent_configs
     }
diff --git a/build/config/mac/rules.gni b/build/config/mac/rules.gni
index df8080e..85f7b92 100644
--- a/build/config/mac/rules.gni
+++ b/build/config/mac/rules.gni
@@ -72,7 +72,6 @@
   _resources = invoker.resources
 
   copy(target_name) {
-    set_sources_assignment_filter([])
     sources = _resources
     outputs = [ "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}" ]
 
diff --git a/build/config/templates/templates.gni b/build/config/templates/templates.gni
index cd310ce..a8815f8 100644
--- a/build/config/templates/templates.gni
+++ b/build/config/templates/templates.gni
@@ -17,8 +17,6 @@
 #     variables = "app_name=chrome_shell app_version=1"
 #   }
 template("file_template") {
-  set_sources_assignment_filter([])
-
   if (defined(invoker.testonly)) {
     testonly = invoker.testonly
   }
diff --git a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
index 03877e4..f809b87 100644
--- a/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart
@@ -607,6 +607,10 @@
   /// Call this method just after visiting the initializer of a late variable.
   void lateInitializer_end();
 
+  /// Call this method before visiting the LHS of a logical binary operation
+  /// ("||" or "&&").
+  void logicalBinaryOp_begin();
+
   /// Call this method after visiting the RHS of a logical binary operation
   /// ("||" or "&&").
   /// [wholeExpression] should be the whole logical binary expression.
@@ -1099,6 +1103,11 @@
   }
 
   @override
+  void logicalBinaryOp_begin() {
+    _wrap('logicalBinaryOp_begin()', () => _wrapped.logicalBinaryOp_begin());
+  }
+
+  @override
   void logicalBinaryOp_end(Expression wholeExpression, Expression rightOperand,
       {@required bool isAnd}) {
     _wrap(
@@ -2720,6 +2729,7 @@
 
   @override
   void assert_begin() {
+    _current = _current.split();
     _stack.add(new _AssertContext<Variable, Type>(_current));
   }
 
@@ -2727,7 +2737,7 @@
   void assert_end() {
     _AssertContext<Variable, Type> context =
         _stack.removeLast() as _AssertContext<Variable, Type>;
-    _current = _join(context._previous, context._conditionInfo.ifTrue);
+    _current = _merge(context._previous, context._conditionInfo.ifTrue);
   }
 
   @override
@@ -2984,7 +2994,7 @@
     // common base class.  See https://github.com/dart-lang/sdk/issues/43725.
     _SimpleContext<Variable, Type> context =
         _stack.removeLast() as _SimpleContext<Variable, Type>;
-    _current = _join(_current, context._previous);
+    _current = _merge(_current, context._previous);
   }
 
   @override
@@ -2992,6 +3002,7 @@
       Expression leftHandSide, Type leftHandSideType) {
     ExpressionInfo<Variable, Type> lhsInfo = _getExpressionInfo(leftHandSide);
     FlowModel<Variable, Type> promoted;
+    _current = _current.split();
     if (lhsInfo is _VariableReadInfo<Variable, Type>) {
       ExpressionInfo<Variable, Type> promotionInfo =
           _current.tryMarkNonNullable(typeOperations, lhsInfo._variable);
@@ -3070,6 +3081,7 @@
 
   @override
   void labeledStatement_begin(Node node) {
+    _current = _current.split();
     _BranchTargetContext<Variable, Type> context =
         new _BranchTargetContext<Variable, Type>(_current.reachable.parent);
     _stack.add(context);
@@ -3080,7 +3092,7 @@
   void labeledStatement_end() {
     _BranchTargetContext<Variable, Type> context =
         _stack.removeLast() as _BranchTargetContext<Variable, Type>;
-    _current = _join(_current, context._breakModel);
+    _current = _merge(_current, context._breakModel);
   }
 
   @override
@@ -3104,6 +3116,11 @@
   }
 
   @override
+  void logicalBinaryOp_begin() {
+    _current = _current.split();
+  }
+
+  @override
   void logicalBinaryOp_end(Expression wholeExpression, Expression rightOperand,
       {@required bool isAnd}) {
     _BranchContext<Variable, Type> context =
@@ -3121,8 +3138,8 @@
     }
     _storeExpressionInfo(
         wholeExpression,
-        new ExpressionInfo(
-            _join(trueResult, falseResult), trueResult, falseResult));
+        new ExpressionInfo(_merge(trueResult, falseResult),
+            trueResult.unsplit(), falseResult.unsplit()));
   }
 
   @override
@@ -3156,12 +3173,13 @@
     // common base class.  See https://github.com/dart-lang/sdk/issues/43725.
     _SimpleContext<Variable, Type> context =
         _stack.removeLast() as _SimpleContext<Variable, Type>;
-    _current = _join(_current, context._previous);
+    _current = _merge(_current, context._previous);
   }
 
   @override
   bool nullAwareAccess_rightBegin(Expression target, Type targetType) {
     assert(targetType != null);
+    _current = _current.split();
     _stack.add(new _NullAwareAccessContext<Variable, Type>(_current));
     if (target != null) {
       ExpressionInfo<Variable, Type> targetInfo = _getExpressionInfo(target);
@@ -3223,11 +3241,12 @@
     // And, if there is an implicit fall-through default, join it to any breaks.
     if (!isExhaustive) breakState = _join(breakState, context._previous);
 
-    _current = breakState;
+    _current = breakState.unsplit();
   }
 
   @override
   void switchStatement_expressionEnd(Statement switchStatement) {
+    _current = _current.split();
     _SimpleStatementContext<Variable, Type> context =
         new _SimpleStatementContext<Variable, Type>(
             _current.reachable.parent, _current);
@@ -3237,6 +3256,7 @@
 
   @override
   void tryCatchStatement_bodyBegin() {
+    _current = _current.split();
     _stack.add(new _TryContext<Variable, Type>(_current));
   }
 
@@ -3283,7 +3303,7 @@
   void tryCatchStatement_end() {
     _TryContext<Variable, Type> context =
         _stack.removeLast() as _TryContext<Variable, Type>;
-    _current = context._afterBodyAndCatches;
+    _current = context._afterBodyAndCatches.unsplit();
   }
 
   @override
@@ -3331,6 +3351,7 @@
 
   @override
   void whileStatement_conditionBegin(Node node) {
+    _current = _current.split();
     AssignedVariablesNodeInfo<Variable> info =
         _assignedVariables._getInfoForNode(node);
     _current = _current.conservativeJoin(info._written, info._captured);
@@ -3340,7 +3361,7 @@
   void whileStatement_end() {
     _WhileContext<Variable, Type> context =
         _stack.removeLast() as _WhileContext<Variable, Type>;
-    _current = _join(context._conditionInfo.ifFalse, context._breakModel)
+    _current = _merge(context._conditionInfo.ifFalse, context._breakModel)
         .inheritTested(typeOperations, _current);
   }
 
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart b/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart
index 979be2e..8b5ee79 100644
--- a/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_test.dart
@@ -1421,6 +1421,7 @@
       var x = h.addVar('x', 'int?');
       h.run((flow) {
         h.declare(x, initialized: true);
+        flow.logicalBinaryOp_begin();
         flow.logicalBinaryOp_rightBegin(h.notNull(x, _Type('int?'))(),
             isAnd: true);
         expect(flow.promotedType(x).type, 'int');
@@ -1434,6 +1435,7 @@
       h.run((flow) {
         h.declare(x, initialized: true);
         flow.ifStatement_conditionBegin();
+        flow.logicalBinaryOp_begin();
         flow.logicalBinaryOp_rightBegin(_Expression(), isAnd: true);
         var wholeExpr = _Expression();
         flow.logicalBinaryOp_end(wholeExpr, h.notNull(x, _Type('int?'))(),
@@ -1451,6 +1453,7 @@
       h.run((flow) {
         h.declare(x, initialized: true);
         flow.ifStatement_conditionBegin();
+        flow.logicalBinaryOp_begin();
         flow.logicalBinaryOp_rightBegin(_Expression(), isAnd: false);
         var wholeExpr = _Expression();
         flow.logicalBinaryOp_end(wholeExpr, h.eqNull(x, _Type('int?'))(),
@@ -1467,6 +1470,7 @@
       var x = h.addVar('x', 'int?');
       h.run((flow) {
         h.declare(x, initialized: true);
+        flow.logicalBinaryOp_begin();
         flow.logicalBinaryOp_rightBegin(h.eqNull(x, _Type('int?'))(),
             isAnd: false);
         expect(flow.promotedType(x).type, 'int');
@@ -4146,6 +4150,7 @@
   LazyExpression and(LazyExpression lhs, LazyExpression rhs) {
     return () {
       var expr = _Expression();
+      _flow.logicalBinaryOp_begin();
       _flow.logicalBinaryOp_rightBegin(lhs(), isAnd: true);
       _flow.logicalBinaryOp_end(expr, rhs(), isAnd: true);
       return expr;
@@ -4322,6 +4327,7 @@
   LazyExpression or(LazyExpression lhs, LazyExpression rhs) {
     return () {
       var expr = _Expression();
+      _flow.logicalBinaryOp_begin();
       _flow.logicalBinaryOp_rightBegin(lhs(), isAnd: false);
       _flow.logicalBinaryOp_end(expr, rhs(), isAnd: false);
       return expr;
diff --git a/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/promotion_in_dead_code.dart b/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/promotion_in_dead_code.dart
index e8dfacd..21f9263 100644
--- a/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/promotion_in_dead_code.dart
+++ b/pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/data/promotion_in_dead_code.dart
@@ -6,6 +6,98 @@
 // promotion continue to function properly even when used inside unreachable
 // code.
 
+abstract class C {
+  void f(Object x, Object y);
+}
+
+andExpression_alwaysFalse(Object o) {
+  return;
+  o is! int && (throw 'x');
+  /*int*/ o;
+}
+
+andExpression_alwaysTrue(Object o) {
+  return;
+  true && (o is int || (throw 'x'));
+  /*int*/ o;
+}
+
+andExpression_lhsAlwaysTrue(Object o) {
+  return;
+  if (true && o is! int) {
+    o;
+  } else {
+    /*int*/ o;
+  }
+}
+
+andExpression_rhsAlwaysTrue(Object o) {
+  return;
+  if (o is! int && true) {
+    o;
+  } else {
+    /*int*/ o;
+  }
+}
+
+assertAlwaysThrows(Object o, Object p, bool Function(Object, Object) f) {
+  if (o is! int) return;
+  return;
+  assert(f(o = p, throw 'x'));
+  /*int*/ o;
+}
+
+class AssertAlwaysThrows_Constructor {
+  Object a;
+  Object b;
+
+  AssertAlwaysThrows_Constructor(
+      Object o, Object p, bool Function(Object, Object) f)
+      : a = o is int ? true : throw 'x',
+        b = throw 'x',
+        assert(f(o = p, throw 'x')) {
+    /*int*/ o;
+  }
+}
+
+assertFailsButMessageRepromotes(Object? o) {
+  if (o is! int) return;
+  return;
+  assert((o = null) != null, o is int ? 'ok' : throw 'x');
+  /*int*/ o;
+}
+
+class AssertFailsButMessageRepromotes_Constructor {
+  Object a;
+  Object b;
+
+  AssertFailsButMessageRepromotes_Constructor(Object? o)
+      : a = o is int ? true : throw 'x',
+        b = throw 'x',
+        assert((o = null) != null, o is int ? 'ok' : throw 'x') {
+    /*int*/ o;
+  }
+}
+
+assertMessageDepromotesButAlwaysThrows(Object o, Object p, bool b) {
+  if (o is! int) return;
+  return;
+  assert(b, throw (o = p));
+  /*int*/ o;
+}
+
+class AssertMessageDepromotesButAlwaysThrows {
+  Object a;
+  Object b;
+
+  AssertMessageDepromotesButAlwaysThrows(Object o, Object p, bool b)
+      : a = o is int ? true : throw 'x',
+        b = throw 'x',
+        assert(b, throw (o = p)) {
+    /*int*/ o;
+  }
+}
+
 conditionalIs(Object o) {
   return;
   o is int ? null : throw 'bad';
@@ -92,3 +184,106 @@
   ({if (o is! int) 0: throw 'x'});
   /*int*/ o;
 }
+
+ifNull(Object o, Object? p, Object q, void Function(Object, Object) f) {
+  return;
+  (o is int ? p : throw 'x') ?? f(o = q, throw 'x');
+  /*int*/ o;
+}
+
+labeledStatement(Object o) {
+  return;
+  label:
+  {
+    if (o is int) break label;
+    return;
+  }
+  /*int*/ o;
+}
+
+nullAwareAccess(Object o, C? p, Object q) {
+  return;
+  (o is int ? p : throw 'x')?.f(o = q, throw 'x');
+  /*int*/ o;
+}
+
+orExpression_alwaysFalse(Object o) {
+  return;
+  false || (o is! int && (throw 'x'));
+  /*int*/ o;
+}
+
+orExpression_alwaysTrue(Object o) {
+  return;
+  o is int || (throw 'x');
+  /*int*/ o;
+}
+
+orExpression_lhsAlwaysFalse(Object o) {
+  return;
+  if (false || o is int) {
+    /*int*/ o;
+  } else {
+    o;
+  }
+}
+
+orExpression_rhsAlwaysFalse(Object o) {
+  return;
+  if (o is int || false) {
+    /*int*/ o;
+  } else {
+    o;
+  }
+}
+
+switchPromoteInCase(Object o, int i) {
+  return;
+  switch (i) {
+    case 0:
+      if (o is! int) return;
+      break;
+    default:
+      return;
+  }
+  /*int*/ o;
+}
+
+switchPromoteInImplicitDefault(Object o, int i, Object p) {
+  return;
+  if (o is! int) return;
+  switch (i) {
+    case 0:
+      o = p;
+      return;
+  }
+  /*int*/ o;
+}
+
+tryCatchPromoteInTry(Object o) {
+  return;
+  try {
+    if (o is! int) return;
+  } catch (_) {
+    return;
+  }
+  /*int*/ o;
+}
+
+tryCatchPromoteInCatch(Object o) {
+  return;
+  try {
+    return;
+  } catch (_) {
+    if (o is! int) return;
+  }
+  /*int*/ o;
+}
+
+whileBreak(Object o) {
+  return;
+  while (true) {
+    if (o is int) break;
+  }
+  /*int*/ o;
+}
diff --git a/pkg/analysis_server/analysis_options.yaml b/pkg/analysis_server/analysis_options.yaml
index 31a937b..254951f 100644
--- a/pkg/analysis_server/analysis_options.yaml
+++ b/pkg/analysis_server/analysis_options.yaml
@@ -21,6 +21,7 @@
     - iterable_contains_unrelated_type
     - list_remove_unrelated_type
     - prefer_initializing_formals
+    - prefer_typing_uninitialized_variables
     - unnecessary_brace_in_string_interps
     - unnecessary_overrides
     - void_checks
diff --git a/pkg/analysis_server/benchmark/integration/input_converter.dart b/pkg/analysis_server/benchmark/integration/input_converter.dart
index 5c04dd7..7f7ca06 100644
--- a/pkg/analysis_server/benchmark/integration/input_converter.dart
+++ b/pkg/analysis_server/benchmark/integration/input_converter.dart
@@ -334,7 +334,7 @@
 
 class _InputSink extends ChunkedConversionSink<String> {
   final Converter<String, Operation> converter;
-  final outSink;
+  final Sink<Operation> outSink;
 
   _InputSink(this.converter, this.outSink);
 
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index c16084d..1d527b0 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -818,26 +818,29 @@
               }
             }
           }
-          if (visitors.isNotEmpty) {
-            var sourceUri = resourceProvider.pathContext.toUri(path);
-            var pubspecAst = Pubspec.parse(content,
-                sourceUrl: sourceUri, resourceProvider: resourceProvider);
-            var listener = RecordingErrorListener();
-            var reporter = ErrorReporter(listener,
-                resourceProvider.getFile(path).createSource(sourceUri),
-                isNonNullableByDefault: false);
-            for (var entry in visitors.entries) {
-              entry.key.reporter = reporter;
-              pubspecAst.accept(entry.value);
-            }
-            if (listener.errors.isNotEmpty) {
-              convertedErrors ??= <protocol.AnalysisError>[];
-              convertedErrors.addAll(converter.convertAnalysisErrors(
-                  listener.errors,
-                  lineInfo: lineInfo,
-                  options: driver.analysisOptions));
-            }
-          }
+          // todo (pq): re-enable once `sort_pub_dependencies` is fixed
+          // see: https://github.com/dart-lang/linter/issues/2271
+          // see: See: https://github.com/dart-lang/sdk/issues/43529
+          //   if (visitors.isNotEmpty) {
+          //     var sourceUri = resourceProvider.pathContext.toUri(path);
+          //     var pubspecAst = Pubspec.parse(content,
+          //         sourceUrl: sourceUri, resourceProvider: resourceProvider);
+          //     var listener = RecordingErrorListener();
+          //     var reporter = ErrorReporter(listener,
+          //         resourceProvider.getFile(path).createSource(sourceUri),
+          //         isNonNullableByDefault: false);
+          //     for (var entry in visitors.entries) {
+          //       entry.key.reporter = reporter;
+          //       pubspecAst.accept(entry.value);
+          //     }
+          //     if (listener.errors.isNotEmpty) {
+          //       convertedErrors ??= <protocol.AnalysisError>[];
+          //       convertedErrors.addAll(converter.convertAnalysisErrors(
+          //           listener.errors,
+          //           lineInfo: lineInfo,
+          //           options: driver.analysisOptions));
+          //     }
+          //   }
         }
       }
     } catch (exception) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
index 979b63f..3d8234d 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
@@ -8,6 +8,7 @@
 import 'package:analysis_server/src/utilities/extensions/ast.dart';
 import 'package:analyzer/dart/analysis/features.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/syntactic_entity.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
@@ -169,7 +170,7 @@
 
   @override
   void visitCompilationUnit(CompilationUnit node) {
-    var previousMember;
+    SyntacticEntity previousMember;
     for (var member in node.childEntities) {
       if (entity == member) {
         break;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index df843b8..f638e9a 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -44,8 +44,6 @@
     var suggestLocalFields = node is ConstructorDeclaration &&
         node.initializers.contains(request.target.entity);
 
-    var localVisitor;
-
     // Collect suggestions from the specific child [AstNode] that contains the
     // completion offset and all of its parents recursively.
     if (!opType.isPrefixed) {
@@ -67,10 +65,10 @@
           node = node.parent.parent;
         }
 
-        localVisitor = _LocalVisitor(request, builder, visibilityTracker,
-            suggestLocalFields: suggestLocalFields);
         try {
           builder.laterReplacesEarlier = false;
+          var localVisitor = _LocalVisitor(request, builder, visibilityTracker,
+              suggestLocalFields: suggestLocalFields);
           localVisitor.visit(node);
         } finally {
           builder.laterReplacesEarlier = true;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index d05d23a..ae57075 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -937,7 +937,7 @@
 
   /// Add a suggestion for a [prefix] associated with a [library].
   void suggestPrefix(LibraryElement library, String prefix) {
-    var relevance;
+    int relevance;
     if (request.useNewRelevance) {
       var elementKind = _computeElementKind(library);
       // TODO(brianwilkerson) If we are in a constant context it would be nice
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
index 0568dba..e829ce1 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
@@ -56,7 +56,7 @@
       FunctionType type = param.type;
 
       var rangeStart = offset;
-      var rangeLength;
+      int rangeLength;
 
       // todo (pq): consider adding ranges for params
       // pending: https://github.com/dart-lang/sdk/issues/40207
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart
index 30ae5ef..af47d5d 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart
@@ -42,8 +42,8 @@
       return;
     }
 
-    var constructorId;
-    var typeArgs;
+    String constructorId;
+    List<DartType> typeArgs;
     var constructorName = '';
 
     if (type.element is FunctionTypedElement) {
@@ -133,8 +133,8 @@
     if (body is BlockFunctionBody) {
       var functionBody = body;
 
-      var offset;
-      var prefix;
+      int offset;
+      String prefix;
       if (functionBody.block.statements.isEmpty) {
         offset = functionBody.block.leftBracket.offset;
         prefix = utils.getLinePrefix(offset) + utils.getIndent(1);
@@ -144,7 +144,7 @@
       }
 
       var parameters = debugFillProperties.parameters.parameters;
-      var propertiesBuilderName;
+      String propertiesBuilderName;
       for (var parameter in parameters) {
         if (parameter is SimpleFormalParameter) {
           final type = parameter.type;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/add_not_null_assert.dart b/pkg/analysis_server/lib/src/services/correction/dart/add_not_null_assert.dart
index 7ce7207..20b8972 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/add_not_null_assert.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/add_not_null_assert.dart
@@ -22,7 +22,7 @@
       if (identifier.parent is FormalParameter) {
         final exp = identifier.parent.thisOrAncestorMatching(
             (node) => node is FunctionExpression || node is MethodDeclaration);
-        var body;
+        FunctionBody body;
         if (exp is FunctionExpression) {
           body = exp.body;
         } else if (exp is MethodDeclaration) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
index 4cf4b5c..17509ff 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_method.dart
@@ -41,7 +41,7 @@
     if (methodDecl != null && classDecl != null) {
       final classElement = classDecl.declaredElement;
 
-      var element;
+      ExecutableElement element;
       if (methodDecl.name.name == 'hashCode') {
         _memberName = '==';
         element = classElement.lookUpInheritedMethod(
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
index d90106e..790b766 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_unused.dart
@@ -33,7 +33,7 @@
       final references = _findAllReferences(unit, element);
       // todo (pq): consider filtering for references that are limited to within the class.
       if (references.length == 1) {
-        var sourceRange;
+        SourceRange sourceRange;
         if (referencedNode is VariableDeclaration) {
           VariableDeclarationList parent = referencedNode.parent;
           if (parent.variables.length == 1) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart
index 7adfbe7..2bafcfb 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_null_with_closure.dart
@@ -17,7 +17,7 @@
 
   @override
   Future<void> compute(ChangeBuilder builder) async {
-    var nodeToFix;
+    AstNode nodeToFix;
     var parameters = const <ParameterElement>[];
     if (coveredNode is NamedExpression) {
       NamedExpression namedExpression = coveredNode;
diff --git a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
index 99e8dd2..f2f430f 100644
--- a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
+++ b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
@@ -1225,7 +1225,7 @@
         addNodeAndFacts(schema.TAPP_KIND, element: functionElement);
     addEdge(funcTypeVName, schema.PARAM_EDGE, fnBuiltin, ordinalIntValue: i++);
 
-    var returnTypeVName;
+    KytheVName returnTypeVName;
     if (returnNode is TypeName) {
       // MethodDeclaration and FunctionDeclaration both return a TypeName from
       // returnType
diff --git a/pkg/analysis_server/lib/src/utilities/mocks.dart b/pkg/analysis_server/lib/src/utilities/mocks.dart
index 786162f..97d5420 100644
--- a/pkg/analysis_server/lib/src/utilities/mocks.dart
+++ b/pkg/analysis_server/lib/src/utilities/mocks.dart
@@ -128,7 +128,7 @@
 }
 
 class ServerError implements Exception {
-  final message;
+  final String message;
 
   ServerError(this.message);
 
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index aa6c33b..3e49eab 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -482,6 +482,10 @@
     expect(errors, hasLength(0));
   }
 
+  /// Re-enable once `sort_pub_dependencies` is fixed
+  /// See: https://github.com/dart-lang/sdk/issues/43529
+  /// See: https://github.com/dart-lang/linter/issues/2271
+  @failingTest
   Future<void> test_pubspecFile_lint() async {
     var optionsPath = join(projectPath, 'analysis_options.yaml');
     newFile(optionsPath, content: '''
diff --git a/pkg/analysis_server/test/domain_completion_util.dart b/pkg/analysis_server/test/domain_completion_util.dart
index 81f936f..7d42cf0 100644
--- a/pkg/analysis_server/test/domain_completion_util.dart
+++ b/pkg/analysis_server/test/domain_completion_util.dart
@@ -46,7 +46,7 @@
       bool isPotential = false,
       int selectionOffset,
       ElementKind elementKind}) {
-    var cs;
+    CompletionSuggestion cs;
     suggestions.forEach((s) {
       if (elementKind != null && s.element?.kind != elementKind) {
         return;
diff --git a/pkg/analysis_server/test/integration/support/integration_tests.dart b/pkg/analysis_server/test/integration/support/integration_tests.dart
index f58ca4d..8f34d32 100644
--- a/pkg/analysis_server/test/integration/support/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/support/integration_tests.dart
@@ -479,7 +479,7 @@
       }
 
       _recordStdio('<== $trimmedLine');
-      var message;
+      Map message;
       try {
         message = json.decoder.convert(trimmedLine);
       } catch (exception) {
@@ -487,9 +487,8 @@
         return;
       }
       outOfTestExpect(message, isMap);
-      Map messageAsMap = message;
-      if (messageAsMap.containsKey('id')) {
-        outOfTestExpect(messageAsMap['id'], isString);
+      if (message.containsKey('id')) {
+        outOfTestExpect(message['id'], isString);
         String id = message['id'];
         var completer = _pendingCommands[id];
         if (completer == null) {
@@ -497,10 +496,10 @@
         } else {
           _pendingCommands.remove(id);
         }
-        if (messageAsMap.containsKey('error')) {
-          completer.completeError(ServerErrorMessage(messageAsMap));
+        if (message.containsKey('error')) {
+          completer.completeError(ServerErrorMessage(message));
         } else {
-          completer.complete(messageAsMap['result']);
+          completer.complete(message['result']);
         }
         // Check that the message is well-formed.  We do this after calling
         // completer.complete() or completer.completeError() so that we don't
@@ -509,9 +508,9 @@
       } else {
         // Message is a notification.  It should have an event and possibly
         // params.
-        outOfTestExpect(messageAsMap, contains('event'));
-        outOfTestExpect(messageAsMap['event'], isString);
-        notificationProcessor(messageAsMap['event'], messageAsMap['params']);
+        outOfTestExpect(message, contains('event'));
+        outOfTestExpect(message['event'], isString);
+        notificationProcessor(message['event'], message['params']);
         // Check that the message is well-formed.  We do this after calling
         // notificationController.add() so that we don't stall the test in the
         // event of an error.
diff --git a/pkg/analysis_server/test/stress/replay/replay.dart b/pkg/analysis_server/test/stress/replay/replay.dart
index 64c5ea0..cc487bb 100644
--- a/pkg/analysis_server/test/stress/replay/replay.dart
+++ b/pkg/analysis_server/test/stress/replay/replay.dart
@@ -512,7 +512,7 @@
   /// Return a list of operations to be sent to the server.
   List<ServerOperation> getOperations() {
     var operations = <ServerOperation>[];
-    void addUpdateContent(var overlay) {
+    void addUpdateContent(Object overlay) {
       operations.add(Analysis_UpdateContent(filePath, overlay));
     }
 
@@ -522,7 +522,7 @@
     addUpdateContent(AddContentOverlay(content));
     for (var editList in editLists.reversed) {
       for (var edit in editList.reversed) {
-        var overlay;
+        Object overlay;
         if (overlayStyle == OverlayStyle.change) {
           overlay = ChangeContentOverlay([edit]);
         } else if (overlayStyle == OverlayStyle.multipleAdd) {
diff --git a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
index 309d8a1..13f27be 100644
--- a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
+++ b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
@@ -506,15 +506,11 @@
       bool doPrintMissedCompletions) {
     assert(suggestions != null);
 
-    var rank;
-
     var place = placementInSuggestionList(suggestions, expectedCompletion);
 
     metrics.mrrComputer.addRank(place.rank);
 
     if (place.denominator != 0) {
-      rank = place.rank;
-
       metrics.completionCounter.count('successful');
 
       metrics.recordCompletionResult(CompletionResult(place, request, listener,
@@ -527,9 +523,9 @@
           _computeCharsBeforeTop(expectedCompletion, suggestions, minRank: 5));
       metrics.insertionLengthTheoretical
           .addValue(expectedCompletion.completion.length - charsBeforeTop);
-    } else {
-      rank = -1;
 
+      return place.rank;
+    } else {
       metrics.completionCounter.count('unsuccessful');
 
       metrics.completionMissedTokenCounter.count(expectedCompletion.completion);
@@ -538,7 +534,7 @@
           .count(expectedCompletion.elementKind.toString());
 
       if (doPrintMissedCompletions) {
-        var closeMatchSuggestion;
+        protocol.CompletionSuggestion closeMatchSuggestion;
         for (var suggestion in suggestions) {
           if (suggestion.completion == expectedCompletion.completion) {
             closeMatchSuggestion = suggestion;
@@ -553,8 +549,9 @@
         }
         print('');
       }
+
+      return -1;
     }
-    return rank;
   }
 
   void printMetrics(CompletionMetrics metrics) {
@@ -713,7 +710,7 @@
       [DeclarationsTracker declarationsTracker,
       protocol.CompletionAvailableSuggestionsParams
           availableSuggestionsParams]) async {
-    var suggestions;
+    List<protocol.CompletionSuggestion> suggestions;
 
     if (declarationsTracker == null) {
       // available suggestions == false
@@ -801,8 +798,8 @@
 
     // Set the DeclarationsTracker, only call doWork to build up the available
     // suggestions if doComputeCompletionsFromAnalysisServer is true.
-    var declarationsTracker;
-    var availableSuggestionsParams;
+    DeclarationsTracker declarationsTracker;
+    protocol.CompletionAvailableSuggestionsParams availableSuggestionsParams;
     if (availableSuggestions) {
       declarationsTracker = DeclarationsTracker(
           MemoryByteStore(), PhysicalResourceProvider.INSTANCE);
@@ -912,7 +909,7 @@
 
             // First we compute the completions useNewRelevance set to
             // false:
-            var oldRank;
+            int oldRank;
             if (!skipOldRelevance) {
               oldRank = await handleExpectedCompletion(
                   metrics: metricsOldMode,
diff --git a/pkg/analysis_server/tool/completion_metrics/corpus.dart b/pkg/analysis_server/tool/completion_metrics/corpus.dart
index c79b368..71e09fb 100644
--- a/pkg/analysis_server/tool/completion_metrics/corpus.dart
+++ b/pkg/analysis_server/tool/completion_metrics/corpus.dart
@@ -74,7 +74,7 @@
   final name =
       _trimName(repo.split('https://github.com/').last.replaceAll('/', '_'));
   final cloneDir = path.join(_appDir, name);
-  var result;
+  ProcessResult result;
   if (Directory(cloneDir).existsSync()) {
     if (!updateExistingClones) {
       return CloneResult(0, cloneDir);
diff --git a/pkg/analysis_server/tool/completion_metrics/visitors.dart b/pkg/analysis_server/tool/completion_metrics/visitors.dart
index b234a9b..0b130f7 100644
--- a/pkg/analysis_server/tool/completion_metrics/visitors.dart
+++ b/pkg/analysis_server/tool/completion_metrics/visitors.dart
@@ -571,7 +571,7 @@
   @override
   void visitSimpleIdentifier(SimpleIdentifier node) {
     if (_doIncludeSimpleIdentifier(node)) {
-      var elementKind;
+      protocol.ElementKind elementKind;
       if (node.staticElement?.kind != null) {
         elementKind = protocol.convertElementKind(node.staticElement.kind);
 
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index ea02226..ab4089c 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -260,6 +260,7 @@
   CompileTimeErrorCode.LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR,
   CompileTimeErrorCode.LATE_FINAL_LOCAL_ALREADY_ASSIGNED,
   CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
+  CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE,
   CompileTimeErrorCode.MAIN_HAS_REQUIRED_NAMED_PARAMETERS,
   CompileTimeErrorCode.MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS,
   CompileTimeErrorCode.MAIN_IS_NOT_FUNCTION,
diff --git a/pkg/analyzer/lib/src/dart/ast/extensions.dart b/pkg/analyzer/lib/src/dart/ast/extensions.dart
index fd66ae4..0c42457 100644
--- a/pkg/analyzer/lib/src/dart/ast/extensions.dart
+++ b/pkg/analyzer/lib/src/dart/ast/extensions.dart
@@ -5,6 +5,24 @@
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
 
+extension FormalParameterExtension on FormalParameter {
+  FormalParameter get notDefault {
+    var self = this;
+    if (self is DefaultFormalParameter) {
+      return self.parameter;
+    }
+    return self;
+  }
+
+  AstNode get typeOrSelf {
+    var self = this;
+    if (self is SimpleFormalParameter) {
+      return self.type;
+    }
+    return self;
+  }
+}
+
 extension ListOfFormalParameterExtension on List<FormalParameter> {
   Iterable<FormalParameterImpl> get asImpl {
     return cast<FormalParameterImpl>();
diff --git a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
index 2564ef7..7572eeb 100644
--- a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
@@ -176,6 +176,7 @@
     InferenceContext.setType(left, _typeProvider.boolType);
     InferenceContext.setType(right, _typeProvider.boolType);
 
+    flow?.logicalBinaryOp_begin();
     left.accept(_resolver);
     left = node.leftOperand;
 
@@ -213,6 +214,7 @@
     InferenceContext.setType(left, _typeProvider.boolType);
     InferenceContext.setType(right, _typeProvider.boolType);
 
+    flow?.logicalBinaryOp_begin();
     left.accept(_resolver);
     left = node.leftOperand;
 
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 3197fa7..6ffb26a 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -5460,12 +5460,12 @@
           "The element type '{0}' can't be assigned to the list type '{1}'.",
           hasPublishedDocs: true);
 
-  static const CompileTimeErrorCode
-      MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS = CompileTimeErrorCode(
-    'MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS',
-    "The function 'main' can't have more than two required positional parameters.",
-    correction: "Try using a different name for the function, "
-        "or removing extra parameters.",
+  static const CompileTimeErrorCode MAIN_FIRST_POSITIONAL_PARAMETER_TYPE =
+      CompileTimeErrorCode(
+    'MAIN_FIRST_POSITIONAL_PARAMETER_TYPE',
+    "The type of the first positional parameter of the 'main' function "
+        "must be a supertype of List<String>.",
+    correction: "Try changing the type of the parameter.",
   );
 
   static const CompileTimeErrorCode MAIN_HAS_REQUIRED_NAMED_PARAMETERS =
@@ -5476,6 +5476,14 @@
         "or removing the 'required' modifier.",
   );
 
+  static const CompileTimeErrorCode
+      MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS = CompileTimeErrorCode(
+    'MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS',
+    "The function 'main' can't have more than two required positional parameters.",
+    correction: "Try using a different name for the function, "
+        "or removing extra parameters.",
+  );
+
   static const CompileTimeErrorCode MAIN_IS_NOT_FUNCTION = CompileTimeErrorCode(
     'MAIN_IS_NOT_FUNCTION',
     "The declaration named 'main' must be a function.",
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 5ad8d00..dfc4756 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -17,6 +17,7 @@
 import 'package:analyzer/error/listener.dart';
 import 'package:analyzer/src/dart/analysis/session.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
+import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer/src/dart/element/class_hierarchy.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
@@ -3128,7 +3129,10 @@
       return;
     }
 
-    var parameters = (element as FunctionElement).parameters;
+    var functionDeclaration = nameNode.parent as FunctionDeclaration;
+    var functionExpression = functionDeclaration.functionExpression;
+    var parameters = functionExpression.parameters.parameters;
+    var positional = parameters.where((e) => e.isPositional).toList();
     var requiredPositional =
         parameters.where((e) => e.isRequiredPositional).toList();
 
@@ -3145,6 +3149,18 @@
         nameNode,
       );
     }
+
+    if (positional.isNotEmpty) {
+      var first = positional.first;
+      var type = first.declaredElement.type;
+      var listOfString = _typeProvider.listType2(_typeProvider.stringType);
+      if (!_typeSystem.isSubtypeOf2(listOfString, type)) {
+        _errorReporter.reportErrorForNode(
+          CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE,
+          first.notDefault.typeOrSelf,
+        );
+      }
+    }
   }
 
   void _checkForMapTypeNotAssignable(SetOrMapLiteral literal) {
diff --git a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
index 1af5544..3c5983e 100644
--- a/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/assignment_test.dart
@@ -1812,7 +1812,7 @@
 
   test_simpleIdentifier_parameter_compound_refineType_int_int() async {
     await assertNoErrorsInCode(r'''
-main(int x) {
+void f(int x) {
   x += 1;
   x -= 1;
   x *= 1;
diff --git a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
index d35a83b..b484064 100644
--- a/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/binary_expression_test.dart
@@ -735,7 +735,7 @@
 
   test_ifNull_nullableInt_int() async {
     await assertNoErrorsInCode(r'''
-main(int? x, int y) {
+void f(int? x, int y) {
   x ?? y;
 }
 ''');
@@ -749,7 +749,7 @@
 
   test_ifNull_nullableInt_nullableDouble() async {
     await assertNoErrorsInCode(r'''
-main(int? x, double? y) {
+void f(int? x, double? y) {
   x ?? y;
 }
 ''');
@@ -763,7 +763,7 @@
 
   test_ifNull_nullableInt_nullableInt() async {
     await assertNoErrorsInCode(r'''
-main(int? x) {
+void f(int? x) {
   x ?? x;
 }
 ''');
diff --git a/pkg/analyzer/test/src/dart/resolution/function_expression_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/function_expression_invocation_test.dart
index 6d80f3d..a1bfdde 100644
--- a/pkg/analyzer/test/src/dart/resolution/function_expression_invocation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/function_expression_invocation_test.dart
@@ -58,7 +58,7 @@
   void call<T>(T t) {}
 }
 
-main(A a) {
+void f(A a) {
   a(0);
 }
 ''');
@@ -102,7 +102,7 @@
   }
 }
 
-main(A a, int context) {
+void f(A a, int context) {
   context = a();
 }
 ''');
@@ -124,7 +124,7 @@
   }
 }
 
-main(A a) {
+void f(A a) {
   a<int>();
 }
 ''');
@@ -140,11 +140,11 @@
 
   test_never() async {
     await assertErrorsInCode(r'''
-main(Never x) {
+void f(Never x) {
   x<int>(1 + 2);
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 18, 1),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
     ]);
 
     assertFunctionExpressionInvocation(
@@ -160,11 +160,11 @@
 
   test_neverQ() async {
     await assertErrorsInCode(r'''
-main(Never? x) {
+void f(Never? x) {
   x<int>(1 + 2);
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 19, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
 
     assertFunctionExpressionInvocation(
diff --git a/pkg/analyzer/test/src/dart/resolution/if_element_test.dart b/pkg/analyzer/test/src/dart/resolution/if_element_test.dart
index 785f95a..7b76cf5 100644
--- a/pkg/analyzer/test/src/dart/resolution/if_element_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/if_element_test.dart
@@ -17,7 +17,7 @@
 class IfElementTest extends PubPackageResolutionTest {
   test_condition_rewrite() async {
     await assertNoErrorsInCode(r'''
-main(bool Function() b) {
+void f(bool Function() b) {
   <int>[if ( b() ) 0];
 }
 ''');
diff --git a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
index a297211..77238af 100644
--- a/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/index_expression_test.dart
@@ -22,7 +22,7 @@
   bool operator[](int index) => false;
 }
 
-main(A a) {
+void f(A a) {
   a[0];
 }
 ''');
@@ -48,7 +48,7 @@
   T operator[](int index) => throw 42;
 }
 
-main(A<double> a) {
+void f(A<double> a) {
   a[0];
 }
 ''');
@@ -78,7 +78,7 @@
   void operator[]=(int index, num value) {}
 }
 
-main(A a) {
+void f(A a) {
   a[0] += 1.2;
 }
 ''');
@@ -125,7 +125,7 @@
   void operator[]=(int index, T value) {}
 }
 
-main(A<double> a) {
+void f(A<double> a) {
   a[0] += 1.2;
 }
 ''');
@@ -183,7 +183,7 @@
   void operator[]=(int index, num value) {}
 }
 
-main(A a) {
+void f(A a) {
   a[0] = 1.2;
 }
 ''');
@@ -221,7 +221,7 @@
   void operator[]=(int index, T value) {}
 }
 
-main(A<double> a) {
+void f(A<double> a) {
   a[0] = 1.2;
 }
 ''');
@@ -269,7 +269,7 @@
   bool operator[](int index) => false;
 }
 
-main(A? a) {
+void f(A? a) {
   a?..[0]..[1];
 }
 ''');
@@ -299,7 +299,7 @@
   bool operator[](int index) => false;
 }
 
-main(A? a) {
+void f(A? a) {
   a?[0];
 }
 ''');
@@ -322,7 +322,7 @@
   void operator[]=(int index, num value) {}
 }
 
-main(A? a) {
+void f(A? a) {
   a?[0] += 1.2;
 }
 ''');
@@ -365,7 +365,7 @@
   void operator[]=(int index, A a) {}
 }
 
-main(A? a) {
+void f(A? a) {
   a?..[0] = a..[1] = a;
 }
 ''');
@@ -395,7 +395,7 @@
   void operator[]=(int index, num value) {}
 }
 
-main(A? a) {
+void f(A? a) {
   a?[0] = 1.2;
 }
 ''');
diff --git a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
index 93ca075..18dc935 100644
--- a/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/method_invocation_test.dart
@@ -465,11 +465,11 @@
   static void foo(int _) {}
 }
 
-main(A a) {
+void f(A a) {
   a.foo(0);
 }
 ''', [
-      error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 57, 3),
+      error(CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, 59, 3),
     ]);
     assertMethodInvocation2(
       findNode.methodInvocation('a.foo(0)'),
@@ -486,11 +486,11 @@
   void Function() call = throw Error();
 }
 
-main(C c) {
+void f(C c) {
   c();
 }
 ''', [
-      error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 67, 1),
+      error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 69, 1),
     ]);
 
     var invocation = findNode.functionExpressionInvocation('c();');
@@ -509,7 +509,7 @@
   var foo;
 }
 
-main(C c) {
+void f(C c) {
   c.foo();
 }
 ''');
@@ -1090,13 +1090,13 @@
   C(this.foo);
 }
 
-main(C<void> c) {
+void f(C<void> c) {
   c.foo();
 }
 ''', [
       if (typeToStringWithNullability)
-        error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 59, 5),
-      error(CompileTimeErrorCode.USE_OF_VOID_RESULT, 59, 5),
+        error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 61, 5),
+      error(CompileTimeErrorCode.USE_OF_VOID_RESULT, 61, 5),
     ]);
 
     var invocation = findNode.functionExpressionInvocation('foo();');
@@ -1448,7 +1448,7 @@
 
   test_hasReceiver_instance_Function_call_localVariable() async {
     await assertNoErrorsInCode(r'''
-void main(Function getFunction()) {
+void f(Function getFunction()) {
   Function foo = getFunction();
 
   foo.call(0);
@@ -1474,7 +1474,7 @@
   double Function(int) get foo => throw Error();
 }
 
-main(C c) {
+void f(C c) {
   c.foo(0);
 }
 ''');
@@ -1496,7 +1496,7 @@
   void foo(int _) {}
 }
 
-main(C c) {
+void f(C c) {
   c.foo(0);
 }
 ''');
@@ -1519,7 +1519,7 @@
   }
 }
 
-main(C c) {
+void f(C c) {
   c.foo(0);
 }
 ''');
@@ -1551,7 +1551,7 @@
   void foo(Object o) {}
 }
 
-void main(C c) {
+void f(C c) {
   c.foo('hi');
 }
 ''');
@@ -1797,7 +1797,7 @@
   void call(int _) {}
 }
 
-main(C c) {
+void f(C c) {
   c(0);
 }
 ''');
@@ -1874,7 +1874,7 @@
 
   test_noReceiver_parameter() async {
     await assertNoErrorsInCode(r'''
-main(void Function(int) foo) {
+void f(void Function(int) foo) {
   foo(0);
 }
 ''');
@@ -2332,7 +2332,7 @@
 
   test_hasReceiver_interfaceQ_Function_call_checked() async {
     await assertNoErrorsInCode(r'''
-void main(Function? foo) {
+void f(Function? foo) {
   foo?.call();
 }
 ''');
@@ -2348,11 +2348,11 @@
 
   test_hasReceiver_interfaceQ_Function_call_unchecked() async {
     await assertErrorsInCode(r'''
-void main(Function? foo) {
+void f(Function? foo) {
   foo.call();
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 29, 3),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 26, 3),
     ]);
 
     assertMethodInvocation2(
@@ -2399,11 +2399,11 @@
   void foo() {}
 }
 
-main(A? a) {
+void f(A? a) {
   a.foo();
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 44, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 46, 1),
     ]);
 
     assertMethodInvocation2(
@@ -2425,11 +2425,11 @@
   void foo() {}
 }
 
-main(A? a) {
+void f(A? a) {
   a.foo();
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 82, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 84, 1),
     ]);
 
     assertMethodInvocation2(
@@ -2451,7 +2451,7 @@
   void foo() {}
 }
 
-main(A? a) {
+void f(A? a) {
   a.foo();
 }
 ''');
@@ -2471,7 +2471,7 @@
   T foo() => throw 0;
 }
 
-main(int? a) {
+void f(int? a) {
   a.foo();
 }
 ''');
@@ -2492,11 +2492,11 @@
     await assertErrorsInCode(r'''
 class A {}
 
-main(A? a) {
+void f(A? a) {
   a.foo();
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 27, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 29, 1),
     ]);
 
     assertMethodInvocation2(
@@ -2516,11 +2516,11 @@
   void foo() {}
 }
 
-main(A? a) {
+void f(A? a) {
   a.foo();
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 65, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 67, 1),
     ]);
 
     assertMethodInvocation2(
@@ -2540,7 +2540,7 @@
   void foo() {}
 }
 
-main(A? a) {
+void f(A? a) {
   a.foo();
 }
 ''');
@@ -2579,7 +2579,7 @@
   int bar() => 0;
 }
 
-main(A? a) {
+void f(A? a) {
   a?..foo()..bar();
 }
 ''');
@@ -2610,7 +2610,7 @@
   int bar() => 0;
 }
 
-main(A? a) {
+void f(A? a) {
   a?..foo..bar();
 }
 ''');
diff --git a/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart b/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
index bbedc1c..c705570 100644
--- a/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/non_nullable_test.dart
@@ -164,13 +164,13 @@
 
   test_local_typeParameter() async {
     await assertErrorsInCode('''
-main<T>(T a) {
+void f<T>(T a) {
   T x = a;
   T? y;
 }
 ''', [
-      error(HintCode.UNUSED_LOCAL_VARIABLE, 19, 1),
-      error(HintCode.UNUSED_LOCAL_VARIABLE, 31, 1),
+      error(HintCode.UNUSED_LOCAL_VARIABLE, 21, 1),
+      error(HintCode.UNUSED_LOCAL_VARIABLE, 33, 1),
     ]);
 
     assertType(findNode.typeName('T x'), 'T');
@@ -290,7 +290,7 @@
 
   test_parameter_genericFunctionType() async {
     await assertNoErrorsInCode('''
-main(int? Function(bool, String?)? a) {
+void f(int? Function(bool, String?)? a) {
 }
 ''');
 
@@ -302,8 +302,8 @@
 
   test_parameter_getterNullAwareAccess_interfaceType() async {
     await assertNoErrorsInCode(r'''
-main(int? x) {
-  return x?.isEven;
+void f(int? x) {
+  x?.isEven;
 }
 ''');
 
@@ -312,7 +312,7 @@
 
   test_parameter_interfaceType() async {
     await assertNoErrorsInCode('''
-main(int? a, int b) {
+void f(int? a, int b) {
 }
 ''');
 
@@ -338,8 +338,8 @@
   bool x() => true;
 }
 
-main(C? c) {
-  return c?.x();
+void f(C? c) {
+  c?.x();
 }
 ''');
 
@@ -348,7 +348,7 @@
 
   test_parameter_nullCoalesceAssign_nullableInt_int() async {
     await assertNoErrorsInCode(r'''
-main(int? x, int y) {
+void f(int? x, int y) {
   x ??= y;
 }
 ''');
@@ -357,7 +357,7 @@
 
   test_parameter_nullCoalesceAssign_nullableInt_nullableInt() async {
     await assertNoErrorsInCode(r'''
-main(int? x) {
+void f(int? x) {
   x ??= x;
 }
 ''');
@@ -366,7 +366,7 @@
 
   test_parameter_typeParameter() async {
     await assertNoErrorsInCode('''
-main<T>(T a, T? b) {
+void f<T>(T a, T? b) {
 }
 ''');
 
@@ -409,7 +409,7 @@
     await assertNoErrorsInCode('''
 typedef F<T> = int Function(T)?;
 
-main(F<int> a, F<double>? b) {}
+void f(F<int> a, F<double>? b) {}
 ''');
 
     assertType(findNode.typeName('F<int>'), 'int Function(int)?');
diff --git a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
index 9f951dc..2d0516f 100644
--- a/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/property_access_test.dart
@@ -545,7 +545,7 @@
   int get bar => 0;
 }
 
-main(A? a) {
+void f(A? a) {
   a?..foo..bar;
 }
 ''');
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/conditional_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/conditional_expression_test.dart
index ac8f412..d52a86d 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/conditional_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/conditional_expression_test.dart
@@ -43,8 +43,8 @@
 
   test_type() async {
     await assertNoErrorsInCode('''
-main(bool b) {
-  return b ? 42 : null;
+void f(bool b) {
+  b ? 42 : null;
 }
 ''');
     assertType(findNode.conditionalExpression('b ?'), 'int?');
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
index d9581ac..43c92f8 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/extension_methods_test.dart
@@ -94,7 +94,7 @@
   Map<T, U> foo<U>(U value) => <T, U>{};
 }
 
-main(String a) {
+void f(String a) {
   a.foo(0);
 }
 ''');
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
index 53cb664..6e1258e 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/list_literal_test.dart
@@ -273,7 +273,7 @@
     await assertNoErrorsInCode(r'''
 mixin L on List<int> {}
 
-main(L l1) {
+void f(L l1) {
   // ignore:unused_local_variable
   var l2 = [...l1];
 }
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
index 594ad86..eb7d745 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/map_literal_test.dart
@@ -292,7 +292,7 @@
     await assertNoErrorsInCode(r'''
 mixin M on Map<String, int> {}
 
-main(M m1) {
+void f(M m1) {
   // ignore:unused_local_variable
   var m2 = {...m1};
 }
diff --git a/pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart b/pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart
index eacdbcd..d62e2fa 100644
--- a/pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/argument_type_not_assignable_test.dart
@@ -448,15 +448,15 @@
   bool operator==(covariant A other) => false;
 }
 
-main(A a, A? aq) {
+void f(A a, A? aq) {
   a == 0;
   aq == 1;
   aq == aq;
   aq == null;
 }
 ''', [
-      error(CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 86, 1),
-      error(CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 97, 1),
+      error(CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 88, 1),
+      error(CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, 99, 1),
     ]);
   }
 
diff --git a/pkg/analyzer/test/src/diagnostics/dead_code_test.dart b/pkg/analyzer/test/src/diagnostics/dead_code_test.dart
index b261479..effa025 100644
--- a/pkg/analyzer/test/src/diagnostics/dead_code_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/dead_code_test.dart
@@ -404,7 +404,7 @@
 
   test_flowEnd_ifStatement() async {
     await assertErrorsInCode(r'''
-main(bool a) {
+void f(bool a) {
   if (a) {
     return;
     1;
@@ -412,7 +412,7 @@
   2;
 }
 ''', [
-      error(HintCode.DEAD_CODE, 42, 2),
+      error(HintCode.DEAD_CODE, 44, 2),
     ]);
   }
 
diff --git a/pkg/analyzer/test/src/diagnostics/main_first_positional_parameter_type_test.dart b/pkg/analyzer/test/src/diagnostics/main_first_positional_parameter_type_test.dart
new file mode 100644
index 0000000..43b7fa9
--- /dev/null
+++ b/pkg/analyzer/test/src/diagnostics/main_first_positional_parameter_type_test.dart
@@ -0,0 +1,95 @@
+// Copyright (c) 2020, 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 file.
+
+import 'package:analyzer/src/error/codes.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../dart/resolution/context_collection_resolution.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(MainFirstPositionalParameterTest);
+    defineReflectiveTests(MainFirstPositionalParameterWithNullSafetyTest);
+  });
+}
+
+@reflectiveTest
+class MainFirstPositionalParameterTest extends PubPackageResolutionTest
+    with MainFirstPositionalParameterTestCases {}
+
+mixin MainFirstPositionalParameterTestCases on PubPackageResolutionTest {
+  test_positionalOptional_listOfInt() async {
+    await resolveTestCode('''
+void main([List<int> args = const []]) {}
+''');
+    assertErrorsInResult(expectedErrorsByNullability(nullable: [
+      error(CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE, 11, 9),
+    ], legacy: []));
+  }
+
+  test_positionalRequired_dynamic() async {
+    await assertNoErrorsInCode('''
+void main(dynamic args) {}
+''');
+  }
+
+  test_positionalRequired_functionTypedFormal() async {
+    await resolveTestCode('''
+void main(void args()) {}
+''');
+    assertErrorsInResult(expectedErrorsByNullability(nullable: [
+      error(CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE, 10, 11),
+    ], legacy: []));
+  }
+
+  test_positionalRequired_iterableOfString() async {
+    await assertNoErrorsInCode('''
+void main(Iterable<String> args) {}
+''');
+  }
+
+  test_positionalRequired_listOfInt() async {
+    await resolveTestCode('''
+void main(List<int> args) {}
+''');
+    assertErrorsInResult(expectedErrorsByNullability(nullable: [
+      error(CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE, 10, 9),
+    ], legacy: []));
+  }
+
+  test_positionalRequired_listOfString() async {
+    await assertNoErrorsInCode('''
+void main(List<String> args) {}
+''');
+  }
+
+  test_positionalRequired_object() async {
+    await assertNoErrorsInCode('''
+void main(Object args) {}
+''');
+  }
+}
+
+@reflectiveTest
+class MainFirstPositionalParameterWithNullSafetyTest
+    extends PubPackageResolutionTest
+    with WithNullSafetyMixin, MainFirstPositionalParameterTestCases {
+  test_positionalRequired_listOfStringQuestion() async {
+    await assertNoErrorsInCode('''
+void main(List<String?> args) {}
+''');
+  }
+
+  test_positionalRequired_listQuestionOfString() async {
+    await assertNoErrorsInCode('''
+void main(List<String>? args) {}
+''');
+  }
+
+  test_positionalRequired_objectQuestion() async {
+    await assertNoErrorsInCode('''
+void main(Object? args) {}
+''');
+  }
+}
diff --git a/pkg/analyzer/test/src/diagnostics/main_has_too_many_required_positional_parameters_test.dart b/pkg/analyzer/test/src/diagnostics/main_has_too_many_required_positional_parameters_test.dart
index f965d4c..6457de5 100644
--- a/pkg/analyzer/test/src/diagnostics/main_has_too_many_required_positional_parameters_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/main_has_too_many_required_positional_parameters_test.dart
@@ -32,7 +32,7 @@
 
   test_positionalOptional_1() async {
     await resolveTestCode('''
-void main([int a = 0]) {}
+void f([int a = 0]) {}
 ''');
     assertNoErrorsInResult();
   }
diff --git a/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart b/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
index 16a01ee..3154db5 100644
--- a/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
@@ -138,7 +138,7 @@
 
   test_binaryExpression_logicalAnd_left() async {
     await assertNoErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   ((v = 0) >= 0) && c;
   v;
@@ -148,19 +148,19 @@
 
   test_binaryExpression_logicalAnd_right() async {
     await assertErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   c && ((v = 0) >= 0);
   v;
 }
 ''', [
-      _notAssignedError(49, 1),
+      _notAssignedError(51, 1),
     ]);
   }
 
   test_binaryExpression_logicalOr_left() async {
     await assertNoErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   ((v = 0) >= 0) || c;
   v;
@@ -170,13 +170,13 @@
 
   test_binaryExpression_logicalOr_right() async {
     await assertErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   c || ((v = 0) >= 0);
   v;
 }
 ''', [
-      _notAssignedError(49, 1),
+      _notAssignedError(51, 1),
     ]);
   }
 
@@ -834,7 +834,7 @@
 
   test_if_then() async {
     await assertErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   if (c) {
     v = 0;
@@ -842,13 +842,13 @@
   v;
 }
 ''', [
-      _notAssignedError(52, 1),
+      _notAssignedError(54, 1),
     ]);
   }
 
   test_if_thenElse_all() async {
     await assertNoErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   if (c) {
     v = 0;
@@ -864,7 +864,7 @@
 
   test_if_thenElse_else() async {
     await assertErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   if (c) {
     // not assigned
@@ -874,13 +874,13 @@
   v;
 }
 ''', [
-      _notAssignedError(83, 1),
+      _notAssignedError(85, 1),
     ]);
   }
 
   test_if_thenElse_then() async {
     await assertErrorsInCode(r'''
-main(bool c) {
+void f(bool c) {
   int v;
   if (c) {
     v = 0;
@@ -890,7 +890,7 @@
   v;
 }
 ''', [
-      _notAssignedError(83, 1),
+      _notAssignedError(85, 1),
     ]);
   }
 
diff --git a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
index 36645a4..3574235 100644
--- a/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/receiver_of_type_never_test.dart
@@ -19,12 +19,12 @@
     with WithNullSafetyMixin {
   test_binaryExpression_never_eqEq() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x == 1 + 2;
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
-      error(HintCode.DEAD_CODE, 28, 6),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
+      error(HintCode.DEAD_CODE, 25, 6),
     ]);
 
     assertBinaryExpression(
@@ -38,12 +38,12 @@
 
   test_binaryExpression_never_plus() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x + (1 + 2);
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
-      error(HintCode.DEAD_CODE, 27, 8),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
+      error(HintCode.DEAD_CODE, 24, 8),
     ]);
 
     assertBinaryExpression(
@@ -57,7 +57,7 @@
 
   test_binaryExpression_neverQ_eqEq() async {
     await assertNoErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x == 1 + 2;
 }
 ''');
@@ -73,11 +73,11 @@
 
   test_binaryExpression_neverQ_plus() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x + (1 + 2);
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
 
     assertBinaryExpression(
@@ -91,7 +91,7 @@
 
   test_conditionalExpression_falseBranch() async {
     await assertNoErrorsInCode(r'''
-void main(bool c, Never x) {
+void f(bool c, Never x) {
   c ? 0 : x;
 }
 ''');
@@ -99,7 +99,7 @@
 
   test_conditionalExpression_trueBranch() async {
     await assertNoErrorsInCode(r'''
-void main(bool c, Never x) {
+void f(bool c, Never x) {
   c ? x : 0;
 }
 ''');
@@ -107,32 +107,32 @@
 
   test_functionExpressionInvocation_never() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x();
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
     ]);
   }
 
   test_functionExpressionInvocation_neverQ() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x();
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
   }
 
   test_indexExpression_never_read() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x[0];
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
-      error(HintCode.DEAD_CODE, 25, 3),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
+      error(HintCode.DEAD_CODE, 22, 3),
     ]);
 
     assertIndexExpression(
@@ -145,12 +145,12 @@
 
   test_indexExpression_never_readWrite() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x[0] += 1 + 2;
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
-      error(HintCode.DEAD_CODE, 25, 12),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
+      error(HintCode.DEAD_CODE, 22, 12),
     ]);
 
     assertIndexExpression(
@@ -165,12 +165,12 @@
 
   test_indexExpression_never_write() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x[0] = 1 + 2;
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
-      error(HintCode.DEAD_CODE, 25, 11),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
+      error(HintCode.DEAD_CODE, 22, 11),
     ]);
 
     assertIndexExpression(
@@ -185,11 +185,11 @@
 
   test_indexExpression_neverQ_read() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x[0];
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
 
     assertIndexExpression(
@@ -202,11 +202,11 @@
 
   test_indexExpression_neverQ_readWrite() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x[0] += 1 + 2;
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
 
     assertIndexExpression(
@@ -221,11 +221,11 @@
 
   test_indexExpression_neverQ_write() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x[0] = 1 + 2;
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
 
     assertIndexExpression(
@@ -240,20 +240,20 @@
 
   test_invocationArgument() async {
     await assertNoErrorsInCode(r'''
-void main(f, Never x) {
-  f(x);
+void f(g, Never x) {
+  g(x);
 }
 ''');
   }
 
   test_methodInvocation_never() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x.foo(1 + 2);
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
-      error(HintCode.DEAD_CODE, 28, 8),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
+      error(HintCode.DEAD_CODE, 25, 8),
     ]);
 
     assertMethodInvocation(
@@ -269,12 +269,12 @@
 
   test_methodInvocation_never_toString() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x.toString(1 + 2);
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
-      error(HintCode.DEAD_CODE, 33, 8),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
+      error(HintCode.DEAD_CODE, 30, 8),
     ]);
 
     assertMethodInvocation(
@@ -290,11 +290,11 @@
 
   test_methodInvocation_neverQ_toString() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x.toString(1 + 2);
 }
 ''', [
-      error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 34, 7),
+      error(CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS, 31, 7),
     ]);
 
     assertMethodInvocation(
@@ -310,11 +310,11 @@
 
   test_postfixExpression_never_plusPlus() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x++;
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 23, 1),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 20, 1),
     ]);
 
     assertPostfixExpression(
@@ -330,11 +330,11 @@
 
   test_postfixExpression_neverQ_plusPlus() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x++;
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
 
     assertPostfixExpression(
@@ -351,11 +351,11 @@
   test_prefixExpression_never_plusPlus() async {
     // Reports 'undefined operator'
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   ++x;
 }
 ''', [
-      error(HintCode.RECEIVER_OF_TYPE_NEVER, 25, 1),
+      error(HintCode.RECEIVER_OF_TYPE_NEVER, 22, 1),
     ]);
 
     assertPrefixExpression(
@@ -371,11 +371,11 @@
 
   test_prefixExpression_neverQ_plusPlus() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   ++x;
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 26, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 23, 1),
     ]);
 
     assertPrefixExpression(
@@ -391,7 +391,7 @@
 
   test_propertyAccess_never_read() async {
     await assertNoErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x.foo;
 }
 ''');
@@ -406,7 +406,7 @@
 
   test_propertyAccess_never_read_hashCode() async {
     await assertNoErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x.hashCode;
 }
 ''');
@@ -421,11 +421,11 @@
 
   test_propertyAccess_never_readWrite() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x.foo += 0;
 }
 ''', [
-      error(HintCode.DEAD_CODE, 32, 2),
+      error(HintCode.DEAD_CODE, 29, 2),
     ]);
 
     assertSimpleIdentifier(
@@ -448,7 +448,7 @@
 
   test_propertyAccess_never_tearOff_toString() async {
     await assertNoErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x.toString;
 }
 ''');
@@ -463,11 +463,11 @@
 
   test_propertyAccess_never_write() async {
     await assertErrorsInCode(r'''
-void main(Never x) {
+void f(Never x) {
   x.foo = 0;
 }
 ''', [
-      error(HintCode.DEAD_CODE, 31, 2),
+      error(HintCode.DEAD_CODE, 28, 2),
     ]);
 
     assertSimpleIdentifier(
@@ -490,11 +490,11 @@
 
   test_propertyAccess_neverQ_read() async {
     await assertErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x.foo;
 }
 ''', [
-      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 24, 1),
+      error(CompileTimeErrorCode.UNCHECKED_USE_OF_NULLABLE_VALUE, 21, 1),
     ]);
 
     assertSimpleIdentifier(
@@ -507,7 +507,7 @@
 
   test_propertyAccess_neverQ_read_hashCode() async {
     await assertNoErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x.hashCode;
 }
 ''');
@@ -522,7 +522,7 @@
 
   test_propertyAccess_neverQ_tearOff_toString() async {
     await assertNoErrorsInCode(r'''
-void main(Never? x) {
+void f(Never? x) {
   x.toString;
 }
 ''');
@@ -540,7 +540,7 @@
 class InvalidUseOfNeverTest_Legacy extends PubPackageResolutionTest {
   test_binaryExpression_eqEq() async {
     await assertNoErrorsInCode(r'''
-void main() {
+void f() {
   (throw '') == 1 + 2;
 }
 ''');
@@ -559,7 +559,7 @@
 
   test_binaryExpression_plus() async {
     await assertNoErrorsInCode(r'''
-void main() {
+void f() {
   (throw '') + (1 + 2);
 }
 ''');
@@ -575,7 +575,7 @@
 
   test_methodInvocation_toString() async {
     await assertNoErrorsInCode(r'''
-void main() {
+void f() {
   (throw '').toString();
 }
 ''');
@@ -590,7 +590,7 @@
 
   test_propertyAccess_toString() async {
     await assertNoErrorsInCode(r'''
-void main() {
+void f() {
   (throw '').toString;
 }
 ''');
@@ -608,7 +608,7 @@
 
   test_throw_getter_hashCode() async {
     await assertNoErrorsInCode(r'''
-void main() {
+void f() {
   (throw '').hashCode;
 }
 ''');
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index 086f256..6d57dca 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -344,6 +344,8 @@
     as late_final_local_already_assigned;
 import 'list_element_type_not_assignable_test.dart'
     as list_element_type_not_assignable;
+import 'main_first_positional_parameter_type_test.dart'
+    as main_first_positional_parameter_type;
 import 'main_has_required_named_parameters_test.dart'
     as main_has_required_named_parameters;
 import 'main_has_too_many_required_positional_parameters_test.dart'
@@ -877,6 +879,7 @@
     late_final_field_with_const_constructor.main();
     late_final_local_already_assigned.main();
     list_element_type_not_assignable.main();
+    main_first_positional_parameter_type.main();
     main_has_required_named_parameters.main();
     main_has_too_many_required_positional_parameters.main();
     main_is_not_function.main();
diff --git a/pkg/analyzer/test/src/diagnostics/undefined_identifier_test.dart b/pkg/analyzer/test/src/diagnostics/undefined_identifier_test.dart
index ef3ec65..6195779 100644
--- a/pkg/analyzer/test/src/diagnostics/undefined_identifier_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/undefined_identifier_test.dart
@@ -221,13 +221,13 @@
   test_synthetic_whenMethodName_defined() async {
     await assertErrorsInCode(r'''
 print(x) {}
-main(int p) {
+void f(int p) {
   p.();
 }
 ''', [
-      error(ParserErrorCode.MISSING_IDENTIFIER, 30, 1),
-      error(CompileTimeErrorCode.UNDEFINED_GETTER, 30, 1),
-      error(ParserErrorCode.MISSING_IDENTIFIER, 31, 1),
+      error(ParserErrorCode.MISSING_IDENTIFIER, 32, 1),
+      error(CompileTimeErrorCode.UNDEFINED_GETTER, 32, 1),
+      error(ParserErrorCode.MISSING_IDENTIFIER, 33, 1),
     ]);
   }
 }
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 e380a35..f06a7d0 100644
--- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart
@@ -1719,6 +1719,7 @@
       LogicalExpression node, DartType typeContext) {
     InterfaceType boolType =
         inferrer.coreTypes.boolRawType(inferrer.library.nonNullable);
+    inferrer.flowAnalysis.logicalBinaryOp_begin();
     ExpressionInferenceResult leftResult = inferrer.inferExpression(
         node.left, boolType, !inferrer.isTopLevel,
         isVoidAllowed: false);
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index 3f22a7d..44f256d 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -447,6 +447,7 @@
     } else if (operatorType == TokenType.AMPERSAND_AMPERSAND ||
         operatorType == TokenType.BAR_BAR) {
       bool isAnd = operatorType == TokenType.AMPERSAND_AMPERSAND;
+      _flowAnalysis.logicalBinaryOp_begin();
       _checkExpressionNotNull(leftOperand);
       _flowAnalysis.logicalBinaryOp_rightBegin(node.leftOperand, isAnd: isAnd);
       _postDominatedLocals.doScoped(
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index a42626d..88e037b 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -51,10 +51,6 @@
       }
     }
     include_dirs = [ ".." ]
-    set_sources_assignment_filter([
-                                    "*_test.cc",
-                                    "*_test.h",
-                                  ])
     sources = builtin_impl_sources
   }
 }
@@ -325,19 +321,6 @@
 
     deps = [ "//third_party/zlib" ]
 
-    custom_sources_filter = [
-      "*_test.cc",
-      "*_test.h",
-    ]
-    if (!is_mac && !is_ios) {
-      # Dart tree uses *_macos.* instead of *_mac.*
-      custom_sources_filter += [
-        "*_macos.h",
-        "*_macos.cc",
-      ]
-    }
-    set_sources_assignment_filter(custom_sources_filter)
-
     defines = [ "DART_IO_SECURE_SOCKET_DISABLED" ]
 
     sources = io_impl_sources + cli_impl_sources
@@ -414,19 +397,6 @@
                  "..:dart_os_config",
                ] + extra_configs
     public_configs = [ "..:dart_public_config" ]
-    custom_sources_filter = [
-      "*_test.cc",
-      "*_test.h",
-      "builtin_gen_snapshot.cc",
-    ]
-    if (!is_mac && !is_ios) {
-      # Dart tree uses *_macos.* instead of *_mac.*
-      custom_sources_filter += [
-        "*_macos.h",
-        "*_macos.cc",
-      ]
-    }
-    set_sources_assignment_filter(custom_sources_filter)
 
     defines = []
     deps = [ "//third_party/zlib" ] + extra_deps
@@ -1033,10 +1003,7 @@
 
 shared_library("test_extension") {
   deps = [ ":dart" ]
-  sources = [
-    "test_extension.c",
-    "test_extension_dllmain_win.cc",
-  ]
+  sources = [ "test_extension.c" ]
   include_dirs = [ ".." ]
   defines = [
     # The only effect of DART_SHARED_LIB is to export the Dart API.
@@ -1046,6 +1013,7 @@
     cflags = [ "-fPIC" ]
   }
   if (is_win) {
+    sources += [ "test_extension_dllmain_win.cc" ]
     libs = [ "dart.lib" ]
     abs_root_out_dir = rebase_path(root_out_dir)
     ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
@@ -1054,10 +1022,7 @@
 
 shared_library("entrypoints_verification_test_extension") {
   deps = [ ":dart" ]
-  sources = [
-    "entrypoints_verification_test_extension.cc",
-    "entrypoints_verification_test_extension_dllmain_win.cc",
-  ]
+  sources = [ "entrypoints_verification_test_extension.cc" ]
   include_dirs = [ ".." ]
   defines = [
     # The only effect of DART_SHARED_LIB is to export the Dart API.
@@ -1067,6 +1032,7 @@
     cflags = [ "-fPIC" ]
   }
   if (is_win) {
+    sources += [ "entrypoints_verification_test_extension_dllmain_win.cc" ]
     libs = [ "dart.lib" ]
     abs_root_out_dir = rebase_path(root_out_dir)
     ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
@@ -1129,10 +1095,7 @@
 
 shared_library("sample_extension") {
   deps = [ ":dart" ]
-  sources = [
-    "../../samples/sample_extension/sample_extension.cc",
-    "../../samples/sample_extension/sample_extension_dllmain_win.cc",
-  ]
+  sources = [ "../../samples/sample_extension/sample_extension.cc" ]
   include_dirs = [ ".." ]
   defines = [
     # The only effect of DART_SHARED_LIB is to export the Dart API.
@@ -1142,6 +1105,8 @@
     cflags = [ "-fPIC" ]
   }
   if (is_win) {
+    sources +=
+        [ "../../samples/sample_extension/sample_extension_dllmain_win.cc" ]
     libs = [ "dart.lib" ]
     abs_root_out_dir = rebase_path(root_out_dir)
     ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 187cf92..eba26b5 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -446,7 +446,8 @@
   // First create a snapshot.
   result = Dart_CreateSnapshot(&vm_snapshot_data_buffer, &vm_snapshot_data_size,
                                &isolate_snapshot_data_buffer,
-                               &isolate_snapshot_data_size);
+                               &isolate_snapshot_data_size,
+                               /*is_core=*/true);
   CHECK_RESULT(result);
 
   // Now write the vm isolate and isolate snapshots out to the
@@ -539,7 +540,7 @@
   intptr_t isolate_snapshot_data_size = 0;
 
   result = Dart_CreateSnapshot(NULL, NULL, &isolate_snapshot_data_buffer,
-                               &isolate_snapshot_data_size);
+                               &isolate_snapshot_data_size, /*is_core=*/false);
   CHECK_RESULT(result);
 
   WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
diff --git a/runtime/bin/snapshot_utils.cc b/runtime/bin/snapshot_utils.cc
index d31be2d..4a19ba2 100644
--- a/runtime/bin/snapshot_utils.cc
+++ b/runtime/bin/snapshot_utils.cc
@@ -489,8 +489,8 @@
   uint8_t* isolate_buffer = NULL;
   intptr_t isolate_size = 0;
 
-  Dart_Handle result =
-      Dart_CreateSnapshot(NULL, NULL, &isolate_buffer, &isolate_size);
+  Dart_Handle result = Dart_CreateSnapshot(NULL, NULL, &isolate_buffer,
+                                           &isolate_size, /*is_core=*/false);
   if (Dart_IsError(result)) {
     ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
   }
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 5268f5d..5d7d117 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -1242,6 +1242,8 @@
  *   snapshot. This buffer is scope allocated and is only valid
  *   until the next call to Dart_ExitScope.
  * \param size Returns the size of the buffer.
+ * \param is_core Create a snapshot containing core libraries.
+ *                Such snapshot should be agnostic to null safety mode.
  *
  * \return A valid handle if no error occurs during the operation.
  */
@@ -1249,7 +1251,8 @@
 Dart_CreateSnapshot(uint8_t** vm_snapshot_data_buffer,
                     intptr_t* vm_snapshot_data_size,
                     uint8_t** isolate_snapshot_data_buffer,
-                    intptr_t* isolate_snapshot_data_size);
+                    intptr_t* isolate_snapshot_data_size,
+                    bool is_core);
 
 /**
  * Returns whether the buffer contains a kernel file.
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index c7a33f1..8acf95e 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -109,10 +109,6 @@
     }
   }
   public_configs = [ ":libdart_vm_config" ]
-  set_sources_assignment_filter([
-                                  "*_test.cc",
-                                  "*_test.h",
-                                ])
   sources = vm_sources + rebase_path(compiler_api_sources, ".", "./compiler/") +
             rebase_path(disassembler_sources, ".", "./compiler/") +
             rebase_path(heap_sources, ".", "./heap/")
@@ -122,10 +118,6 @@
 library_for_all_configs_with_compiler("libdart_compiler") {
   target_type = "source_set"
   public_configs = [ ":libdart_vm_config" ]
-  set_sources_assignment_filter([
-                                  "*_test.cc",
-                                  "*_test.h",
-                                ])
   sources = rebase_path(compiler_sources, ".", "./compiler/")
   include_dirs = [ ".." ]
   if (is_fuchsia) {
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index 2215c7d..f7b1266 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -528,12 +528,12 @@
   MallocWriteStream vm_snapshot_data(FullSnapshotWriter::kInitialSize);
   MallocWriteStream isolate_snapshot_data(FullSnapshotWriter::kInitialSize);
   FullSnapshotWriter writer(
-      Snapshot::kFull, &vm_snapshot_data, &isolate_snapshot_data,
+      Snapshot::kFullCore, &vm_snapshot_data, &isolate_snapshot_data,
       /*vm_image_writer=*/nullptr, /*iso_image_writer=*/nullptr);
   writer.WriteFullSnapshot();
   const Snapshot* snapshot =
       Snapshot::SetupFromBuffer(isolate_snapshot_data.buffer());
-  ASSERT(snapshot->kind() == Snapshot::kFull);
+  ASSERT(snapshot->kind() == Snapshot::kFullCore);
   benchmark->set_score(snapshot->length());
 }
 
@@ -566,12 +566,12 @@
   MallocWriteStream vm_snapshot_data(FullSnapshotWriter::kInitialSize);
   MallocWriteStream isolate_snapshot_data(FullSnapshotWriter::kInitialSize);
   FullSnapshotWriter writer(
-      Snapshot::kFull, &vm_snapshot_data, &isolate_snapshot_data,
+      Snapshot::kFullCore, &vm_snapshot_data, &isolate_snapshot_data,
       /*vm_image_writer=*/nullptr, /*iso_image_writer=*/nullptr);
   writer.WriteFullSnapshot();
   const Snapshot* snapshot =
       Snapshot::SetupFromBuffer(isolate_snapshot_data.buffer());
-  ASSERT(snapshot->kind() == Snapshot::kFull);
+  ASSERT(snapshot->kind() == Snapshot::kFullCore);
   benchmark->set_score(snapshot->length());
 }
 
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 7fb5eca..27d263a 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -245,7 +245,8 @@
       s->UnexpectedObject(cls, "Class with illegal cid");
     }
     s->WriteCid(class_id);
-    if (s->kind() == Snapshot::kFull && RequireLegacyErasureOfConstants(cls)) {
+    if (s->kind() == Snapshot::kFullCore &&
+        RequireLegacyErasureOfConstants(cls)) {
       s->UnexpectedObject(cls, "Class with non mode agnostic constants");
     }
     if (s->kind() != Snapshot::kFullAOT) {
@@ -596,7 +597,7 @@
     objects_.Add(func);
 
     PushFromTo(func);
-    if (kind == Snapshot::kFull) {
+    if ((kind == Snapshot::kFull) || (kind == Snapshot::kFullCore)) {
       NOT_IN_PRECOMPILED(s->Push(func->ptr()->bytecode_));
     } else if (kind == Snapshot::kFullAOT) {
       s->Push(func->ptr()->code_);
@@ -625,7 +626,7 @@
       FunctionPtr func = objects_[i];
       AutoTraceObjectName(func, MakeDisambiguatedFunctionName(s, func));
       WriteFromTo(func);
-      if (kind == Snapshot::kFull) {
+      if ((kind == Snapshot::kFull) || (kind == Snapshot::kFullCore)) {
         NOT_IN_PRECOMPILED(WriteField(func, bytecode_));
       } else if (kind == Snapshot::kFullAOT) {
         WriteField(func, code_);
@@ -692,7 +693,7 @@
                                      Function::InstanceSize());
       ReadFromTo(func);
 
-      if (kind == Snapshot::kFull) {
+      if ((kind == Snapshot::kFull) || (kind == Snapshot::kFullCore)) {
         NOT_IN_PRECOMPILED(func->ptr()->bytecode_ =
                                static_cast<BytecodePtr>(d->ReadRef()));
       } else if (kind == Snapshot::kFullAOT) {
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index f271e57..dac8c18 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -782,12 +782,12 @@
   //   when generating the snapshot.
   ASSERT(FLAG_sound_null_safety == kNullSafetyOptionUnspecified);
 
-  // If snapshot is an appJIT/AOT snapshot we will figure out the mode by
+  // If snapshot is not a core snapshot we will figure out the mode by
   // sniffing the feature string in the snapshot.
   if (snapshot_data != nullptr) {
     // Read the snapshot and check for null safety option.
     const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_data);
-    if (Snapshot::IncludesCode(snapshot->kind())) {
+    if (!Snapshot::IsAgnosticToNullSafety(snapshot->kind())) {
       return SnapshotHeaderReader::NullSafetyFromSnapshot(snapshot);
     }
   }
@@ -1034,7 +1034,9 @@
 #else
 #error What architecture?
 #endif
+  }
 
+  if (!Snapshot::IsAgnosticToNullSafety(kind)) {
     if (isolate != NULL) {
       if (isolate->null_safety()) {
         buffer.AddString(" null-safety");
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 291f8f7..6fdb197 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1934,7 +1934,8 @@
 Dart_CreateSnapshot(uint8_t** vm_snapshot_data_buffer,
                     intptr_t* vm_snapshot_data_size,
                     uint8_t** isolate_snapshot_data_buffer,
-                    intptr_t* isolate_snapshot_data_size) {
+                    intptr_t* isolate_snapshot_data_size,
+                    bool is_core) {
 #if defined(DART_PRECOMPILED_RUNTIME)
   return Api::NewError("Cannot create snapshots on an AOT runtime.");
 #else
@@ -1966,8 +1967,10 @@
                                    FullSnapshotWriter::kInitialSize);
   ZoneWriteStream isolate_snapshot_data(Api::TopScope(T)->zone(),
                                         FullSnapshotWriter::kInitialSize);
+  const Snapshot::Kind snapshot_kind =
+      is_core ? Snapshot::kFullCore : Snapshot::kFull;
   FullSnapshotWriter writer(
-      Snapshot::kFull, &vm_snapshot_data, &isolate_snapshot_data,
+      snapshot_kind, &vm_snapshot_data, &isolate_snapshot_data,
       nullptr /* vm_image_writer */, nullptr /* isolate_image_writer */);
   writer.WriteFullSnapshot();
   if (vm_snapshot_data_buffer != nullptr) {
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 05f290c..fa649a5 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -479,6 +479,7 @@
   ObjectPtr* to_snapshot(Snapshot::Kind kind) {
     switch (kind) {
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
         return reinterpret_cast<ObjectPtr*>(&global_object_pool_);
       case Snapshot::kFullJIT:
       case Snapshot::kFullAOT:
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 9dd7f8f..5f03f71 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -762,6 +762,7 @@
       case Snapshot::kFullAOT:
         return reinterpret_cast<ObjectPtr*>(&allocation_stub_);
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
         return reinterpret_cast<ObjectPtr*>(&direct_subclasses_);
       case Snapshot::kFullJIT:
         return reinterpret_cast<ObjectPtr*>(&dependent_code_);
@@ -836,6 +837,7 @@
       case Snapshot::kFullAOT:
         return reinterpret_cast<ObjectPtr*>(&script_);
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
       case Snapshot::kFullJIT:
         return reinterpret_cast<ObjectPtr*>(&library_kernel_data_);
       case Snapshot::kMessage:
@@ -1026,6 +1028,7 @@
     switch (kind) {
       case Snapshot::kFullAOT:
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
       case Snapshot::kFullJIT:
         return reinterpret_cast<ObjectPtr*>(&data_);
       case Snapshot::kMessage:
@@ -1194,6 +1197,7 @@
   ObjectPtr* to_snapshot(Snapshot::Kind kind) {
     switch (kind) {
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
       case Snapshot::kFullJIT:
       case Snapshot::kFullAOT:
         return reinterpret_cast<ObjectPtr*>(&initializer_function_);
@@ -1270,6 +1274,7 @@
       case Snapshot::kFullAOT:
         return reinterpret_cast<ObjectPtr*>(&url_);
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
       case Snapshot::kFullJIT:
         return reinterpret_cast<ObjectPtr*>(&kernel_program_info_);
       case Snapshot::kMessage:
@@ -1343,6 +1348,7 @@
       case Snapshot::kFullAOT:
         return reinterpret_cast<ObjectPtr*>(&exports_);
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
       case Snapshot::kFullJIT:
         return reinterpret_cast<ObjectPtr*>(&kernel_data_);
       case Snapshot::kMessage:
@@ -2067,6 +2073,7 @@
       case Snapshot::kFullAOT:
         return reinterpret_cast<ObjectPtr*>(&entries_);
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
       case Snapshot::kFullJIT:
         return to();
       case Snapshot::kMessage:
@@ -2174,6 +2181,7 @@
       case Snapshot::kFullAOT:
         return reinterpret_cast<ObjectPtr*>(&imports_);
       case Snapshot::kFull:
+      case Snapshot::kFullCore:
       case Snapshot::kFullJIT:
         return reinterpret_cast<ObjectPtr*>(&importer_);
       case Snapshot::kMessage:
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 9403472..5c0d911 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -229,6 +229,8 @@
   switch (kind) {
     case kFull:
       return "full";
+    case kFullCore:
+      return "full-core";
     case kFullJIT:
       return "full-jit";
     case kFullAOT:
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index d685fb2..94aa3e7 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -91,11 +91,12 @@
 class Snapshot {
  public:
   enum Kind {
-    kFull,     // Full snapshot of core libraries or an application.
-    kFullJIT,  // Full + JIT code
-    kFullAOT,  // Full + AOT code
-    kMessage,  // A partial snapshot used only for isolate messaging.
-    kNone,     // gen_snapshot
+    kFull,      // Full snapshot of an application.
+    kFullCore,  // Full snapshot of core libraries. Agnostic to null safety.
+    kFullJIT,   // Full + JIT code
+    kFullAOT,   // Full + AOT code
+    kMessage,   // A partial snapshot used only for isolate messaging.
+    kNone,      // gen_snapshot
     kInvalid
   };
   static const char* KindToCString(Kind kind);
@@ -130,13 +131,15 @@
   void set_kind(Kind value) { return Write<int64_t>(kKindOffset, value); }
 
   static bool IsFull(Kind kind) {
-    return (kind == kFull) || (kind == kFullJIT) || (kind == kFullAOT);
+    return (kind == kFull) || (kind == kFullCore) || (kind == kFullJIT) ||
+           (kind == kFullAOT);
   }
+  static bool IsAgnosticToNullSafety(Kind kind) { return (kind == kFullCore); }
   static bool IncludesCode(Kind kind) {
     return (kind == kFullJIT) || (kind == kFullAOT);
   }
   static bool IncludesBytecode(Kind kind) {
-    return (kind == kFull) || (kind == kFullJIT);
+    return (kind == kFull) || (kind == kFullCore) || (kind == kFullJIT);
   }
 
   const uint8_t* Addr() const { return reinterpret_cast<const uint8_t*>(this); }
@@ -171,7 +174,8 @@
 inline static bool IsSnapshotCompatible(Snapshot::Kind vm_kind,
                                         Snapshot::Kind isolate_kind) {
   if (vm_kind == isolate_kind) return true;
-  if (vm_kind == Snapshot::kFull && isolate_kind == Snapshot::kFullJIT)
+  if (((vm_kind == Snapshot::kFull) || (vm_kind == Snapshot::kFullCore)) &&
+      isolate_kind == Snapshot::kFullJIT)
     return true;
   return Snapshot::IsFull(isolate_kind);
 }
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index 4ff7ccf..ed0383c 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -2073,7 +2073,8 @@
       // Write snapshot with object content.
       MallocWriteStream isolate_snapshot_data(FullSnapshotWriter::kInitialSize);
       FullSnapshotWriter writer(
-          Snapshot::kFull, /*vm_snapshot_data=*/nullptr, &isolate_snapshot_data,
+          Snapshot::kFullCore, /*vm_snapshot_data=*/nullptr,
+          &isolate_snapshot_data,
           /*vm_image_writer=*/nullptr, /*iso_image_writer=*/nullptr);
       writer.WriteFullSnapshot();
     }
diff --git a/third_party/tcmalloc/BUILD.gn b/third_party/tcmalloc/BUILD.gn
index a2a925a..7238772 100644
--- a/third_party/tcmalloc/BUILD.gn
+++ b/third_party/tcmalloc/BUILD.gn
@@ -119,22 +119,20 @@
     cflags += [ "-Wno-format" ]
   }
 
-  set_sources_assignment_filter([
-                                  # No debug allocator.
-                                  "gperftools/src/debugallocation.cc",
+  sources = tcmalloc_sources - [
+              # No debug allocator.
+              "gperftools/src/debugallocation.cc",
 
-                                  # Not needed when using emergency malloc.
-                                  "gperftools/src/fake_stacktrace_scope.cc",
+              # Not needed when using emergency malloc.
+              "gperftools/src/fake_stacktrace_scope.cc",
 
-                                  # Not using the cpuprofiler
-                                  "gperftools/src/base/thread_lister.c",
-                                  "gperftools/src/base/thread_lister.h",
-                                  "gperftools/src/profile-handler.cc",
-                                  "gperftools/src/profile-handler.h",
-                                  "gperftools/src/profiledata.cc",
-                                  "gperftools/src/profiledata.h",
-                                  "gperftools/src/profiler.cc",
-                                ])
-
-  sources = tcmalloc_sources
+              # Not using the cpuprofiler
+              "gperftools/src/base/thread_lister.c",
+              "gperftools/src/base/thread_lister.h",
+              "gperftools/src/profile-handler.cc",
+              "gperftools/src/profile-handler.h",
+              "gperftools/src/profiledata.cc",
+              "gperftools/src/profiledata.h",
+              "gperftools/src/profiler.cc",
+            ]
 }
diff --git a/tools/VERSION b/tools/VERSION
index b4ac9ab..3888401 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 11
 PATCH 0
-PRERELEASE 202
+PRERELEASE 203
 PRERELEASE_PATCH 0
\ No newline at end of file