Version 2.14.0-388.0.dev

Merge commit '3bec5e5ecd13e5696e8e503750fef65a60692824' into 'dev'
diff --git a/DEPS b/DEPS
index 8b2457d..288bd01 100644
--- a/DEPS
+++ b/DEPS
@@ -73,7 +73,7 @@
 
   # Revisions of /third_party/* dependencies.
   "args_rev": "bf4c8796881b62fd5d3f6d86ab43014f9651eb20",
-  "async_rev": "25a7e2ec39c03622b86918cb9ce3e7d00dd283d1",
+  "async_rev": "88cc6079037da08dcb31cf8dcd62173c2ddf1e89",
   "bazel_worker_rev": "0885637b037979afbf5bcd05fd748b309fd669c0",
   "benchmark_harness_rev": "c546dbd9f639f75cd2f75de8df2eb9f8ea15e8e7",
   "boolean_selector_rev": "665e6921ab246569420376f827bff4585dff0b14",
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index 1ab5812..ad30563 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -127,7 +127,7 @@
   static const ADD_NE_NULL_MULTI = FixKind('dart.fix.add.neNull.multi',
       DartFixKindPriority.IN_FILE, 'Add != null everywhere in file');
   static const ADD_NULL_CHECK = FixKind('dart.fix.add.nullCheck',
-      DartFixKindPriority.DEFAULT, 'Add a null check (!)');
+      DartFixKindPriority.DEFAULT - 1, 'Add a null check (!)',);
   static const ADD_OVERRIDE = FixKind('dart.fix.add.override',
       DartFixKindPriority.DEFAULT, "Add '@override' annotation");
   static const ADD_OVERRIDE_MULTI = FixKind(
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
index ed02e6a..2ea42d8 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
@@ -32,7 +32,10 @@
   TypeSystemImpl get _typeSystem => _resolver.typeSystem;
 
   void resolve(FunctionExpressionImpl node) {
-    var isFunctionDeclaration = node.parent is FunctionDeclaration;
+    var parent = node.parent;
+    // Note: `isFunctionDeclaration` must have an explicit type to work around
+    // https://github.com/dart-lang/language/issues/1785.
+    bool isFunctionDeclaration = parent is FunctionDeclaration;
     var body = node.body;
 
     if (_resolver.flowAnalysis!.flow != null && !isFunctionDeclaration) {
@@ -53,6 +56,11 @@
     }
 
     node.visitChildren(_resolver);
+    if (isFunctionDeclaration) {
+      // A side effect of visiting the children is that the parameters are now
+      // in scope, so we can visit the documentation comment now.
+      parent.documentationComment?.accept(_resolver);
+    }
     _resolve2(node);
 
     if (_resolver.flowAnalysis!.flow != null && !isFunctionDeclaration) {
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 4c75b2a..209b132 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -739,13 +739,6 @@
     }
   }
 
-  /// Visit the given [comment] if it is not `null`.
-  void safelyVisitComment(Comment? comment) {
-    if (comment != null) {
-      super.visitComment(comment);
-    }
-  }
-
   void setReadElement(Expression node, Element? element) {
     DartType readType = DynamicTypeImpl.instance;
     if (node is IndexExpression) {
@@ -1097,52 +1090,6 @@
   }
 
   @override
-  void visitComment(Comment node) {
-    var parent = node.parent;
-    if (parent is FunctionDeclaration ||
-        parent is FunctionTypeAlias ||
-        parent is ConstructorDeclaration) {
-      return;
-    }
-
-    // TODO(scheglov) Change corresponding visiting places to visit comments
-    // with name scopes set for correct comments resolution.
-    if (parent is GenericTypeAlias) {
-      var element = parent.declaredElement as TypeAliasElement;
-      var outerScope = nameScope;
-      try {
-        nameScope = TypeParameterScope(nameScope, element.typeParameters);
-
-        var aliasedElement = element.aliasedElement;
-        if (aliasedElement is GenericFunctionTypeElement) {
-          nameScope = FormalParameterScope(
-            TypeParameterScope(nameScope, aliasedElement.typeParameters),
-            aliasedElement.parameters,
-          );
-        }
-
-        super.visitComment(node);
-        return;
-      } finally {
-        nameScope = outerScope;
-      }
-    } else if (parent is MethodDeclaration) {
-      var outerScope = nameScope;
-      try {
-        var element = parent.declaredElement!;
-        nameScope = FormalParameterScope(nameScope, element.parameters);
-
-        super.visitComment(node);
-        return;
-      } finally {
-        nameScope = outerScope;
-      }
-    }
-
-    super.visitComment(node);
-  }
-
-  @override
   void visitCommentReference(CommentReference node) {
     //
     // We do not visit the identifier because it needs to be visited in the
@@ -1246,7 +1193,6 @@
     // element resolver and type analyzer to visit the constructor declaration.
     node.accept(elementResolver);
     node.accept(typeAnalyzer);
-    safelyVisitComment(node.documentationComment);
   }
 
   @override
@@ -1480,12 +1426,6 @@
   }
 
   @override
-  void visitFunctionDeclarationInScope(FunctionDeclaration node) {
-    super.visitFunctionDeclarationInScope(node);
-    safelyVisitComment(node.documentationComment);
-  }
-
-  @override
   void visitFunctionExpression(covariant FunctionExpressionImpl node) {
     // Note: we have to update _enclosingFunction because we don't make use of
     // super.visitFunctionExpression.
@@ -1536,12 +1476,6 @@
   }
 
   @override
-  void visitFunctionTypeAliasInScope(FunctionTypeAlias node) {
-    super.visitFunctionTypeAliasInScope(node);
-    safelyVisitComment(node.documentationComment);
-  }
-
-  @override
   void visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
     super.visitFunctionTypedFormalParameter(node);
     node.accept(elementResolver);
@@ -1558,12 +1492,6 @@
   }
 
   @override
-  void visitGenericTypeAliasInFunctionScope(GenericTypeAlias node) {
-    super.visitGenericTypeAliasInFunctionScope(node);
-    safelyVisitComment(node.documentationComment);
-  }
-
-  @override
   void visitHideCombinator(HideCombinator node) {}
 
   @override
@@ -2574,7 +2502,6 @@
     try {
       ConstructorElement element = node.declaredElement!;
 
-      node.documentationComment?.accept(this);
       node.metadata.accept(this);
       node.returnType.accept(this);
       node.name?.accept(this);
@@ -2604,6 +2531,7 @@
   }
 
   void visitConstructorDeclarationInScope(ConstructorDeclaration node) {
+    node.documentationComment?.accept(this);
     node.body.accept(this);
   }
 
@@ -2801,7 +2729,6 @@
   void visitFunctionDeclarationInScope(FunctionDeclaration node) {
     // Note: we don't visit metadata because it's not inside the function's type
     // parameter scope.  It was already visited in [visitFunctionDeclaration].
-    node.documentationComment?.accept(this);
     node.returnType?.accept(this);
     node.name.accept(this);
     node.functionExpression.accept(this);
@@ -2809,9 +2736,11 @@
 
   @override
   void visitFunctionExpression(FunctionExpression node) {
-    if (node.parent is FunctionDeclaration) {
+    var parent = node.parent;
+    if (parent is FunctionDeclaration) {
       // We have already created a function scope and don't need to do so again.
       super.visitFunctionExpression(node);
+      parent.documentationComment?.accept(this);
       return;
     }
 
@@ -2848,11 +2777,13 @@
     // Note: we don't visit metadata because it's not inside the function type
     // alias's type parameter scope.  It was already visited in
     // [visitFunctionTypeAlias].
-    node.documentationComment?.accept(this);
     node.returnType?.accept(this);
     node.name.accept(this);
     node.typeParameters?.accept(this);
     node.parameters.accept(this);
+    // Visiting the parameters added them to the scope as a side effect.  So it
+    // is safe to visit the documentation comment now.
+    node.documentationComment?.accept(this);
   }
 
   @override
@@ -2917,21 +2848,20 @@
 
       var aliasedElement = element.aliasedElement;
       if (aliasedElement is GenericFunctionTypeElement) {
-        nameScope = FormalParameterScope(nameScope, aliasedElement.parameters);
-        visitGenericTypeAliasInFunctionScope(node);
+        nameScope = FormalParameterScope(
+            TypeParameterScope(nameScope, aliasedElement.typeParameters),
+            aliasedElement.parameters);
       }
+      node.documentationComment?.accept(this);
     } finally {
       nameScope = outerScope;
     }
   }
 
-  void visitGenericTypeAliasInFunctionScope(GenericTypeAlias node) {}
-
   void visitGenericTypeAliasInScope(GenericTypeAlias node) {
     // Note: we don't visit metadata because it's not inside the generic type
     // alias's type parameter scope.  It was already visited in
     // [visitGenericTypeAlias].
-    node.documentationComment?.accept(this);
     node.name.accept(this);
     node.typeParameters?.accept(this);
     node.type.accept(this);
@@ -2978,11 +2908,13 @@
   void visitMethodDeclarationInScope(MethodDeclaration node) {
     // Note: we don't visit metadata because it's not inside the method's type
     // parameter scope.  It was already visited in [visitMethodDeclaration].
-    node.documentationComment?.accept(this);
     node.returnType?.accept(this);
     node.name.accept(this);
     node.typeParameters?.accept(this);
     node.parameters?.accept(this);
+    // Visiting the parameters added them to the scope as a side effect.  So it
+    // is safe to visit the documentation comment now.
+    node.documentationComment?.accept(this);
     node.body.accept(this);
   }
 
diff --git a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
index b2bceea..1c5c4b3 100644
--- a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
@@ -14,9 +14,6 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AstRewriteMethodInvocationTest);
-    defineReflectiveTests(
-      AstRewriteMethodInvocationWithNonFunctionTypeAliasesTest,
-    );
   });
 }
 
@@ -99,6 +96,46 @@
     _assertArgumentList(invocation.argumentList, ['0']);
   }
 
+  test_targetNull_typeAlias_interfaceType() async {
+    await assertNoErrorsInCode(r'''
+class A<T, U> {
+  A(int _);
+}
+
+typedef X<T, U> = A<T, U>;
+
+void f() {
+  X<int, String>(0);
+}
+''');
+
+    var creation = findNode.instanceCreation('X<int, String>(0);');
+    assertInstanceCreation(
+      creation,
+      findElement.class_('A'),
+      'A<int, String>',
+      expectedConstructorMember: true,
+      expectedSubstitution: {'T': 'int', 'U': 'String'},
+      expectedTypeNameElement: findElement.typeAlias('X'),
+    );
+    _assertArgumentList(creation.argumentList, ['0']);
+  }
+
+  test_targetNull_typeAlias_Never() async {
+    await assertErrorsInCode(r'''
+typedef X = Never;
+
+void f() {
+  X(0);
+}
+''', [
+      error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION, 33, 1),
+    ]);
+
+    // Not rewritten.
+    findNode.methodInvocation('X(0)');
+  }
+
   test_targetPrefixedIdentifier_prefix_class_constructor() async {
     newFile('$testPackageLibPath/a.dart', content: r'''
 class A<T> {
@@ -192,6 +229,39 @@
     _assertArgumentList(invocation.argumentList, ['0']);
   }
 
+  test_targetPrefixedIdentifier_typeAlias_interfaceType_constructor() async {
+    newFile('$testPackageLibPath/a.dart', content: r'''
+class A<T> {
+  A.named(T a);
+}
+
+typedef X<T> = A<T>;
+''');
+
+    await assertNoErrorsInCode(r'''
+import 'a.dart' as prefix;
+
+void f() {
+  prefix.X.named(0);
+}
+''');
+
+    var importFind = findElement.importFind('package:test/a.dart');
+
+    var creation = findNode.instanceCreation('X.named(0);');
+    assertInstanceCreation(
+      creation,
+      importFind.class_('A'),
+      'A<int>',
+      constructorName: 'named',
+      expectedConstructorMember: true,
+      expectedSubstitution: {'T': 'int'},
+      expectedPrefix: findElement.prefix('prefix'),
+      expectedTypeNameElement: importFind.typeAlias('X'),
+    );
+    _assertArgumentList(creation.argumentList, ['0']);
+  }
+
   test_targetSimpleIdentifier_class_constructor() async {
     await assertNoErrorsInCode(r'''
 class A<T> {
@@ -346,6 +416,32 @@
     _assertArgumentList(invocation.argumentList, ['0']);
   }
 
+  test_targetSimpleIdentifier_typeAlias_interfaceType_constructor() async {
+    await assertNoErrorsInCode(r'''
+class A<T> {
+  A.named(T a);
+}
+
+typedef X<T> = A<T>;
+
+void f() {
+  X.named(0);
+}
+''');
+
+    var creation = findNode.instanceCreation('X.named(0);');
+    assertInstanceCreation(
+      creation,
+      findElement.class_('A'),
+      'A<int>',
+      constructorName: 'named',
+      expectedConstructorMember: true,
+      expectedSubstitution: {'T': 'int'},
+      expectedTypeNameElement: findElement.typeAlias('X'),
+    );
+    _assertArgumentList(creation.argumentList, ['0']);
+  }
+
   void _assertArgumentList(
     ArgumentList argumentList,
     List<String> expectedArguments,
@@ -388,106 +484,3 @@
     expect(argumentStrings, expectedArguments);
   }
 }
-
-@reflectiveTest
-class AstRewriteMethodInvocationWithNonFunctionTypeAliasesTest
-    extends PubPackageResolutionTest with AstRewriteMethodInvocationTestCases {
-  test_targetNull_typeAlias_interfaceType() async {
-    await assertNoErrorsInCode(r'''
-class A<T, U> {
-  A(int _);
-}
-
-typedef X<T, U> = A<T, U>;
-
-void f() {
-  X<int, String>(0);
-}
-''');
-
-    var creation = findNode.instanceCreation('X<int, String>(0);');
-    assertInstanceCreation(
-      creation,
-      findElement.class_('A'),
-      'A<int, String>',
-      expectedConstructorMember: true,
-      expectedSubstitution: {'T': 'int', 'U': 'String'},
-      expectedTypeNameElement: findElement.typeAlias('X'),
-    );
-    _assertArgumentList(creation.argumentList, ['0']);
-  }
-
-  test_targetNull_typeAlias_Never() async {
-    await assertErrorsInCode(r'''
-typedef X = Never;
-
-void f() {
-  X(0);
-}
-''', [
-      error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION, 33, 1),
-    ]);
-
-    // Not rewritten.
-    findNode.methodInvocation('X(0)');
-  }
-
-  test_targetPrefixedIdentifier_typeAlias_interfaceType_constructor() async {
-    newFile('$testPackageLibPath/a.dart', content: r'''
-class A<T> {
-  A.named(T a);
-}
-
-typedef X<T> = A<T>;
-''');
-
-    await assertNoErrorsInCode(r'''
-import 'a.dart' as prefix;
-
-void f() {
-  prefix.X.named(0);
-}
-''');
-
-    var importFind = findElement.importFind('package:test/a.dart');
-
-    var creation = findNode.instanceCreation('X.named(0);');
-    assertInstanceCreation(
-      creation,
-      importFind.class_('A'),
-      'A<int>',
-      constructorName: 'named',
-      expectedConstructorMember: true,
-      expectedSubstitution: {'T': 'int'},
-      expectedPrefix: findElement.prefix('prefix'),
-      expectedTypeNameElement: importFind.typeAlias('X'),
-    );
-    _assertArgumentList(creation.argumentList, ['0']);
-  }
-
-  test_targetSimpleIdentifier_typeAlias_interfaceType_constructor() async {
-    await assertNoErrorsInCode(r'''
-class A<T> {
-  A.named(T a);
-}
-
-typedef X<T> = A<T>;
-
-void f() {
-  X.named(0);
-}
-''');
-
-    var creation = findNode.instanceCreation('X.named(0);');
-    assertInstanceCreation(
-      creation,
-      findElement.class_('A'),
-      'A<int>',
-      constructorName: 'named',
-      expectedConstructorMember: true,
-      expectedSubstitution: {'T': 'int'},
-      expectedTypeNameElement: findElement.typeAlias('X'),
-    );
-    _assertArgumentList(creation.argumentList, ['0']);
-  }
-}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/equality_expressions_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/equality_expressions_test.dart
index d56dc4a..bc5d454 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/equality_expressions_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/equality_expressions_test.dart
@@ -9,14 +9,16 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(EqualTest);
-    defineReflectiveTests(EqualWithNullSafetyTest);
+    defineReflectiveTests(EqualWithoutNullSafetyTest);
     defineReflectiveTests(NotEqualTest);
-    defineReflectiveTests(NotEqualWithNullSafetyTest);
+    defineReflectiveTests(NotEqualWithoutNullSafetyTest);
   });
 }
 
 @reflectiveTest
-class EqualTest extends PubPackageResolutionTest with WithoutNullSafetyMixin {
+class EqualTest extends PubPackageResolutionTest with EqualTestCases {}
+
+mixin EqualTestCases on PubPackageResolutionTest {
   test_simple() async {
     await resolveTestCode('''
 void f(Object a, Object b) {
@@ -29,11 +31,13 @@
 }
 
 @reflectiveTest
-class EqualWithNullSafetyTest extends EqualTest with WithNullSafetyMixin {}
+class EqualWithoutNullSafetyTest extends PubPackageResolutionTest
+    with EqualTestCases, WithoutNullSafetyMixin {}
 
 @reflectiveTest
-class NotEqualTest extends PubPackageResolutionTest
-    with WithoutNullSafetyMixin {
+class NotEqualTest extends PubPackageResolutionTest with NotEqualTestCases {}
+
+mixin NotEqualTestCases on PubPackageResolutionTest {
   test_simple() async {
     await resolveTestCode('''
 void f(Object a, Object b) {
@@ -46,5 +50,5 @@
 }
 
 @reflectiveTest
-class NotEqualWithNullSafetyTest extends NotEqualTest with WithNullSafetyMixin {
-}
+class NotEqualWithoutNullSafetyTest extends PubPackageResolutionTest
+    with NotEqualTestCases, WithoutNullSafetyMixin {}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/logical_boolean_expressions_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/logical_boolean_expressions_test.dart
index 209ac2b..bb81efe 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/logical_boolean_expressions_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/logical_boolean_expressions_test.dart
@@ -9,29 +9,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LogicalAndTest);
-    defineReflectiveTests(LogicalAndWithNullSafetyTest);
+    defineReflectiveTests(LogicalAndWithoutNullSafetyTest);
     defineReflectiveTests(LogicalOrTest);
-    defineReflectiveTests(LogicalOrWithNullSafetyTest);
+    defineReflectiveTests(LogicalOrWithoutNullSafetyTest);
   });
 }
 
 @reflectiveTest
-class LogicalAndTest extends PubPackageResolutionTest
-    with WithoutNullSafetyMixin {
-  test_upward() async {
-    await resolveTestCode('''
-void f(bool a, bool b) {
-  var c = a && b;
-  print(c);
-}
-''');
-    assertType(findNode.simple('c)'), 'bool');
-  }
-}
-
-@reflectiveTest
-class LogicalAndWithNullSafetyTest extends LogicalAndTest
-    with WithNullSafetyMixin {
+class LogicalAndTest extends PubPackageResolutionTest with LogicalAndTestCases {
   @failingTest
   test_downward() async {
     await resolveTestCode('''
@@ -47,13 +32,11 @@
   }
 }
 
-@reflectiveTest
-class LogicalOrTest extends PubPackageResolutionTest
-    with WithoutNullSafetyMixin {
+mixin LogicalAndTestCases on PubPackageResolutionTest {
   test_upward() async {
     await resolveTestCode('''
 void f(bool a, bool b) {
-  var c = a || b;
+  var c = a && b;
   print(c);
 }
 ''');
@@ -62,8 +45,11 @@
 }
 
 @reflectiveTest
-class LogicalOrWithNullSafetyTest extends LogicalOrTest
-    with WithNullSafetyMixin {
+class LogicalAndWithoutNullSafetyTest extends PubPackageResolutionTest
+    with LogicalAndTestCases, WithoutNullSafetyMixin {}
+
+@reflectiveTest
+class LogicalOrTest extends PubPackageResolutionTest with LogicalOrTestCases {
   @failingTest
   test_downward() async {
     await resolveTestCode('''
@@ -78,3 +64,19 @@
     assertInvokeType(findNode.methodInvocation('b('), 'bool Function()');
   }
 }
+
+mixin LogicalOrTestCases on PubPackageResolutionTest {
+  test_upward() async {
+    await resolveTestCode('''
+void f(bool a, bool b) {
+  var c = a || b;
+  print(c);
+}
+''');
+    assertType(findNode.simple('c)'), 'bool');
+  }
+}
+
+@reflectiveTest
+class LogicalOrWithoutNullSafetyTest extends PubPackageResolutionTest
+    with LogicalOrTestCases, WithoutNullSafetyMixin {}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/type_test_expressions_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/type_test_expressions_test.dart
index 7e9f8fe..3b14b09 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/type_test_expressions_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/type_test_expressions_test.dart
@@ -9,14 +9,16 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(IsNotTest);
-    defineReflectiveTests(IsNotWithNullSafetyTest);
+    defineReflectiveTests(IsNotWithoutNullSafetyTest);
     defineReflectiveTests(IsTest);
-    defineReflectiveTests(IsWithNullSafetyTest);
+    defineReflectiveTests(IsWithoutNullSafetyTest);
   });
 }
 
 @reflectiveTest
-class IsNotTest extends PubPackageResolutionTest with WithoutNullSafetyMixin {
+class IsNotTest extends PubPackageResolutionTest with IsNotTestCases {}
+
+mixin IsNotTestCases on PubPackageResolutionTest {
   test_simple() async {
     await resolveTestCode('''
 void f(Object a) {
@@ -29,10 +31,13 @@
 }
 
 @reflectiveTest
-class IsNotWithNullSafetyTest extends IsNotTest with WithNullSafetyMixin {}
+class IsNotWithoutNullSafetyTest extends PubPackageResolutionTest
+    with IsNotTestCases, WithoutNullSafetyMixin {}
 
 @reflectiveTest
-class IsTest extends PubPackageResolutionTest with WithoutNullSafetyMixin {
+class IsTest extends PubPackageResolutionTest with IsTestCases {}
+
+mixin IsTestCases on PubPackageResolutionTest {
   test_simple() async {
     await resolveTestCode('''
 void f(Object a) {
@@ -45,4 +50,5 @@
 }
 
 @reflectiveTest
-class IsWithNullSafetyTest extends IsTest with WithNullSafetyMixin {}
+class IsWithoutNullSafetyTest extends PubPackageResolutionTest
+    with IsTestCases, WithoutNullSafetyMixin {}
diff --git a/pkg/analyzer/test/src/diagnostics/ambiguous_set_or_map_literal_test.dart b/pkg/analyzer/test/src/diagnostics/ambiguous_set_or_map_literal_test.dart
index 30de480..de079aa 100644
--- a/pkg/analyzer/test/src/diagnostics/ambiguous_set_or_map_literal_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/ambiguous_set_or_map_literal_test.dart
@@ -10,15 +10,59 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AmbiguousSetOrMapLiteralBothTest);
-    defineReflectiveTests(AmbiguousSetOrMapLiteralBothWithNullSafetyTest);
+    defineReflectiveTests(AmbiguousSetOrMapLiteralBothWithoutNullSafetyTest);
     defineReflectiveTests(AmbiguousSetOrMapLiteralEitherTest);
-    defineReflectiveTests(AmbiguousSetOrMapLiteralEitherWithNullSafetyTest);
+    defineReflectiveTests(AmbiguousSetOrMapLiteralEitherWithoutNullSafetyTest);
   });
 }
 
 @reflectiveTest
 class AmbiguousSetOrMapLiteralBothTest extends PubPackageResolutionTest
-    with WithoutNullSafetyMixin {
+    with AmbiguousSetOrMapLiteralBothTestCases {
+  test_map_keyNonNullable_valueNullable() async {
+    await assertNoErrorsInCode('''
+f(Map<int, int?> map) {
+  return {...map};
+}
+''');
+  }
+
+  test_map_keyNullable_valueNonNullable() async {
+    await assertNoErrorsInCode('''
+f(Map<int?, int> map) {
+  return {...map};
+}
+''');
+  }
+
+  test_map_keyNullable_valueNullable() async {
+    await assertNoErrorsInCode('''
+f(Map<int?, int?> map) {
+  return {...map};
+}
+''');
+  }
+
+  test_set_elementNullable() async {
+    await assertNoErrorsInCode('''
+f(Set<int?> set) {
+  return {...set};
+}
+''');
+  }
+
+  test_setAndMap_nullable() async {
+    await assertErrorsInCode('''
+f(Map<int?, int> map, Set<int?> set) {
+  return {...set, ...map};
+}
+''', [
+      error(CompileTimeErrorCode.AMBIGUOUS_SET_OR_MAP_LITERAL_BOTH, 48, 16),
+    ]);
+  }
+}
+
+mixin AmbiguousSetOrMapLiteralBothTestCases on PubPackageResolutionTest {
   test_map() async {
     await assertNoErrorsInCode('''
 f(Map<int, int> map) {
@@ -63,54 +107,15 @@
 }
 
 @reflectiveTest
-class AmbiguousSetOrMapLiteralBothWithNullSafetyTest
-    extends AmbiguousSetOrMapLiteralBothTest with WithNullSafetyMixin {
-  test_map_keyNonNullable_valueNullable() async {
-    await assertNoErrorsInCode('''
-f(Map<int, int?> map) {
-  return {...map};
-}
-''');
-  }
-
-  test_map_keyNullable_valueNonNullable() async {
-    await assertNoErrorsInCode('''
-f(Map<int?, int> map) {
-  return {...map};
-}
-''');
-  }
-
-  test_map_keyNullable_valueNullable() async {
-    await assertNoErrorsInCode('''
-f(Map<int?, int?> map) {
-  return {...map};
-}
-''');
-  }
-
-  test_set_elementNullable() async {
-    await assertNoErrorsInCode('''
-f(Set<int?> set) {
-  return {...set};
-}
-''');
-  }
-
-  test_setAndMap_nullable() async {
-    await assertErrorsInCode('''
-f(Map<int?, int> map, Set<int?> set) {
-  return {...set, ...map};
-}
-''', [
-      error(CompileTimeErrorCode.AMBIGUOUS_SET_OR_MAP_LITERAL_BOTH, 48, 16),
-    ]);
-  }
-}
+class AmbiguousSetOrMapLiteralBothWithoutNullSafetyTest
+    extends PubPackageResolutionTest
+    with AmbiguousSetOrMapLiteralBothTestCases, WithoutNullSafetyMixin {}
 
 @reflectiveTest
 class AmbiguousSetOrMapLiteralEitherTest extends PubPackageResolutionTest
-    with WithoutNullSafetyMixin {
+    with AmbiguousSetOrMapLiteralEitherTestCases {}
+
+mixin AmbiguousSetOrMapLiteralEitherTestCases on PubPackageResolutionTest {
   test_invalidPrefixOperator() async {
     // Guard against an exception being thrown.
     await assertErrorsInCode('''
@@ -132,5 +137,6 @@
 }
 
 @reflectiveTest
-class AmbiguousSetOrMapLiteralEitherWithNullSafetyTest
-    extends AmbiguousSetOrMapLiteralEitherTest with WithNullSafetyMixin {}
+class AmbiguousSetOrMapLiteralEitherWithoutNullSafetyTest
+    extends PubPackageResolutionTest
+    with AmbiguousSetOrMapLiteralEitherTestCases, WithoutNullSafetyMixin {}
diff --git a/tools/VERSION b/tools/VERSION
index 5b78760..d457a23 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 14
 PATCH 0
-PRERELEASE 387
+PRERELEASE 388
 PRERELEASE_PATCH 0
\ No newline at end of file