Version 2.9.0-13.0.dev

Merge commit '83277a4f3793271c372b649b87a80eba1d1c383b' into dev
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 101dfb2..0d6142e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,7 +2,7 @@
 
 ## Ways you can contribute
 
-You can help the Dart project in many ways, in addition to contributing code. For example, you can [report bugs](http://dartbug.com), ask and answer [Dart questions on StackOverflow](http://stackoverflow.com/questions/tagged/dart), and improve the documentation.
+You can help the Dart project in many ways, in addition to contributing code. For example, you can [report bugs](https://dartbug.com), ask and answer [Dart questions on StackOverflow](https://stackoverflow.com/questions/tagged/dart), and improve the documentation.
 
 If you'd like to improve the documentation, you have three options:
 
@@ -69,7 +69,7 @@
 git cl upload -s
 ```
 
-The above command returns a URL for the review. Attach this review to your issue in http://dartbug.com
+The above command returns a URL for the review. Attach this review to your issue in https://dartbug.com
 
 If you have commit access, when the review is done and the patch is good to go, submit the patch on https://dart-review.googlesource.com:
 
@@ -84,7 +84,7 @@
 
 If you do not have commit access, a Dart engineer will commit on your behalf, assuming the patch is reviewed and accepted.
 
-More detailed instructions for the `git cl` tools available on http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_creating_uploading_a_cl
+More detailed instructions for the `git cl` tools available on https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_creating_uploading_a_cl
 
 ## For committers: Merging external contributions
 
@@ -99,7 +99,7 @@
 The source code of Dart follows the:
 
   * [Google C++ style guide](https://google.github.io/styleguide/cppguide.html)
-  * [Dart style guide](https://www.dartlang.org/articles/style-guide/)
+  * [Dart style guide](https://dart.dev/guides/language/effective-dart/style)
 
 You should familiarize yourself with those guidelines.
 
@@ -114,6 +114,6 @@
 
 ## The small print
 
-Contributions made by corporations are covered by a different agreement than the one above, the [Software Grant and Corporate Contributor License Agreement](http://code.google.com/legal/corporate-cla-v1.0.html).
+Contributions made by corporations are covered by a different agreement than the one above, the [Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
 
 We pledge to maintain an open and welcoming environment. For details, see our [code of conduct](https://dart.dev/code-of-conduct).
diff --git a/DEPS b/DEPS
index 11bf21b..2ffcf83 100644
--- a/DEPS
+++ b/DEPS
@@ -38,7 +38,7 @@
 
   # Checked-in SDK version. The checked-in SDK is a Dart SDK distribution in a
   # cipd package used to run Dart scripts in the build and test infrastructure.
-  "sdk_tag": "version:2.9.0-4.0.dev",
+  "sdk_tag": "version:2.9.0-10.0.dev",
 
   # co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
   # hashes. It requires access to the dart-build-access group, which EngProd
@@ -67,6 +67,7 @@
   "boolean_selector_tag": "1309eabed510cc3b7536fd4367d39b97ebee3d69",
   "boringssl_gen_rev": "b9e27cff1ff0803e97ab1f88764a83be4aa94a6d",
   "boringssl_rev" : "4dfd5af70191b068aebe567b8e29ce108cee85ce",
+  "browser-compat-data_tag": "v1.0.22",
   "charcode_tag": "9085e6b6127f084d66c0a94810a808121459012a",
   "chrome_rev" : "19997",
   "cli_util_tag" : "0.1.4",
@@ -90,7 +91,7 @@
   # For more details, see https://github.com/dart-lang/sdk/issues/30164
   "dart_style_tag": "1.3.6",  # Please see the note above before updating.
 
-  "dartdoc_tag" : "v0.32.0",
+  "dartdoc_tag" : "v0.32.1",
   "ffi_tag": "454ab0f9ea6bd06942a983238d8a6818b1357edb",
   "fixnum_tag": "eb3748663dc979271ff6a3d014fbe522543b1d91",
   "glob_tag": "e9f4e6b7ae8abe5071461cf8f47191bb19cf7ef6",
@@ -256,6 +257,10 @@
   Var("dart_root") + "/third_party/WebCore":
       Var("dart_git") + "webcore.git" + "@" + Var("WebCore_rev"),
 
+  Var("dart_root") + "/third_party/mdn/browser-compat-data":
+      Var('chromium_git') + '/external/github.com/mdn/browser-compat-data' +
+      "@" + Var("browser-compat-data_tag"),
+
   Var("dart_root") + "/third_party/tcmalloc/gperftools":
       Var('chromium_git') + '/external/github.com/gperftools/gperftools.git' +
       "@" + Var("gperftools_revision"),
diff --git a/README.md b/README.md
index 27cbb2b..4b4ee5b 100644
--- a/README.md
+++ b/README.md
@@ -57,8 +57,8 @@
 [website]: https://dart.dev
 [license]: https://github.com/dart-lang/sdk/blob/master/LICENSE
 [repo]: https://github.com/dart-lang/sdk
-[lang]: https://www.dartlang.org/docs/dart-up-and-running/ch02.html
-[tools]: https://www.dartlang.org/tools/
+[lang]: https://dart.dev/guides/language/language-tour
+[tools]: https://dart.dev/tools
 [codelab]: https://dart.dev/codelabs
 [dartbug]: http://dartbug.com
 [contrib]: https://github.com/dart-lang/sdk/blob/master/CONTRIBUTING.md
diff --git a/docs/language/informal/assert-in-initializer-list.md b/docs/language/informal/assert-in-initializer-list.md
index 38e523d..6fb33d6 100644
--- a/docs/language/informal/assert-in-initializer-list.md
+++ b/docs/language/informal/assert-in-initializer-list.md
@@ -7,7 +7,7 @@
 [`609d26a`](https://github.com/dart-lang/sdk/commit/609d26a2274ccde0f74725f4df7e081ebc8ea020);
 this document is now background material.
 
-(See: http://dartbug.com/24841, http://dartbug.com/27141)
+(See: https://dartbug.com/24841, https://dartbug.com/27141)
 
 In some cases, you want to validate your inputs before creating an instance, even in a const constructor. To allow that, we have tested the possibility of allowing assert statements in the initializer list of a generative constructor.
 
diff --git a/docs/language/informal/optional-new-const.md b/docs/language/informal/optional-new-const.md
index 8e100a7..e249a63 100644
--- a/docs/language/informal/optional-new-const.md
+++ b/docs/language/informal/optional-new-const.md
@@ -47,7 +47,7 @@
 This syntax will only apply to unprefixed constructor invocations (at least unless we also introduce type-instantiated generic method tear-offs).
 
 ### Prior discussion
-See http://dartbug.com/4046 and https://github.com/lrhn/dep-const/blob/master/proposal.md
+See https://dartbug.com/4046 and https://github.com/lrhn/dep-const/blob/master/proposal.md
 
 The syntax for a constructor call is less ambiguous now than when these proposals were drafted, because generic methods have since been added to the language. The language has already decided how to resolve parsing of the otherwise ambiguous `Bar(Foo<int, bar>(42))`.
 
@@ -103,7 +103,7 @@
 
 ### Prior discussion
 
-See: http://dartbug.com/5680, http://dartbug.com/18241, http://dartbug.com/20750.
+See: https://dartbug.com/5680, https://dartbug.com/18241, https://dartbug.com/20750.
 
 ### Informal specification
 
@@ -258,7 +258,7 @@
 
 ### Prior discussion
 
-See: [issue 18241](http://dartbug.com/18241)
+See: [issue 18241](https://dartbug.com/18241)
 
 ### Informal specification
 
@@ -338,7 +338,7 @@
 
 but doesn't allow `Foo<T>` by itself, not even for the non-named constructor.
 
-The syntax is available, and needs to be recognized in most settings anyway, so we could allow it as a type literal expression. That would allow the expression `List<int>` to evaluate to the *Type* object for the class *List<int>*. It's been a long time (refused) request: [issue 23221](http://dartbug.com/23221).
+The syntax is available, and needs to be recognized in most settings anyway, so we could allow it as a type literal expression. That would allow the expression `List<int>` to evaluate to the *Type* object for the class *List<int>*. It's been a long time (refused) request: [issue 23221](https://dartbug.com/23221).
 
 The syntax will also be useful for instantiated generic method tear-off like `var intContinuation = future.then<int>;`
 
diff --git a/docs/newsletter/20170728.md b/docs/newsletter/20170728.md
index d6a0c05..a49cdb0 100644
--- a/docs/newsletter/20170728.md
+++ b/docs/newsletter/20170728.md
@@ -93,7 +93,7 @@
 We will also be more aggressive in writing separate specs of features that aren't planned for immediate implementation, or store documents that aren't completely finished, yet.
 
 ### Resolved part-of
-Resolved "part of"s have been implemented. (http://dartbug.com/20792)
+Resolved "part of"s have been implemented. (https://dartbug.com/20792)
 
 In future versions of the Dart SDK it will be possible to use a URI to refer back from a part to its library:
 ``` dart
diff --git a/docs/process/breaking-changes.md b/docs/process/breaking-changes.md
index 2745872..b277e44 100644
--- a/docs/process/breaking-changes.md
+++ b/docs/process/breaking-changes.md
@@ -43,7 +43,7 @@
 
 Compatibility is only considered between stable releases (i.e. releases from the
 [Dart stable
-channel](https://www.dartlang.org/tools/sdk/archive#stable-channel)).
+channel](https://dart.dev/tools/sdk/archive#stable-channel)).
 
 ## Breaking change notification
 
diff --git a/docs/process/experimental-flags.md b/docs/process/experimental-flags.md
index e0af8b2..9d319b4 100644
--- a/docs/process/experimental-flags.md
+++ b/docs/process/experimental-flags.md
@@ -4,8 +4,8 @@
 
 The Dart SDK ships via a number of channels:
 
-- Via the [Dart SDK](https://www.dartlang.org/tools/sdk#install)
-- Via the [Flutter SDK](http://flutter.io)
+- Via the [Dart SDK](https://dart.dev/get-dart#install)
+- Via the [Flutter SDK](https://flutter.dev/)
 - Internally at Google via an internal channel
 
 Each of these channels use varying release calendars, and keeping these entirely
diff --git a/pkg/_fe_analyzer_shared/test/constants/data/marker.options b/pkg/_fe_analyzer_shared/test/constants/data/marker.options
index 98b58d7..c910e4c 100644
--- a/pkg/_fe_analyzer_shared/test/constants/data/marker.options
+++ b/pkg/_fe_analyzer_shared/test/constants/data/marker.options
@@ -1,4 +1,4 @@
 cfe=pkg/front_end/test/id_tests/constant_test.dart
 analyzer=pkg/analyzer/test/id_tests/constant_test.dart
-dart2js=tests/compiler/dart2js/model/cfe_constant_test.dart
-dart2js:nnbd-sdk=tests/compiler/dart2js/model/cfe_constant_test.dart
\ No newline at end of file
+dart2js=pkg/compiler/test/model/cfe_constant_test.dart
+dart2js:nnbd-sdk=pkg/compiler/test/model/cfe_constant_test.dart
\ No newline at end of file
diff --git a/pkg/analysis_server/doc/api.html b/pkg/analysis_server/doc/api.html
index 130585f..389b7e8 100644
--- a/pkg/analysis_server/doc/api.html
+++ b/pkg/analysis_server/doc/api.html
@@ -888,16 +888,6 @@
           mechanism.
         </p>
         <p>
-          If a package root is a directory, then
-          the analyzer will behave as though the associated
-          source directory in the map contains a special
-          pubspec.yaml file which resolves any package: URI to the
-          corresponding path within that package root directory. The
-          effect is the same as specifying the package root directory as
-          a "--package_root" parameter to the Dart VM when
-          executing any Dart file inside the source directory.
-        </p>
-        <p>
           If a package root is a file, then the analyzer
           will behave as though that file is a ".packages" file in the
           source directory. The effect is the same as specifying the file
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index 1300974..c6fe18d 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -3323,13 +3323,6 @@
   /// A mapping from source directories to package roots that should override
   /// the normal package: URI resolution mechanism.
   ///
-  /// If a package root is a directory, then the analyzer will behave as though
-  /// the associated source directory in the map contains a special
-  /// pubspec.yaml file which resolves any package: URI to the corresponding
-  /// path within that package root directory. The effect is the same as
-  /// specifying the package root directory as a "--package_root" parameter to
-  /// the Dart VM when executing any Dart file inside the source directory.
-  ///
   /// If a package root is a file, then the analyzer will behave as though that
   /// file is a ".packages" file in the source directory. The effect is the
   /// same as specifying the file as a "--packages" parameter to the Dart VM
@@ -3344,13 +3337,6 @@
   /// A mapping from source directories to package roots that should override
   /// the normal package: URI resolution mechanism.
   ///
-  /// If a package root is a directory, then the analyzer will behave as though
-  /// the associated source directory in the map contains a special
-  /// pubspec.yaml file which resolves any package: URI to the corresponding
-  /// path within that package root directory. The effect is the same as
-  /// specifying the package root directory as a "--package_root" parameter to
-  /// the Dart VM when executing any Dart file inside the source directory.
-  ///
   /// If a package root is a file, then the analyzer will behave as though that
   /// file is a ".packages" file in the source directory. The effect is the
   /// same as specifying the file as a "--packages" parameter to the Dart VM
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 4cd286b..c4c69f8 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -264,8 +264,14 @@
       });
     }, (exception, stackTrace) {
       AnalysisEngine.instance.instrumentationService.logException(
-          FatalException('Failed to handle request: ${request.method}',
-              exception, stackTrace));
+        FatalException(
+          'Failed to handle request: ${request.method}',
+          exception,
+          stackTrace,
+        ),
+        null,
+        crashReportingAttachmentsBuilder.forException(exception),
+      );
     });
   }
 
@@ -394,13 +400,13 @@
   /// So, we can start working in parallel on adding services and improving
   /// projects/contexts support.
   void setAnalysisRoots(String requestId, List<String> includedPaths,
-      List<String> excludedPaths, Map<String, String> packageRoots) {
+      List<String> excludedPaths) {
     declarationsTracker?.discardContexts();
     if (notificationManager != null) {
       notificationManager.setAnalysisRoots(includedPaths, excludedPaths);
     }
     try {
-      contextManager.setRoots(includedPaths, excludedPaths, packageRoots);
+      contextManager.setRoots(includedPaths, excludedPaths);
     } on UnimplementedError catch (e) {
       throw RequestFailure(Response.unsupportedFeature(requestId, e.message));
     }
@@ -823,21 +829,8 @@
 
   @override
   ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) {
-    String defaultPackageFilePath;
-    var path = (analysisServer.contextManager as ContextManagerImpl)
-        .normalizedPackageRoots[folder.path];
-    if (path != null) {
-      var resource = resourceProvider.getResource(path);
-      if (resource.exists) {
-        if (resource is File) {
-          defaultPackageFilePath = path;
-        }
-      }
-    }
-
     var builderOptions = ContextBuilderOptions();
     builderOptions.defaultOptions = options;
-    builderOptions.defaultPackageFilePath = defaultPackageFilePath;
     var builder = ContextBuilder(
         resourceProvider, analysisServer.sdkManager, null,
         options: builderOptions);
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 1a01fc1..62d235c 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -17,7 +17,6 @@
 import 'package:analyzer/src/file_system/file_system.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/java_engine.dart';
-import 'package:analyzer/src/generated/java_io.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
@@ -80,9 +79,6 @@
   /// The enclosed pubspec-based contexts.
   final List<ContextInfo> children = <ContextInfo>[];
 
-  /// The package root for this context, or null if there is no package root.
-  String packageRoot;
-
   /// The [ContextInfo] that encloses this one, or `null` if this is the virtual
   /// [ContextInfo] object that acts as the ancestor of all other [ContextInfo]
   /// objects.
@@ -109,7 +105,7 @@
   Map<String, Source> sources = HashMap<String, Source>();
 
   ContextInfo(ContextManagerImpl contextManager, this.parent, Folder folder,
-      File packagespecFile, this.packageRoot, this.disposition)
+      File packagespecFile, this.disposition)
       : folder = folder,
         pathFilter = PathFilter(
             folder.path, null, contextManager.resourceProvider.pathContext) {
@@ -122,7 +118,6 @@
   ContextInfo._root()
       : folder = null,
         pathFilter = null,
-        packageRoot = null,
         disposition = null;
 
   /// Iterate through all [children] and their children, recursively.
@@ -281,8 +276,7 @@
 
   /// Change the set of paths which should be used as starting points to
   /// determine the context directories.
-  void setRoots(List<String> includedPaths, List<String> excludedPaths,
-      Map<String, String> packageRoots);
+  void setRoots(List<String> includedPaths, List<String> excludedPaths);
 }
 
 /// Callback interface used by [ContextManager] to (a) request that contexts be
@@ -374,13 +368,6 @@
   @override
   List<String> includedPaths = <String>[];
 
-  /// The map of package roots most recently passed to [setRoots].
-  Map<String, String> packageRoots = <String, String>{};
-
-  /// Same as [packageRoots], except that source folders have been normalized
-  /// and non-folders have been removed.
-  Map<String, String> normalizedPackageRoots = <String, String>{};
-
   /// A list of the globs used to determine which files should be analyzed.
   final List<Glob> analyzedFilesGlobs;
 
@@ -562,7 +549,7 @@
     }
 
     // Rebuild contexts based on the data last sent to setRoots().
-    setRoots(includedPaths, excludedPaths, packageRoots);
+    setRoots(includedPaths, excludedPaths);
   }
 
   /// Sets the [ignorePatterns] for the context having info [info].
@@ -572,20 +559,7 @@
   }
 
   @override
-  void setRoots(List<String> includedPaths, List<String> excludedPaths,
-      Map<String, String> packageRoots) {
-    this.packageRoots = packageRoots;
-
-    // Normalize all package root sources by mapping them to folders on the
-    // filesystem.  Ignore any package root sources that aren't folders.
-    normalizedPackageRoots = <String, String>{};
-    packageRoots.forEach((String sourcePath, String targetPath) {
-      var resource = resourceProvider.getResource(sourcePath);
-      if (resource is Folder) {
-        normalizedPackageRoots[resource.path] = targetPath;
-      }
-    });
-
+  void setRoots(List<String> includedPaths, List<String> excludedPaths) {
     var contextInfos = rootInfo.descendants.toList();
     // included
     var includedFolders = <Folder>[];
@@ -625,14 +599,6 @@
         _destroyContext(contextInfo);
       }
     }
-    // Update package roots for existing contexts
-    for (var info in rootInfo.descendants) {
-      var newPackageRoot = normalizedPackageRoots[info.folder.path];
-      if (info.packageRoot != newPackageRoot) {
-        info.packageRoot = newPackageRoot;
-        _recomputeFolderDisposition(info);
-      }
-    }
     // create new contexts
     for (var includedFolder in includedFolders) {
       var includedPath = includedFolder.path;
@@ -903,58 +869,16 @@
   /// dependencies (currently we only use it to track "pub list" dependencies).
   FolderDisposition _computeFolderDisposition(Folder folder,
       void Function(String path) addDependency, File packagespecFile) {
-    var packageRoot = normalizedPackageRoots[folder.path];
-    if (packageRoot != null) {
-      // TODO(paulberry): We shouldn't be using JavaFile here because it
-      // makes the code untestable (see dartbug.com/23909).
-      var packagesDirOrFile = JavaFile(packageRoot);
-      var packageMap = <String, List<Folder>>{};
-      if (packagesDirOrFile.isDirectory()) {
-        for (var file in packagesDirOrFile.listFiles()) {
-          // Ensure symlinks in packages directory are canonicalized
-          // to prevent 'type X cannot be assigned to type X' warnings
-          String path;
-          try {
-            path = file.getCanonicalPath();
-          } catch (e, s) {
-            // Ignore packages that do not exist
-            _instrumentationService.logException(e, s);
-            continue;
-          }
-          var res = resourceProvider.getResource(path);
-          if (res is Folder) {
-            packageMap[file.getName()] = <Folder>[res];
-          }
-        }
-        return PackageMapDisposition(packageMap, packageRoot: packageRoot);
-      } else if (packagesDirOrFile.isFile()) {
-        var packageSpecFile = resourceProvider.getFile(packageRoot);
-        var packages = parsePackagesFile(
-          resourceProvider,
-          packageSpecFile,
-        );
-        if (packages != null) {
-          return PackagesFileDisposition(packages);
-        }
-      }
-      // The package root does not exist (or is not a folder).  Since
-      // [setRoots] ignores any package roots that don't exist (or aren't
-      // folders), the only way we should be able to get here is due to a race
-      // condition.  In any case, the package root folder is gone, so we can't
-      // resolve packages.
-      return NoPackageFolderDisposition(packageRoot: packageRoot);
-    } else {
-      // Try .packages first.
-      if (pathContext.basename(packagespecFile.path) == PACKAGE_SPEC_NAME) {
-        var packages = parsePackagesFile(
-          resourceProvider,
-          packagespecFile,
-        );
-        return PackagesFileDisposition(packages);
-      }
-
-      return NoPackageFolderDisposition();
+    // Try .packages first.
+    if (pathContext.basename(packagespecFile.path) == PACKAGE_SPEC_NAME) {
+      var packages = parsePackagesFile(
+        resourceProvider,
+        packagespecFile,
+      );
+      return PackagesFileDisposition(packages);
     }
+
+    return NoPackageFolderDisposition();
   }
 
   /// Compute line information for the given [content].
@@ -988,8 +912,7 @@
     var dependencies = <String>[];
     var disposition =
         _computeFolderDisposition(folder, dependencies.add, packagesFile);
-    var info = ContextInfo(this, parent, folder, packagesFile,
-        normalizedPackageRoots[folder.path], disposition);
+    var info = ContextInfo(this, parent, folder, packagesFile, disposition);
 
     File optionsFile;
     YamlMap optionMap;
@@ -1557,36 +1480,6 @@
 }
 
 /// Concrete [FolderDisposition] object indicating that the context for a given
-/// folder should resolve packages using a package map.
-class PackageMapDisposition extends FolderDisposition {
-  final Map<String, List<Folder>> packageMap;
-
-  EmbedderYamlLocator _embedderLocator;
-
-  @override
-  final String packageRoot;
-
-  PackageMapDisposition(this.packageMap, {this.packageRoot});
-
-  @override
-  Packages get packages => null;
-
-  @override
-  Iterable<UriResolver> createPackageUriResolvers(
-      ResourceProvider resourceProvider) {
-    return <UriResolver>[
-      PackageMapUriResolver(resourceProvider, packageMap),
-    ];
-  }
-
-  @override
-  EmbedderYamlLocator getEmbedderLocator(ResourceProvider resourceProvider) {
-    _embedderLocator ??= EmbedderYamlLocator(packageMap);
-    return _embedderLocator;
-  }
-}
-
-/// Concrete [FolderDisposition] object indicating that the context for a given
 /// folder should resolve packages using a ".packages" file.
 class PackagesFileDisposition extends FolderDisposition {
   @override
diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
index f6b02a4..1612bb1 100644
--- a/pkg/analysis_server/lib/src/domain_analysis.dart
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart
@@ -342,14 +342,13 @@
         return Response.invalidFilePathFormat(request, path);
       }
     }
-    var packageRoots = params.packageRoots ?? <String, String>{};
 
     if (server.detachableFileSystemManager != null) {
-      server.detachableFileSystemManager.setAnalysisRoots(
-          request.id, includedPathList, excludedPathList, packageRoots);
+      // TODO(scheglov) remove the last argument
+      server.detachableFileSystemManager
+          .setAnalysisRoots(request.id, includedPathList, excludedPathList, {});
     } else {
-      server.setAnalysisRoots(
-          request.id, includedPathList, excludedPathList, packageRoots);
+      server.setAnalysisRoots(request.id, includedPathList, excludedPathList);
     }
     return AnalysisSetAnalysisRootsResult().toResponse(request.id);
   }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart
index c55b14c..8600e2a 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_format_on_type.dart
@@ -35,6 +35,10 @@
   @override
   Future<ErrorOr<List<TextEdit>>> handle(
       DocumentOnTypeFormattingParams params, CancellationToken token) async {
+    if (!isDartDocument(params.textDocument)) {
+      return success(null);
+    }
+
     final path = pathOfDoc(params.textDocument);
     return path.mapResult((path) => formatFile(path));
   }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart
index 481ba17..99e4cfb 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_formatting.dart
@@ -35,6 +35,10 @@
   @override
   Future<ErrorOr<List<TextEdit>>> handle(
       DocumentFormattingParams params, CancellationToken token) async {
+    if (!isDartDocument(params.textDocument)) {
+      return success(null);
+    }
+
     final path = pathOfDoc(params.textDocument);
     return path.mapResult((path) => formatFile(path));
   }
diff --git a/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart b/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart
index 3230f33..44b8c85 100644
--- a/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart
+++ b/pkg/analysis_server/lib/src/lsp/handlers/handler_rename.dart
@@ -23,6 +23,10 @@
   @override
   Future<ErrorOr<RangeAndPlaceholder>> handle(
       TextDocumentPositionParams params, CancellationToken token) async {
+    if (!isDartDocument(params.textDocument)) {
+      return success(null);
+    }
+
     final pos = params.position;
     final path = pathOfDoc(params.textDocument);
     final unit = await path.mapResult(requireResolvedUnit);
@@ -78,6 +82,10 @@
   @override
   Future<ErrorOr<WorkspaceEdit>> handle(
       RenameParams params, CancellationToken token) async {
+    if (!isDartDocument(params.textDocument)) {
+      return success(null);
+    }
+
     final pos = params.position;
     final path = pathOfDoc(params.textDocument);
     // If the client provided us a version doc identifier, we'll use it to ensure
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index a5f55a1..2d2e274 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -454,7 +454,7 @@
   void setAnalysisRoots(List<String> includedPaths) {
     declarationsTracker?.discardContexts();
     final uniquePaths = HashSet<String>.of(includedPaths ?? const []);
-    contextManager.setRoots(uniquePaths.toList(), [], {});
+    contextManager.setRoots(uniquePaths.toList(), []);
     notificationManager.setAnalysisRoots(includedPaths, []);
     addContextsToDeclarationsTracker();
   }
@@ -705,21 +705,8 @@
 
   @override
   ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) {
-    String defaultPackageFilePath;
-    var path = (analysisServer.contextManager as ContextManagerImpl)
-        .normalizedPackageRoots[folder.path];
-    if (path != null) {
-      var resource = resourceProvider.getResource(path);
-      if (resource.exists) {
-        if (resource is File) {
-          defaultPackageFilePath = path;
-        }
-      }
-    }
-
     var builderOptions = ContextBuilderOptions();
     builderOptions.defaultOptions = options;
-    builderOptions.defaultPackageFilePath = defaultPackageFilePath;
     var builder = ContextBuilder(
         resourceProvider, analysisServer.sdkManager, null,
         options: builderOptions);
diff --git a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
index a154b95..6180dbc 100644
--- a/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
+++ b/pkg/analysis_server/lib/src/lsp/server_capabilities_computer.dart
@@ -201,12 +201,18 @@
         // folders as well.
         .map((glob) => DocumentFilter(null, 'file', '**/$glob'));
 
-    final allTypes = [
-      dartFiles,
+    final allTypes = {dartFiles, ...pluginTypes}.toList();
+
+    // Add pubspec + analysis options only for synchronisation. We do not support
+    // things like hovers/formatting/etc. for these files so there's no point
+    // in having the client send those requests (plus, for things like formatting
+    // this could result in the editor reporting "multiple formatters installed"
+    // and prevent a built-in YAML formatter from being selected).
+    final allSynchronisedTypes = {
+      ...allTypes,
       pubspecFile,
       analysisOptionsFile,
-      ...pluginTypes
-    ];
+    }.toList();
 
     final registrations = <Registration>[];
 
@@ -223,18 +229,18 @@
     register(
       textCapabilities?.synchronization?.dynamicRegistration,
       Method.textDocument_didOpen,
-      TextDocumentRegistrationOptions(allTypes),
+      TextDocumentRegistrationOptions(allSynchronisedTypes),
     );
     register(
       textCapabilities?.synchronization?.dynamicRegistration,
       Method.textDocument_didClose,
-      TextDocumentRegistrationOptions(allTypes),
+      TextDocumentRegistrationOptions(allSynchronisedTypes),
     );
     register(
       textCapabilities?.synchronization?.dynamicRegistration,
       Method.textDocument_didChange,
       TextDocumentChangeRegistrationOptions(
-          TextDocumentSyncKind.Incremental, allTypes),
+          TextDocumentSyncKind.Incremental, allSynchronisedTypes),
     );
     register(
       _server.clientCapabilities?.textDocument?.completion?.dynamicRegistration,
@@ -249,33 +255,33 @@
     register(
       textCapabilities?.hover?.dynamicRegistration,
       Method.textDocument_hover,
-      TextDocumentRegistrationOptions([dartFiles]),
+      TextDocumentRegistrationOptions(allTypes),
     );
     register(
       textCapabilities?.signatureHelp?.dynamicRegistration,
       Method.textDocument_signatureHelp,
       SignatureHelpRegistrationOptions(
-          dartSignatureHelpTriggerCharacters, [dartFiles]),
+          dartSignatureHelpTriggerCharacters, allTypes),
     );
     register(
       _server.clientCapabilities?.textDocument?.references?.dynamicRegistration,
       Method.textDocument_references,
-      TextDocumentRegistrationOptions([dartFiles]),
+      TextDocumentRegistrationOptions(allTypes),
     );
     register(
       textCapabilities?.documentHighlight?.dynamicRegistration,
       Method.textDocument_documentHighlight,
-      TextDocumentRegistrationOptions([dartFiles]),
+      TextDocumentRegistrationOptions(allTypes),
     );
     register(
       textCapabilities?.documentSymbol?.dynamicRegistration,
       Method.textDocument_documentSymbol,
-      TextDocumentRegistrationOptions([dartFiles]),
+      TextDocumentRegistrationOptions(allTypes),
     );
     register(
       _server.clientCapabilities?.textDocument?.formatting?.dynamicRegistration,
       Method.textDocument_formatting,
-      TextDocumentRegistrationOptions([dartFiles]),
+      TextDocumentRegistrationOptions(allTypes),
     );
     register(
       textCapabilities?.onTypeFormatting?.dynamicRegistration,
@@ -283,29 +289,29 @@
       DocumentOnTypeFormattingRegistrationOptions(
         dartTypeFormattingCharacters.first,
         dartTypeFormattingCharacters.skip(1).toList(),
-        [dartFiles],
+        [dartFiles], // This one is currently Dart-specific
       ),
     );
     register(
       _server.clientCapabilities?.textDocument?.definition?.dynamicRegistration,
       Method.textDocument_definition,
-      TextDocumentRegistrationOptions([dartFiles]),
+      TextDocumentRegistrationOptions(allTypes),
     );
     register(
       textCapabilities?.implementation?.dynamicRegistration,
       Method.textDocument_implementation,
-      TextDocumentRegistrationOptions([dartFiles]),
+      TextDocumentRegistrationOptions(allTypes),
     );
     register(
       _server.clientCapabilities?.textDocument?.codeAction?.dynamicRegistration,
       Method.textDocument_codeAction,
       CodeActionRegistrationOptions(
-          [dartFiles], DartCodeActionKind.serverSupportedKinds),
+          allTypes, DartCodeActionKind.serverSupportedKinds),
     );
     register(
       textCapabilities?.rename?.dynamicRegistration,
       Method.textDocument_rename,
-      RenameRegistrationOptions(true, [dartFiles]),
+      RenameRegistrationOptions(true, allTypes),
     );
     register(
       textCapabilities?.foldingRange?.dynamicRegistration,
diff --git a/pkg/analysis_server/lib/src/server/crash_reporting.dart b/pkg/analysis_server/lib/src/server/crash_reporting.dart
index 866b9ff..59cecd9 100644
--- a/pkg/analysis_server/lib/src/server/crash_reporting.dart
+++ b/pkg/analysis_server/lib/src/server/crash_reporting.dart
@@ -11,17 +11,13 @@
 const _angularPluginName = 'Angular Analysis Plugin';
 
 class CrashReportingInstrumentation extends NoopInstrumentationService {
-  // A staging reporter, that we are in the process of phasing out.
-  final CrashReportSender stagingReporter;
-
-  // A prod reporter, that we are in the process of phasing in.
-  final CrashReportSender prodReporter;
+  // A prod reporter, for analysis server crashes.
+  final CrashReportSender serverReporter;
 
   // The angular plugin crash reporter.
   final CrashReportSender angularReporter;
 
-  CrashReportingInstrumentation(
-      this.stagingReporter, this.prodReporter, this.angularReporter);
+  CrashReportingInstrumentation(this.serverReporter, this.angularReporter);
 
   @override
   void logException(dynamic exception,
@@ -64,13 +60,7 @@
 
   void _sendServerReport(Object exception, Object stackTrace,
       {String comment, List<CrashReportAttachment> attachments}) {
-    stagingReporter
-        .sendReport(exception, stackTrace,
-            attachments: attachments, comment: comment)
-        .catchError((error) {
-      // We silently ignore errors sending crash reports (network issues, ...).
-    });
-    prodReporter
+    serverReporter
         .sendReport(exception, stackTrace,
             attachments: attachments, comment: comment)
         .catchError((error) {
diff --git a/pkg/analysis_server/lib/src/server/crash_reporting_attachments.dart b/pkg/analysis_server/lib/src/server/crash_reporting_attachments.dart
index 281c6d2..0648968 100644
--- a/pkg/analysis_server/lib/src/server/crash_reporting_attachments.dart
+++ b/pkg/analysis_server/lib/src/server/crash_reporting_attachments.dart
@@ -11,6 +11,13 @@
       CrashReportingAttachmentsBuilder();
 
   /// Return attachments with information about the analysis exception.
+  List<InstrumentationServiceAttachment> forException(
+    Object exception,
+  ) {
+    return const [];
+  }
+
+  /// Return attachments with information about the analysis exception.
   List<InstrumentationServiceAttachment> forExceptionResult(
     ExceptionResult result,
   ) {
diff --git a/pkg/analysis_server/lib/src/server/driver.dart b/pkg/analysis_server/lib/src/server/driver.dart
index 54245c7..5d9a1f8 100644
--- a/pkg/analysis_server/lib/src/server/driver.dart
+++ b/pkg/analysis_server/lib/src/server/driver.dart
@@ -381,10 +381,9 @@
     );
     analysisServerOptions.analytics = analytics;
 
-    if (analysisServerOptions.clientId != null) {
-      // Record the client name as the application installer ID.
-      analytics.setSessionValue('aiid', analysisServerOptions.clientId);
-    }
+    // Record the client name as the application installer ID.
+    analytics.setSessionValue(
+        'aiid', analysisServerOptions.clientId ?? 'not-set');
     if (analysisServerOptions.clientVersion != null) {
       analytics.setSessionValue('cd1', analysisServerOptions.clientVersion);
     }
@@ -403,9 +402,7 @@
 
     // Use sdkConfig to optionally override analytics settings.
     final crashProductId = sdkConfig.crashReportingId ?? 'Dart_analysis_server';
-    final crashReportSenderStaging =
-        CrashReportSender.staging(crashProductId, shouldSendCallback);
-    final crashReportSenderProd =
+    final crashReportSender =
         CrashReportSender.prod(crashProductId, shouldSendCallback);
     // TODO(mfairhurst): send these to prod or disable.
     final crashReportSenderAngular = CrashReportSender.staging(
@@ -461,9 +458,7 @@
 
     var errorNotifier = ErrorNotifier();
     allInstrumentationServices.add(CrashReportingInstrumentation(
-        crashReportSenderStaging,
-        crashReportSenderProd,
-        crashReportSenderAngular));
+        crashReportSender, crashReportSenderAngular));
     instrumentationService =
         MulticastInstrumentationService(allInstrumentationServices);
 
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
index 53d1eec..a33b3a4 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/feature_computer.dart
@@ -11,6 +11,7 @@
 import 'package:analysis_server/src/services/completion/dart/relevance_tables.g.dart';
 import 'package:analysis_server/src/utilities/extensions/element.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart'
     show
@@ -299,6 +300,14 @@
   }
 
   @override
+  DartType visitAsExpression(AsExpression node) {
+    if (childNode == node.type) {
+      return node.expression.staticType;
+    }
+    return null;
+  }
+
+  @override
   DartType visitAssertInitializer(AssertInitializer node) {
     if (childNode == node.condition) {
       return typeProvider.boolType;
@@ -317,7 +326,16 @@
   @override
   DartType visitAssignmentExpression(AssignmentExpression node) {
     if (childNode == node.rightHandSide) {
-      return node.leftHandSide.staticType;
+      if (node.operator.type == TokenType.EQ) {
+        return node.leftHandSide.staticType;
+      }
+      var method = node.staticElement;
+      if (method != null) {
+        var parameters = method.parameters;
+        if (parameters != null && parameters.isNotEmpty) {
+          return parameters[0].type;
+        }
+      }
     }
     return null;
   }
@@ -475,6 +493,14 @@
   }
 
   @override
+  DartType visitIsExpression(IsExpression node) {
+    if (childNode == node.type) {
+      return node.expression.staticType;
+    }
+    return null;
+  }
+
+  @override
   DartType visitListLiteral(ListLiteral node) {
     if (node.elements.contains(childNode)) {
       return (node.staticType as InterfaceType).typeArguments[0];
@@ -579,6 +605,17 @@
   }
 
   @override
+  DartType visitSwitchCase(SwitchCase node) {
+    if (childNode == node.expression) {
+      var parent = node.parent;
+      if (parent is SwitchStatement) {
+        return parent.expression?.staticType;
+      }
+    }
+    return super.visitSwitchCase(node);
+  }
+
+  @override
   DartType visitVariableDeclaration(VariableDeclaration node) {
     if (childNode == node.initializer) {
       var parent = node.parent;
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
index 76a64d3..7f034c3 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
@@ -64,7 +64,11 @@
         return;
       }
       await builder.addFileEdit(file, (DartFileEditBuilder builder) {
-        builder.addSimpleReplacement(range.node(type), 'var');
+        if (parent.isConst || parent.isFinal) {
+          builder.addDeletion(range.startStart(type, variables[0]));
+        } else {
+          builder.addSimpleReplacement(range.node(type), 'var');
+        }
         if (typeArgumentsText != null) {
           builder.addSimpleInsertion(typeArgumentsOffset, typeArgumentsText);
         }
@@ -81,7 +85,11 @@
         }
       }
       await builder.addFileEdit(file, (DartFileEditBuilder builder) {
-        builder.addSimpleReplacement(range.node(type), 'var');
+        if (parent.isConst || parent.isFinal) {
+          builder.addDeletion(range.startStart(type, parent.identifier));
+        } else {
+          builder.addSimpleReplacement(range.node(type), 'var');
+        }
         if (typeArgumentsText != null) {
           builder.addSimpleInsertion(typeArgumentsOffset, typeArgumentsText);
         }
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart
index 1517645..f2f2cf1 100644
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart
@@ -24,7 +24,6 @@
 
   @override
   void setUp() {
-    generateSummaryFiles = true;
     super.setUp();
     server.handlers = [
       AnalysisDomainHandler(server),
diff --git a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
index 3448021..d9b3a95 100644
--- a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
@@ -59,7 +59,6 @@
 
   @override
   void setUp() {
-    generateSummaryFiles = true;
     registerLintRules();
     super.setUp();
     server.handlers = [AnalysisDomainHandler(server)];
diff --git a/pkg/analysis_server/test/analysis/notification_analyzed_files_test.dart b/pkg/analysis_server/test/analysis/notification_analyzed_files_test.dart
index 724900e..4c14ff0 100644
--- a/pkg/analysis_server/test/analysis/notification_analyzed_files_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_analyzed_files_test.dart
@@ -49,7 +49,6 @@
 
   @override
   void setUp() {
-    generateSummaryFiles = true;
     super.setUp();
     createProject();
   }
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index 613fd20..db65a09 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -39,7 +39,6 @@
 
   @override
   void setUp() {
-    generateSummaryFiles = true;
     registerLintRules();
     super.setUp();
     server.handlers = [
diff --git a/pkg/analysis_server/test/analysis_abstract.dart b/pkg/analysis_server/test/analysis_abstract.dart
index e9f979d..f740aa1 100644
--- a/pkg/analysis_server/test/analysis_abstract.dart
+++ b/pkg/analysis_server/test/analysis_abstract.dart
@@ -39,7 +39,6 @@
 
 /// An abstract base for all 'analysis' domain tests.
 class AbstractAnalysisTest with ResourceProviderMixin {
-  bool generateSummaryFiles = false;
   MockServerChannel serverChannel;
   TestPluginManager pluginManager;
   AnalysisServer server;
@@ -113,9 +112,7 @@
     //
     // Create an SDK in the mock file system.
     //
-    MockSdk(
-        generateSummaryFiles: generateSummaryFiles,
-        resourceProvider: resourceProvider);
+    MockSdk(resourceProvider: resourceProvider);
     //
     // Create server
     //
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index 3788ce4..64a0fae 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -39,7 +39,7 @@
     newFolder('/bar');
     newFile('/foo/foo.dart', content: 'import "../bar/bar.dart";');
     var bar = newFile('/bar/bar.dart', content: 'library bar;');
-    server.setAnalysisRoots('0', ['/foo', '/bar'], [], {});
+    server.setAnalysisRoots('0', ['/foo', '/bar'], []);
     var subscriptions = <AnalysisService, Set<String>>{};
     for (var service in AnalysisService.VALUES) {
       subscriptions[service] = <String>{bar.path};
@@ -104,7 +104,7 @@
     newFile('/test/lib/a.dart', content: r'''
 class A {}
 ''');
-    server.setAnalysisRoots('0', [convertPath('/test')], [], {});
+    server.setAnalysisRoots('0', [convertPath('/test')], []);
 
     // Pump the event queue, so that the server has finished any analysis.
     await pumpEventQueue(times: 5000);
@@ -133,7 +133,7 @@
     server.serverServices.add(ServerService.STATUS);
 
     newFolder('/test');
-    server.setAnalysisRoots('0', [convertPath('/test')], [], {});
+    server.setAnalysisRoots('0', [convertPath('/test')], []);
 
     // Pump the event queue, so that the server has finished any analysis.
     await pumpEventQueue(times: 5000);
@@ -167,7 +167,7 @@
   exclude:
     - 'samples/**'
 ''');
-    server.setAnalysisRoots('0', [convertPath('/project')], [], {});
+    server.setAnalysisRoots('0', [convertPath('/project')], []);
     server.setAnalysisSubscriptions(<AnalysisService, Set<String>>{
       AnalysisService.NAVIGATION: <String>{path}
     });
@@ -188,7 +188,7 @@
   exclude:
     - 'samples/**'
 ''');
-    server.setAnalysisRoots('0', [convertPath('/project')], [], {});
+    server.setAnalysisRoots('0', [convertPath('/project')], []);
     server.setAnalysisSubscriptions(<AnalysisService, Set<String>>{
       AnalysisService.NAVIGATION: <String>{path}
     });
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 6758b54..7408c2e 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -64,7 +64,7 @@
     resourceProvider.newFile(join(subProjPath, 'pubspec.yaml'), 'contents');
     var subProjFilePath = join(subProjPath, 'file.dart');
     resourceProvider.newFile(subProjFilePath, 'contents');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // Make sure that there really are contexts for both the main project and
     // the subproject.
     var projectFolder = resourceProvider.getFolder(projPath);
@@ -116,7 +116,7 @@
     // NOTE that this is Not in our package path yet.
 
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
     // Confirm that one driver / context was created.
     var drivers = manager.getDriversInAnalysisRoot(projectFolder);
@@ -161,7 +161,7 @@
 sky_engine:lib/''');
     // Setup context.
 
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
     // Confirm that one context was created.
     var count = manager
@@ -185,8 +185,7 @@
     // set roots
     resourceProvider.newFolder(project);
     resourceProvider.newFolder(excludedFolder);
-    manager.setRoots(
-        <String>[project], <String>[excludedFolder], <String, String>{});
+    manager.setRoots(<String>[project], <String>[excludedFolder]);
     // verify
     expect(manager.isInAnalysisRoot(convertPath('$excludedFolder/test.dart')),
         isFalse);
@@ -198,7 +197,7 @@
     resourceProvider.newFile(join(subProjPath, 'pubspec.yaml'), 'contents');
     var subProjFilePath = join(subProjPath, 'file.dart');
     resourceProvider.newFile(subProjFilePath, 'contents');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // Make sure that there really is a context for the subproject.
     var subProjContextInfo = manager.getContextInfoFor(subProjFolder);
     expect(subProjContextInfo, isNotNull);
@@ -208,12 +207,12 @@
   }
 
   void test_isInAnalysisRoot_inRoot() {
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(manager.isInAnalysisRoot('$projPath/test.dart'), isTrue);
   }
 
   void test_isInAnalysisRoot_notInRoot() {
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(manager.isInAnalysisRoot('/test.dart'), isFalse);
   }
 
@@ -224,7 +223,7 @@
     // create a file in the "packages" folder
     var filePath1 = join(projPath, 'packages', 'file1.dart');
     var file1 = resourceProvider.newFile(filePath1, 'contents');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(callbacks.currentFilePaths, unorderedEquals([file1.path]));
     var filePath2 = join(projPath, 'packages', 'file2.dart');
     var file2 = resourceProvider.newFile(filePath2, 'contents');
@@ -237,7 +236,7 @@
   Future<void> test_path_filter() async {
     // Setup context.
     var root = resourceProvider.newFolder(projPath);
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(callbacks.currentFilePaths, isEmpty);
     // Set ignore patterns for context.
     var rootInfo = manager.getContextInfoFor(root);
@@ -264,7 +263,7 @@
     // create a context with a .packages file
     var packagespecFile = join(projPath, '.packages');
     resourceProvider.newFile(packagespecFile, '');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     return pumpEventQueue().then((_) {
       expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
       callbacks.now++;
@@ -288,7 +287,7 @@
     var packagespec2Path = join(subdir2Path, '.packages');
     resourceProvider.newFile(packagespec1Path, '');
     resourceProvider.newFile(packagespec2Path, '');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     return pumpEventQueue().then((_) {
       expect(callbacks.currentContextRoots,
           unorderedEquals([subdir1Path, subdir2Path, projPath]));
@@ -308,7 +307,7 @@
     // create a context with a pubspec.yaml file
     var pubspecPath = join(projPath, 'pubspec.yaml');
     resourceProvider.newFile(pubspecPath, 'pubspec');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     return pumpEventQueue().then((_) {
       expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
       callbacks.now++;
@@ -329,7 +328,7 @@
     var pubspec2Path = join(subdir2Path, 'pubspec.yaml');
     resourceProvider.newFile(pubspec1Path, 'pubspec');
     resourceProvider.newFile(pubspec2Path, 'pubspec');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     return pumpEventQueue().then((_) {
       expect(callbacks.currentContextRoots,
           unorderedEquals([subdir1Path, subdir2Path, projPath]));
@@ -356,7 +355,7 @@
     resourceProvider.newFile(pubspec2Path, 'pubspec2');
 
     var roots = <String>[projPath, proj2Path];
-    manager.setRoots(roots, <String>[], <String, String>{});
+    manager.setRoots(roots, <String>[]);
     return pumpEventQueue().then((_) {
       expect(callbacks.currentContextRoots, unorderedEquals(roots));
       var then = callbacks.now;
@@ -373,7 +372,7 @@
   void test_setRoots_addFolderWithDartFile() {
     var filePath = resourceProvider.pathContext.join(projPath, 'foo.dart');
     resourceProvider.newFile(filePath, 'contents');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     var filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
@@ -389,7 +388,7 @@
   void test_setRoots_addFolderWithDartFileInSubfolder() {
     var filePath = join(projPath, 'foo', 'bar.dart');
     resourceProvider.newFile(filePath, 'contents');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     var filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
@@ -399,7 +398,7 @@
   void test_setRoots_addFolderWithDummyLink() {
     var filePath = join(projPath, 'foo.dart');
     resourceProvider.newDummyLink(filePath);
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     expect(callbacks.currentFilePaths, isEmpty);
   }
@@ -414,7 +413,7 @@
     newFile('$examplePath/${ContextManagerImpl.PACKAGE_SPEC_NAME}');
     newFile('$examplePath/example.dart');
 
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     expect(callbacks.currentContextRoots, hasLength(2));
 
@@ -443,7 +442,7 @@
     newFile('$examplePath/${ContextManagerImpl.PUBSPEC_NAME}');
     newFile('$examplePath/example.dart');
 
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     expect(callbacks.currentContextRoots, hasLength(2));
 
@@ -460,7 +459,7 @@
   }
 
   void test_setRoots_addFolderWithoutPubspec() {
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
     expect(callbacks.currentFilePaths, hasLength(0));
@@ -475,7 +474,7 @@
     var mainFile = newFile('$libPath/main.dart');
     var source = mainFile.createSource();
 
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // verify
     expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
@@ -488,23 +487,10 @@
     expect(resolvedSource.fullName, convertPath('$testLib/unittest.dart'));
   }
 
-  void test_setRoots_addFolderWithPackagespecAndPackageRoot() {
-    // The package root should take priority.
-    var packagespecPath = join(projPath, '.packages');
-    var testLib = convertPath('/home/somebody/.pub/cache/unittest-0.9.9/lib');
-    var testLibUri = resourceProvider.pathContext.toUri(testLib);
-    resourceProvider.newFile(packagespecPath, 'unittest:$testLibUri');
-    var packageRootPath = '/package/root/';
-    manager.setRoots(<String>[projPath], <String>[],
-        <String, String>{projPath: packageRootPath});
-    expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
-    _checkPackageRoot(projPath, packageRootPath);
-  }
-
   void test_setRoots_addFolderWithPubspec() {
     var pubspecPath = join(projPath, 'pubspec.yaml');
     resourceProvider.newFile(pubspecPath, 'pubspec');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
     expect(callbacks.currentFilePaths, hasLength(0));
@@ -515,7 +501,7 @@
     var packagespecPath = join(projPath, '.packages');
     resourceProvider.newFile(pubspecPath, 'pubspec');
     resourceProvider.newFile(packagespecPath, '');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     callbacks.assertContextPaths([projPath]);
   }
@@ -534,7 +520,7 @@
     newFile('$srcPath/internal.dart');
     var testFilePath = newFile('$testPath/main_test.dart').path;
 
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     var sources = callbacks.currentFileSources(projPath);
 
     expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
@@ -565,7 +551,7 @@
     newFile(subProjectB_file, content: 'library b;');
 
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, subProjectA, subProjectB]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -594,7 +580,7 @@
     resourceProvider.newFile(subProjectA_file, 'library a;');
     resourceProvider.newFile(subProjectB_file, 'library b;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, projectA, projectB]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -614,38 +600,6 @@
         }));
   }
 
-  void test_setRoots_addPackageRoot() {
-    var packagePathFoo = convertPath('/package1/foo');
-    var packageRootPath = convertPath('/package2/foo');
-    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
-        content: 'foo:${toUriStr('/package1/foo')}');
-    var packageFolder = resourceProvider.newFolder(packagePathFoo);
-    var includedPaths = <String>[projPath];
-    var excludedPaths = <String>[];
-    manager.setRoots(includedPaths, excludedPaths, <String, String>{});
-    expect(
-        _currentPackageMap,
-        equals({
-          'foo': [packageFolder]
-        }));
-    manager.setRoots(includedPaths, excludedPaths,
-        <String, String>{projPath: packageRootPath});
-    _checkPackageRoot(projPath, equals(packageRootPath));
-  }
-
-  void test_setRoots_changePackageRoot() {
-    var packageRootPath1 = '/package1';
-    var packageRootPath2 = '/package2';
-    var includedPaths = <String>[projPath];
-    var excludedPaths = <String>[];
-    manager.setRoots(includedPaths, excludedPaths,
-        <String, String>{projPath: packageRootPath1});
-    _checkPackageRoot(projPath, equals(packageRootPath1));
-    manager.setRoots(includedPaths, excludedPaths,
-        <String, String>{projPath: packageRootPath2});
-    _checkPackageRoot(projPath, equals(packageRootPath2));
-  }
-
   void test_setRoots_exclude_newRoot_withExcludedFile() {
     // prepare paths
     var project = convertPath('/project');
@@ -655,7 +609,7 @@
     resourceProvider.newFile(file1, '// 1');
     resourceProvider.newFile(file2, '// 2');
     // set roots
-    manager.setRoots(<String>[project], <String>[file1], <String, String>{});
+    manager.setRoots(<String>[project], <String>[file1]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [file2]);
   }
@@ -671,7 +625,7 @@
     resourceProvider.newFile(fileA, 'library a;');
     resourceProvider.newFile(fileB, 'library b;');
     // set roots
-    manager.setRoots(<String>[project], <String>[folderB], <String, String>{});
+    manager.setRoots(<String>[project], <String>[folderB]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
   }
@@ -685,11 +639,11 @@
     resourceProvider.newFile(file1, '// 1');
     resourceProvider.newFile(file2, '// 2');
     // set roots
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [file1, file2]);
     // exclude "2"
-    manager.setRoots(<String>[project], <String>[file2], <String, String>{});
+    manager.setRoots(<String>[project], <String>[file2]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [file1]);
   }
@@ -705,11 +659,11 @@
     resourceProvider.newFile(fileA, 'library a;');
     resourceProvider.newFile(fileB, 'library b;');
     // initially both "aaa/a" and "bbb/b" are included
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA, fileB]);
     // exclude "bbb/"
-    manager.setRoots(<String>[project], <String>[folderB], <String, String>{});
+    manager.setRoots(<String>[project], <String>[folderB]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
   }
@@ -723,11 +677,11 @@
     resourceProvider.newFile(file1, '// 1');
     resourceProvider.newFile(file2, '// 2');
     // set roots
-    manager.setRoots(<String>[project], <String>[file2], <String, String>{});
+    manager.setRoots(<String>[project], <String>[file2]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [file1]);
     // stop excluding "2"
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [file1, file2]);
   }
@@ -741,11 +695,11 @@
     resourceProvider.newFile(file1, '// 1');
     resourceProvider.newFile(file2, '// 2');
     // set roots
-    manager.setRoots(<String>[project], <String>[file2], <String, String>{});
+    manager.setRoots(<String>[project], <String>[file2]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [file1]);
     // stop excluding "2"
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [file1, file2]);
   }
@@ -761,11 +715,11 @@
     resourceProvider.newFile(fileA, 'library a;');
     resourceProvider.newFile(fileB, 'library b;');
     // exclude "bbb/"
-    manager.setRoots(<String>[project], <String>[folderB], <String, String>{});
+    manager.setRoots(<String>[project], <String>[folderB]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
     // stop excluding "bbb/"
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA, fileB]);
   }
@@ -778,7 +732,7 @@
     resourceProvider.newFile(fileA, '');
     resourceProvider.newFile(fileB, '');
     resourceProvider.newFile(fileC, '');
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA, fileB]);
   }
@@ -791,8 +745,7 @@
     // create files
     resourceProvider.newFile(projectPubspec, 'name: project');
     resourceProvider.newFile(examplePubspec, 'name: example');
-    manager
-        .setRoots(<String>[example, project], <String>[], <String, String>{});
+    manager.setRoots(<String>[example, project], <String>[]);
     // verify
     {
       var rootInfo = manager.rootInfo;
@@ -818,8 +771,7 @@
     // create files
     resourceProvider.newFile(projectPubspec, 'name: project');
     resourceProvider.newFolder(example);
-    manager
-        .setRoots(<String>[project, example], <String>[], <String, String>{});
+    manager.setRoots(<String>[project, example], <String>[]);
     // verify
     {
       var rootInfo = manager.rootInfo;
@@ -841,8 +793,7 @@
     // create files
     resourceProvider.newFile(projectPubspec, 'name: project');
     resourceProvider.newFile(examplePubspec, 'name: example');
-    manager
-        .setRoots(<String>[project, example], <String>[], <String, String>{});
+    manager.setRoots(<String>[project, example], <String>[]);
     // verify
     {
       var rootInfo = manager.rootInfo;
@@ -861,19 +812,12 @@
     expect(callbacks.currentContextRoots, unorderedEquals([project, example]));
   }
 
-  void test_setRoots_newFolderWithPackageRoot() {
-    var packageRootPath = '/package';
-    manager.setRoots(<String>[projPath], <String>[],
-        <String, String>{projPath: packageRootPath});
-    _checkPackageRoot(projPath, equals(packageRootPath));
-  }
-
   void test_setRoots_newlyAddedFoldersGetProperPackageMap() {
     var packagePath = convertPath('/package/foo');
     newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
         content: 'foo:${toUriStr('/package/foo')}');
     var packageFolder = resourceProvider.newFolder(packagePath);
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(
         _currentPackageMap,
         equals({
@@ -889,15 +833,14 @@
     // create files
     resourceProvider.newFile(excludedPubspec, 'name: ignore-me');
     // set "/project", and exclude "/project/excluded"
-    manager.setRoots(
-        <String>[project], <String>[excludedFolder], <String, String>{});
+    manager.setRoots(<String>[project], <String>[excludedFolder]);
     callbacks.assertContextPaths([project]);
   }
 
   void test_setRoots_noContext_inDotFolder() {
     var pubspecPath = join(projPath, '.pub', 'pubspec.yaml');
     resourceProvider.newFile(pubspecPath, 'name: test');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     expect(callbacks.currentContextRoots, hasLength(1));
     expect(callbacks.currentContextRoots, contains(projPath));
@@ -909,7 +852,7 @@
     newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
         content: 'foo:lib/');
     resourceProvider.newFile(filePath, 'contents');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     var drivers =
         manager.getDriversInAnalysisRoot(resourceProvider.newFolder(projPath));
@@ -922,7 +865,7 @@
   void test_setRoots_packagesFolder_hasContext() {
     var pubspecPath = join(projPath, 'packages', 'pubspec.yaml');
     resourceProvider.newFile(pubspecPath, 'name: test');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // verify
     expect(callbacks.currentContextRoots, hasLength(2));
     expect(callbacks.currentContextRoots, contains(projPath));
@@ -937,17 +880,17 @@
     var fileB = convertPath('$project/.pub/bar.dart');
     resourceProvider.newFile(fileA, '');
     resourceProvider.newFile(fileB, '');
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
   }
 
   void test_setRoots_removeFolderWithoutPubspec() {
     // add one root - there is a context
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(callbacks.currentContextRoots, hasLength(1));
     // set empty roots - no contexts
-    manager.setRoots(<String>[], <String>[], <String, String>{});
+    manager.setRoots(<String>[], <String>[]);
     expect(callbacks.currentContextRoots, hasLength(0));
     expect(callbacks.currentFilePaths, hasLength(0));
   }
@@ -957,11 +900,11 @@
     var pubspecPath = join(projPath, '.packages');
     resourceProvider.newFile(pubspecPath, '');
     // add one root - there is a context
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(manager.changeSubscriptions, hasLength(1));
     expect(callbacks.currentContextRoots, hasLength(1));
     // set empty roots - no contexts
-    manager.setRoots(<String>[], <String>[], <String, String>{});
+    manager.setRoots(<String>[], <String>[]);
     expect(manager.changeSubscriptions, hasLength(0));
     expect(callbacks.currentContextRoots, hasLength(0));
     expect(callbacks.currentFilePaths, hasLength(0));
@@ -987,8 +930,7 @@
     resourceProvider.newFile(subProjectA_file, '// sub-a');
     resourceProvider.newFile(subProjectB_file, '// sub-b');
     // set roots
-    manager
-        .setRoots(<String>[projectA, projectB], <String>[], <String, String>{});
+    manager.setRoots(<String>[projectA, projectB], <String>[]);
     callbacks
         .assertContextPaths([projectA, subProjectA, projectB, subProjectB]);
     callbacks.assertContextFiles(projectA, [projectA_file]);
@@ -996,7 +938,7 @@
     callbacks.assertContextFiles(subProjectA, [subProjectA_file]);
     callbacks.assertContextFiles(subProjectB, [subProjectB_file]);
     // remove "projectB"
-    manager.setRoots(<String>[projectA], <String>[], <String, String>{});
+    manager.setRoots(<String>[projectA], <String>[]);
     callbacks.assertContextPaths([projectA, subProjectA]);
     callbacks.assertContextFiles(projectA, [projectA_file]);
     callbacks.assertContextFiles(subProjectA, [subProjectA_file]);
@@ -1007,10 +949,10 @@
     var pubspecPath = join(projPath, 'pubspec.yaml');
     resourceProvider.newFile(pubspecPath, 'pubspec');
     // add one root - there is a context
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     expect(callbacks.currentContextRoots, hasLength(1));
     // set empty roots - no contexts
-    manager.setRoots(<String>[], <String>[], <String, String>{});
+    manager.setRoots(<String>[], <String>[]);
     expect(callbacks.currentContextRoots, hasLength(0));
     expect(callbacks.currentFilePaths, hasLength(0));
   }
@@ -1035,8 +977,7 @@
     resourceProvider.newFile(subProjectA_file, '// sub-a');
     resourceProvider.newFile(subProjectB_file, '// sub-b');
     // set roots
-    manager
-        .setRoots(<String>[projectA, projectB], <String>[], <String, String>{});
+    manager.setRoots(<String>[projectA, projectB], <String>[]);
     callbacks
         .assertContextPaths([projectA, subProjectA, projectB, subProjectB]);
     callbacks.assertContextFiles(projectA, [projectA_file]);
@@ -1044,31 +985,12 @@
     callbacks.assertContextFiles(subProjectA, [subProjectA_file]);
     callbacks.assertContextFiles(subProjectB, [subProjectB_file]);
     // remove "projectB"
-    manager.setRoots(<String>[projectA], <String>[], <String, String>{});
+    manager.setRoots(<String>[projectA], <String>[]);
     callbacks.assertContextPaths([projectA, subProjectA]);
     callbacks.assertContextFiles(projectA, [projectA_file]);
     callbacks.assertContextFiles(subProjectA, [subProjectA_file]);
   }
 
-  void test_setRoots_removePackageRoot() {
-    var packagePathFoo = convertPath('/package1/foo');
-    var packageRootPath = convertPath('/package2/foo');
-    var packageFolder = resourceProvider.newFolder(packagePathFoo);
-    newFile('$projPath/${ContextManagerImpl.PACKAGE_SPEC_NAME}',
-        content: 'foo:${toUriStr('/package1/foo')}');
-    var includedPaths = <String>[projPath];
-    var excludedPaths = <String>[];
-    manager.setRoots(includedPaths, excludedPaths,
-        <String, String>{projPath: packageRootPath});
-    _checkPackageRoot(projPath, equals(packageRootPath));
-    manager.setRoots(includedPaths, excludedPaths, <String, String>{});
-    expect(
-        _currentPackageMap,
-        equals({
-          'foo': [packageFolder]
-        }));
-  }
-
   void test_setRoots_rootPathContainsDotFile() {
     // If the path to the context root itself contains a folder whose name
     // begins with '.', then that is not sufficient to cause any files in the
@@ -1076,13 +998,13 @@
     var project = convertPath('/.pub/project');
     var fileA = convertPath('$project/foo.dart');
     resourceProvider.newFile(fileA, '');
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
   }
 
   Future<void> test_watch_addDummyLink() {
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // empty folder initially
     expect(callbacks.currentFilePaths, isEmpty);
     // add link
@@ -1095,7 +1017,7 @@
   }
 
   Future<void> test_watch_addFile() {
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // empty folder initially
     expect(callbacks.currentFilePaths, hasLength(0));
     // add file
@@ -1119,7 +1041,7 @@
     // create files
     resourceProvider.newFile(fileA, 'library a;');
     // set roots
-    manager.setRoots(<String>[project], <String>[folderB], <String, String>{});
+    manager.setRoots(<String>[project], <String>[folderB]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
     // add a file, ignored as excluded
@@ -1138,7 +1060,7 @@
     // create files
     resourceProvider.newFile(fileA, '');
     // set roots
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
     // add a "lib/doc" file, it is not ignored
@@ -1157,7 +1079,7 @@
     // create files
     resourceProvider.newFile(fileA, '');
     // set roots
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
     // add a "doc" file, it is ignored
@@ -1175,7 +1097,7 @@
     var fileA = convertPath('$project/foo.dart');
     var fileB = convertPath('$project/.pub/bar.dart');
     resourceProvider.newFile(fileA, '');
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
     resourceProvider.newFile(fileB, '');
@@ -1191,7 +1113,7 @@
     var fileA = convertPath('$project/foo.dart');
     var fileB = convertPath('$project/bar/baz.dart');
     resourceProvider.newFile(fileA, '');
-    manager.setRoots(<String>[project], <String>[], <String, String>{});
+    manager.setRoots(<String>[project], <String>[]);
     callbacks.assertContextPaths([project]);
     callbacks.assertContextFiles(project, [fileA]);
     resourceProvider.newFile(fileB, '');
@@ -1201,7 +1123,7 @@
   }
 
   Future<void> test_watch_addFileInSubfolder() {
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // empty folder initially
     expect(callbacks.currentFilePaths, hasLength(0));
     // add file in subfolder
@@ -1223,7 +1145,7 @@
     // create files
     resourceProvider.newFile(rootFile, 'library root;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -1248,7 +1170,7 @@
     resourceProvider.newFile(rootFile, 'library root;');
     resourceProvider.newFile(subFile, 'library a;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile, subFile]);
@@ -1274,7 +1196,7 @@
     resourceProvider.newFile(subPubspec, '');
     resourceProvider.newFile(subFile, 'library sub;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, subProject]);
     callbacks.assertContextFiles(root, [rootFile]);
     callbacks.assertContextFiles(subProject, [subFile]);
@@ -1300,7 +1222,7 @@
     resourceProvider.newFile(rootFile, 'library root;');
     resourceProvider.newFile(subFile, 'library a;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, subProject]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -1324,7 +1246,7 @@
     // create files
     resourceProvider.newFile(rootFile, 'library root;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -1347,7 +1269,7 @@
     resourceProvider.newFile(rootFile, 'library root;');
     resourceProvider.newFile(subFile, 'library a;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile, subFile]);
@@ -1373,7 +1295,7 @@
     resourceProvider.newFile(subPubspec, 'pubspec');
     resourceProvider.newFile(subFile, 'library sub;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, subProject]);
     callbacks.assertContextFiles(root, [rootFile]);
     callbacks.assertContextFiles(subProject, [subFile]);
@@ -1391,7 +1313,7 @@
     // add root with a file
     var file = resourceProvider.newFile(filePath, 'contents');
     var projFolder = file.parent;
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // the file was added
     var filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
@@ -1412,7 +1334,7 @@
     // add root with a file
     var file = resourceProvider.newFile(filePath, 'contents');
     var projFolder = file.parent;
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // the file was added
     var filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
@@ -1437,7 +1359,7 @@
     resourceProvider.newFile(rootPubspec, '');
     resourceProvider.newFile(rootFile, 'library root;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root]);
     callbacks.assertContextFiles(root, [rootFile]);
     // delete the pubspec
@@ -1460,7 +1382,7 @@
     resourceProvider.newFile(rootFile, 'library root;');
     resourceProvider.newFile(subFile, 'library a;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, subProject]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -1497,7 +1419,7 @@
     resourceProvider.newFile(rootFile, 'library root;');
     resourceProvider.newFile(subFile, 'library a;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, subProject]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -1520,7 +1442,7 @@
     resourceProvider.newFile(rootPubspec, 'pubspec');
     resourceProvider.newFile(rootFile, 'library root;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root]);
     callbacks.assertContextFiles(root, [rootFile]);
     // delete the pubspec
@@ -1543,7 +1465,7 @@
     resourceProvider.newFile(rootFile, 'library root;');
     resourceProvider.newFile(subFile, 'library a;');
     // set roots
-    manager.setRoots(<String>[root], <String>[], <String, String>{});
+    manager.setRoots(<String>[root], <String>[]);
     callbacks.assertContextPaths([root, subProject]);
     // verify files
     callbacks.assertContextFiles(root, [rootFile]);
@@ -1560,7 +1482,7 @@
     var filePath = join(projPath, 'foo.dart');
     // add root with a file
     resourceProvider.newFile(filePath, 'contents');
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // the file was added
     var filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
@@ -1581,7 +1503,7 @@
     resourceProvider.newFile(packagesPath, '');
     resourceProvider.newFile(filePath, 'library main;');
 
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     var filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
@@ -1596,18 +1518,6 @@
       expect(_currentPackageMap.keys, unorderedEquals(['main']));
     });
   }
-
-  /// Verify that package URI's for source files in [path] will be resolved
-  /// using a package root matching [expectation].
-  void _checkPackageRoot(String path, expectation) {
-    // TODO(brianwilkerson) Figure out how to test this. Possibly by comparing
-    // the contents of the package map (although that approach doesn't work at
-    // the moment).
-//    FolderDisposition disposition = callbacks.currentContextDispositions[path];
-//    expect(disposition.packageRoot, expectation);
-    // TODO(paulberry): we should also verify that the package map itself is
-    // correct.  See dartbug.com/23909.
-  }
 }
 
 abstract class ContextManagerTest with ResourceProviderMixin {
@@ -1684,7 +1594,7 @@
     projPath = convertPath('/my/proj');
     resourceProvider.newFolder(projPath);
     // Create an SDK in the mock file system.
-    MockSdk(generateSummaryFiles: true, resourceProvider: resourceProvider);
+    MockSdk(resourceProvider: resourceProvider);
     var sdkManager = DartSdkManager(convertPath('/sdk'), true);
     manager = ContextManagerImpl(
         resourceProvider,
@@ -1728,7 +1638,7 @@
 ''');
 
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
 
     // Verify options were set.
@@ -1776,7 +1686,7 @@
 ''');
 
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
 
     // Verify options were set.
@@ -1815,7 +1725,7 @@
     - camel_case_types
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
     // Verify options were set.
     expect(errorProcessors, hasLength(1));
@@ -1848,7 +1758,7 @@
 include: package:boo/other_options.yaml
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
     // Verify options were set.
     expect(errorProcessors, hasLength(1));
@@ -1870,7 +1780,7 @@
 ;
 ''').path;
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // Check that an error was produced.
     TestNotificationManager notificationManager = callbacks.notificationManager;
@@ -1883,7 +1793,7 @@
     newFile('$projPath/$optionsFileName');
 
     // Add the root.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
 
     // Remove the root, with the analysis options file.
@@ -1935,7 +1845,7 @@
 ''');
 
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
 
     // Confirm that one context was created.
@@ -1987,7 +1897,7 @@
     unused_local_variable: ignore
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // Verify filter setup.
     expect(errorProcessors, hasLength(1));
@@ -2003,7 +1913,7 @@
     unused_local_variable: error
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // Verify filter setup.
     expect(errorProcessors, hasLength(2));
@@ -2021,7 +1931,7 @@
     ambiguous_import: false
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // Verify filter setup.
     expect(errorProcessors, isNotNull);
@@ -2036,7 +1946,7 @@
 #    unused_local_variable: ignore
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // Verify filter setup.
     expect(errorProcessors, isEmpty);
@@ -2044,7 +1954,7 @@
 
   Future<void> test_non_analyzable_files_not_considered() async {
     // Set up project and get a reference to the driver.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     var projectFolder = resourceProvider.newFolder(projPath);
     var drivers = manager.getDriversInAnalysisRoot(projectFolder);
     expect(drivers, hasLength(1));
@@ -2083,7 +1993,7 @@
   strong-mode: false
 ''');
     // Create the context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     await pumpEventQueue();
 
     var result = await callbacks.currentDriver.getResult(file.path);
@@ -2136,7 +2046,7 @@
     - 'sdk_ext/**'
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // Verify that analysis options was parsed and the ignore patterns applied.
     var projectFolder = resourceProvider.newFolder(projPath);
@@ -2169,7 +2079,7 @@
     - 'other_lib'
 ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     // Verify that the context in other_lib wasn't created and that the
     // context in lib was created.
     var projectFolder = resourceProvider.newFolder(projPath);
@@ -2200,7 +2110,7 @@
     - 'other_lib/**'
   ''');
     // Setup context.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     // Verify that the context in other_lib wasn't created and that the
     // context in lib was created.
@@ -2231,7 +2141,7 @@
     - 'other_lib/*'
 ''');
     // Setup context / driver.
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
 
     var projectFolder = resourceProvider.newFolder(projPath);
     var drivers = manager.getDriversInAnalysisRoot(projectFolder);
@@ -2253,8 +2163,7 @@
   exclude:
     - 'example'
 ''');
-    manager
-        .setRoots(<String>[project, example], <String>[], <String, String>{});
+    manager.setRoots(<String>[project, example], <String>[]);
     // verify
     {
       var rootInfo = manager.rootInfo;
@@ -2287,7 +2196,7 @@
   exclude:
     - 'b**'
 ''');
-    manager.setRoots(<String>[a, c], <String>[], <String, String>{});
+    manager.setRoots(<String>[a, c], <String>[]);
     // verify
     {
       var rootInfo = manager.rootInfo;
@@ -2309,7 +2218,7 @@
 
   Future<void> test_watchEvents() async {
     var libPath = newFolder('$projPath/${ContextManagerTest.LIB_NAME}').path;
-    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    manager.setRoots(<String>[projPath], <String>[]);
     newFile('$libPath/main.dart');
     await Future.delayed(Duration(milliseconds: 1));
     expect(callbacks.watchEvents, hasLength(1));
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 7ea4141..0d9c790 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -266,7 +266,7 @@
     // TODO(brianwilkerson) Re-enable this test if we re-enable the
     // analysis.getReachableSources request.
     newFile('/project/a.dart', content: 'import "b.dart";');
-    server.setAnalysisRoots('0', ['/project/'], [], {});
+    server.setAnalysisRoots('0', ['/project/'], []);
 
     await server.onAnalysisComplete;
 
@@ -284,7 +284,7 @@
     var fileA = newFile('/project/a.dart', content: 'import "b.dart";').path;
     newFile('/project/b.dart');
 
-    server.setAnalysisRoots('0', ['/project/'], [], {});
+    server.setAnalysisRoots('0', ['/project/'], []);
 
     await server.onAnalysisComplete;
 
diff --git a/pkg/analysis_server/test/domain_diagnostic_test.dart b/pkg/analysis_server/test/domain_diagnostic_test.dart
index 1bed1c5..7fe3a38 100644
--- a/pkg/analysis_server/test/domain_diagnostic_test.dart
+++ b/pkg/analysis_server/test/domain_diagnostic_test.dart
@@ -19,7 +19,6 @@
 class DiagnosticDomainTest extends AbstractAnalysisTest {
   @override
   void setUp() {
-    generateSummaryFiles = true;
     super.setUp();
     handler = DiagnosticDomainHandler(server);
     server.handlers = [handler];
@@ -29,7 +28,7 @@
     newFile('/project/pubspec.yaml', content: 'name: project');
     newFile('/project/bin/test.dart', content: 'main() {}');
 
-    server.setAnalysisRoots('0', [convertPath('/project')], [], {});
+    server.setAnalysisRoots('0', [convertPath('/project')], []);
 
     await server.onAnalysisComplete;
 
diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
index 0b7be3b..744785a 100644
--- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart
+++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart
@@ -479,14 +479,6 @@
   ///   A mapping from source directories to package roots that should override
   ///   the normal package: URI resolution mechanism.
   ///
-  ///   If a package root is a directory, then the analyzer will behave as
-  ///   though the associated source directory in the map contains a special
-  ///   pubspec.yaml file which resolves any package: URI to the corresponding
-  ///   path within that package root directory. The effect is the same as
-  ///   specifying the package root directory as a "--package_root" parameter
-  ///   to the Dart VM when executing any Dart file inside the source
-  ///   directory.
-  ///
   ///   If a package root is a file, then the analyzer will behave as though
   ///   that file is a ".packages" file in the source directory. The effect is
   ///   the same as specifying the file as a "--packages" parameter to the Dart
diff --git a/pkg/analysis_server/test/lsp/format_test.dart b/pkg/analysis_server/test/lsp/format_test.dart
index 5653d51..7991558 100644
--- a/pkg/analysis_server/test/lsp/format_test.dart
+++ b/pkg/analysis_server/test/lsp/format_test.dart
@@ -87,7 +87,7 @@
 
     await expectLater(
       // Add some invalid path characters to the end of a valid file:// URI.
-      formatDocument(mainFileUri.toString() + '***'),
+      formatDocument(mainFileUri.toString() + '***.dart'),
       throwsA(isResponseError(ServerErrorCodes.InvalidFilePath)),
     );
   }
@@ -96,7 +96,7 @@
     await initialize();
 
     await expectLater(
-      formatDocument('a:/a.a'),
+      formatDocument('a:/a.dart'),
       throwsA(isResponseError(ServerErrorCodes.InvalidFilePath)),
     );
   }
diff --git a/pkg/analysis_server/test/lsp/initialization_test.dart b/pkg/analysis_server/test/lsp/initialization_test.dart
index 2d132bb..0a54c4f 100644
--- a/pkg/analysis_server/test/lsp/initialization_test.dart
+++ b/pkg/analysis_server/test/lsp/initialization_test.dart
@@ -219,15 +219,6 @@
           .having((r) => r.method, 'method', 'textDocument/foldingRange')
           .having((r) => r.id, 'id', registrationIdForFolding)),
     );
-
-    // Renaming documents is a Dart-specific service that should not have been
-    // affected by the plugin change.
-    final registrationIdForRename =
-        registrations.singleWhere((r) => r.method == 'textDocument/rename').id;
-    expect(
-        unregistrations,
-        isNot(contains(isA<Unregistration>()
-            .having((r) => r.id, 'id', registrationIdForRename))));
   }
 
   Future<void> test_dynamicRegistration_updatesWithPlugins() async {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart b/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart
index 08fa570..4d4ad88 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/replace_with_var_test.dart
@@ -57,6 +57,23 @@
 ''');
   }
 
+  Future<void> test_forEach_final() async {
+    await resolveTestUnit('''
+void f(List<int> list) {
+  for (final int i in list) {
+    print(i);
+  }
+}
+''');
+    await assertHasFix('''
+void f(List<int> list) {
+  for (final i in list) {
+    print(i);
+  }
+}
+''');
+  }
+
   Future<void> test_generic_instanceCreation_withArguments() async {
     await resolveTestUnit('''
 C<int> f() {
@@ -160,4 +177,34 @@
 }
 ''');
   }
+
+  Future<void> test_simple_const() async {
+    await resolveTestUnit('''
+String f() {
+  const String s = '';
+  return s;
+}
+''');
+    await assertHasFix('''
+String f() {
+  const s = '';
+  return s;
+}
+''');
+  }
+
+  Future<void> test_simple_final() async {
+    await resolveTestUnit('''
+String f() {
+  final String s = '';
+  return s;
+}
+''');
+    await assertHasFix('''
+String f() {
+  final s = '';
+  return s;
+}
+''');
+  }
 }
diff --git a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
index a32b546..5139b42 100644
--- a/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
+++ b/pkg/analysis_server/tool/completion_metrics/completion_metrics.dart
@@ -37,10 +37,12 @@
 import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/services/available_declarations.dart';
+import 'package:analyzer_plugin/src/utilities/completion/optype.dart';
 import 'package:args/args.dart';
 import 'package:meta/meta.dart';
 
 import 'metrics_util.dart';
+import 'output_utilities.dart';
 import 'visitors.dart';
 
 Future<void> main(List<String> args) async {
@@ -209,6 +211,8 @@
   MeanReciprocalRankComputer topLevelMrrComputer =
       MeanReciprocalRankComputer('non-type member completions');
 
+  Map<String, MeanReciprocalRankComputer> locationMmrComputers = {};
+
   ArithmeticMeanComputer charsBeforeTop =
       ArithmeticMeanComputer('chars_before_top');
 
@@ -277,19 +281,28 @@
 
   /// Record the MMR for the [result].
   void _recordMmr(CompletionResult result) {
-    var place = result.place;
-    successfulMrrComputer.addRank(place.rank);
+    var rank = result.place.rank;
+    // Record globally.
+    successfulMrrComputer.addRank(rank);
+    // Record by group.
     switch (result.group) {
       case CompletionGroup.instanceMember:
-        instanceMemberMrrComputer.addRank(place.rank);
+        instanceMemberMrrComputer.addRank(rank);
         break;
       case CompletionGroup.staticMember:
-        staticMemberMrrComputer.addRank(place.rank);
+        staticMemberMrrComputer.addRank(rank);
         break;
       case CompletionGroup.topLevel:
-        topLevelMrrComputer.addRank(place.rank);
+        topLevelMrrComputer.addRank(rank);
         break;
     }
+    // Record by completion location.
+    var location = result.completionLocation;
+    if (location != null) {
+      var computer = locationMmrComputers.putIfAbsent(
+          location, () => MeanReciprocalRankComputer(location));
+      computer.addRank(rank);
+    }
   }
 
   /// If the [result] is took longer than any previously recorded results,
@@ -413,6 +426,7 @@
       CompletionRequestImpl request,
       MetricsSuggestionListener listener,
       ExpectedCompletion expectedCompletion,
+      String completionLocation,
       List<protocol.CompletionSuggestion> suggestions,
       CompletionMetrics metrics,
       int elapsedMS,
@@ -431,7 +445,7 @@
       metrics.completionCounter.count('successful');
 
       metrics.recordCompletionResult(CompletionResult(place, request, listener,
-          suggestions, expectedCompletion, elapsedMS));
+          suggestions, expectedCompletion, completionLocation, elapsedMS));
 
       var charsBeforeTop =
           _computeCharsBeforeTop(expectedCompletion, suggestions);
@@ -501,6 +515,21 @@
     metrics.topLevelMrrComputer.printMean();
     print('');
 
+    var table = <List<String>>[];
+    var computerMap = metrics.locationMmrComputers;
+    var locations = computerMap.keys.toList()..sort();
+    table.add(['Location', 'count', 'mmr', 'mmr_5']);
+    for (var location in locations) {
+      var computer = computerMap[location];
+      var mmr = (1 / computer.mrr).toStringAsFixed(3);
+      var mrr_5 = (1 / computer.mrr_5).toStringAsFixed(3);
+      table.add([computer.name, computer.count.toString(), mmr, mrr_5]);
+    }
+    var buffer = StringBuffer();
+    buffer.writeTable(table);
+    print(buffer.toString());
+    print('');
+
     metrics.charsBeforeTop.printMean();
     metrics.charsBeforeTopFive.printMean();
     metrics.insertionLengthTheoretical.printMean();
@@ -742,6 +771,11 @@
                 useNewRelevance,
                 CompletionPerformance(),
               );
+              var directiveInfo = DartdocDirectiveInfo();
+              var dartRequest =
+                  await DartCompletionRequestImpl.from(request, directiveInfo);
+              var opType =
+                  OpType.forCompletion(dartRequest.target, request.offset);
               var suggestions = await _computeCompletionSuggestions(listener,
                   request, declarationsTracker, availableSuggestionsParams);
               stopwatch.stop();
@@ -750,6 +784,7 @@
                   request,
                   listener,
                   expectedCompletion,
+                  opType.completionLocation,
                   suggestions,
                   metrics,
                   stopwatch.elapsedMilliseconds,
@@ -936,13 +971,15 @@
 
   final ExpectedCompletion expectedCompletion;
 
+  final String completionLocation;
+
   final int elapsedMS;
 
   CompletionResult(this.place, this.request, this.listener, this.suggestions,
-      this.expectedCompletion, this.elapsedMS);
+      this.expectedCompletion, this.completionLocation, this.elapsedMS);
 
-  /// Return `true` if the [element] is an instance member of a class or
-  /// extension.
+  /// Return the completion group for the location at which completion was
+  /// requested.
   CompletionGroup get group {
     var element = _getElement(expectedCompletion.syntacticEntity);
     if (element != null) {
diff --git a/pkg/analysis_server/tool/completion_metrics/output_utilities.dart b/pkg/analysis_server/tool/completion_metrics/output_utilities.dart
new file mode 100644
index 0000000..00ed748
--- /dev/null
+++ b/pkg/analysis_server/tool/completion_metrics/output_utilities.dart
@@ -0,0 +1,69 @@
+// 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 'dart:math' as math;
+
+extension OutputUtilities on StringSink {
+  /// Write the given [table].
+  ///
+  /// The table is represented as a list or rows, where each row is a list of
+  /// the contents of the cells in that row.
+  ///
+  /// Throws an [ArgumentError] if the table is empty or if the rows do not
+  /// contain the same number of cells.
+  void writeTable(List<List<String>> table) {
+    var columnWidths = _computeColumnWidths(table);
+    for (var row in table) {
+      var lastNonEmpty = row.length - 1;
+      while (lastNonEmpty > 0) {
+        if (row[lastNonEmpty].isNotEmpty) {
+          break;
+        }
+        lastNonEmpty--;
+      }
+      for (var i = 0; i <= lastNonEmpty; i++) {
+        var cellContent = row[i];
+        var columnWidth = columnWidths[i];
+        var padding = columnWidth - cellContent.length;
+        write(cellContent);
+        if (i < lastNonEmpty) {
+          write(' ' * (padding + 2));
+        }
+      }
+      writeln();
+    }
+  }
+
+  /// Return the minimum widths for each of the columns in the given [table].
+  ///
+  /// The table is represented as a list or rows, where each row is a list of
+  /// the contents of the cells in that row.
+  ///
+  /// Throws an [ArgumentError] if the table is empty or if the rows do not
+  /// contain the same number of cells.
+  List<int> _computeColumnWidths(List<List<String>> table) {
+    if (table.isEmpty) {
+      throw ArgumentError('table cannot be empty');
+    }
+    var columnCount = table[0].length;
+    if (columnCount == 0) {
+      throw ArgumentError('rows cannot be empty');
+    }
+    var columnWidths = List<int>.filled(columnCount, 0);
+    for (var row in table) {
+      var rowLength = row.length;
+      if (rowLength > 0) {
+        if (rowLength != columnCount) {
+          throw ArgumentError(
+              'non-empty rows must contain the same number of columns');
+        }
+        for (var i = 0; i < rowLength; i++) {
+          var cellWidth = row[i].length;
+          columnWidths[i] = math.max(columnWidths[i], cellWidth);
+        }
+      }
+    }
+    return columnWidths;
+  }
+}
diff --git a/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart b/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart
index ceb6dd8..c2d60c6 100644
--- a/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart
+++ b/pkg/analysis_server/tool/completion_metrics/relevance_metrics.dart
@@ -3,7 +3,6 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:convert';
 import 'dart:io' as io;
 import 'dart:math' as math;
 
@@ -38,6 +37,8 @@
 import 'package:args/args.dart';
 import 'package:meta/meta.dart';
 
+import 'output_utilities.dart';
+
 /// Compute metrics to determine whether they should be used to compute a
 /// relevance score for completion suggestions.
 Future<void> main(List<String> args) async {
@@ -146,24 +147,12 @@
   /// with the same lexeme to the number of times that distance was found.
   Map<int, int> tokenDistances = {};
 
+  /// A table mapping percentage data names to the percentage data collected.
+  Map<String, _PercentageData> percentageData = {};
+
   /// Initialize a newly created set of relevance data to be empty.
   RelevanceData();
 
-  /// Initialize a newly created set of relevance data to reflect the data in
-  /// the given JSON encoded [content].
-  RelevanceData.fromJson(String content) {
-    _initializeFromJson(content);
-  }
-
-  /// Add the data from the given relevance [data] to this set of data.
-  void addDataFrom(RelevanceData data) {
-    _addToMap(byDistance, data.byDistance);
-    _addToMap(byElementKind, data.byElementKind);
-    _addToMap(byTokenType, data.byTokenType);
-    _addToMap(byTypeMatch, data.byTypeMatch);
-    _addToMap(distanceByDepthMap, distanceByDepthMap);
-  }
-
   /// Increment the count associated with the given [name] by one.
   void incrementCount(String name) {
     simpleCounts[name] = (simpleCounts[name] ?? 0) + 1;
@@ -198,6 +187,14 @@
     identifierLengths[length] = (identifierLengths[length] ?? 0) + 1;
   }
 
+  /// Record that a data point for the percentage data with the given [name] was
+  /// found. If [wasPositive] is `true` then the data point is a positive data
+  /// point.
+  void recordPercentage(String name, bool wasPositive) {
+    var data = percentageData.putIfAbsent(name, () => _PercentageData());
+    data.addDataPoint(wasPositive);
+  }
+
   /// Record information about the distance between recurring tokens.
   void recordTokenStream(int distance) {
     tokenDistances[distance] = (tokenDistances[distance] ?? 0) + 1;
@@ -216,95 +213,6 @@
     var contextMap = byTypeMatch.putIfAbsent(kind, () => {});
     contextMap[matchKind] = (contextMap[matchKind] ?? 0) + 1;
   }
-
-  /// Return a JSON encoded string representing the data that was collected.
-  String toJson() {
-    return json.encode({
-      'version': currentVersion,
-      'byDistance': byDistance,
-      'byElementKind': byElementKind,
-      'byTokenType': byTokenType,
-      'byTypeMatch': byTypeMatch,
-      'distanceByDepthMap': _encodeIntIntMap(distanceByDepthMap),
-    });
-  }
-
-  /// Add the data in the [source] map to the [target] map.
-  void _addToMap<K>(Map<K, Map<K, int>> target, Map<K, Map<K, int>> source) {
-    for (var outerEntry in source.entries) {
-      var innerTarget = target.putIfAbsent(outerEntry.key, () => {});
-      for (var innerEntry in outerEntry.value.entries) {
-        var innerKey = innerEntry.key;
-        innerTarget[innerKey] = (innerTarget[innerKey] ?? 0) + innerEntry.value;
-      }
-    }
-  }
-
-  Map<String, dynamic> _convert(dynamic value) {
-    if (value is Map<String, dynamic>) {
-      return value;
-    }
-    throw FormatException('Expected a JSON map.', value);
-  }
-
-  /// Decode the content of the [source] map into the [target] map, using the
-  /// [keyMapper] to map the inner keys from a string to a [T].
-  void _decodeIntIntMap(
-      Map<int, Map<int, int>> target, Map<String, dynamic> source) {
-    var outerMap = _convert(source);
-    for (var outerEntry in outerMap.entries) {
-      var outerKey = int.parse(outerEntry.key);
-      var innerMap = _convert(outerEntry.value);
-      for (var innerEntry in innerMap.entries) {
-        var innerKey = int.parse(innerEntry.key);
-        var count = innerEntry.value as int;
-        target.putIfAbsent(outerKey, () => {})[innerKey] = count;
-      }
-    }
-  }
-
-  /// Decode the content of the [source] map into the [target] map, using the
-  /// [keyMapper] to map the inner keys from a string to a [T].
-  void _decodeMap(
-      Map<String, Map<String, int>> target, Map<String, dynamic> source) {
-    var outerMap = _convert(source);
-    for (var outerEntry in outerMap.entries) {
-      var outerKey = outerEntry.key;
-      var innerMap = _convert(outerEntry.value);
-      for (var innerEntry in innerMap.entries) {
-        var innerKey = innerEntry.key;
-        var count = innerEntry.value as int;
-        target.putIfAbsent(outerKey, () => {})[innerKey] = count;
-      }
-    }
-  }
-
-  Map<String, Map<String, int>> _encodeIntIntMap(Map<int, Map<int, int>> map) {
-    var result = <String, Map<String, int>>{};
-    for (var outerEntry in map.entries) {
-      var convertedInner = <String, int>{};
-      for (var innerEntry in outerEntry.value.entries) {
-        convertedInner[innerEntry.key.toString()] = innerEntry.value;
-      }
-      result[outerEntry.key.toString()] = convertedInner;
-    }
-    return result;
-  }
-
-  /// Initialize the state of this object from the given JSON encoded [content].
-  void _initializeFromJson(String content) {
-    var contentObject = _convert(json.decode(content));
-    var version = contentObject['version'].toString();
-    if (version != currentVersion) {
-      throw StateError(
-          'Invalid version: expected $currentVersion, found $version');
-    }
-    _decodeMap(byDistance, contentObject['byDistance']);
-    _decodeMap(byElementKind, contentObject['byElementKind']);
-    _decodeMap(byTokenType, contentObject['byTokenType']);
-    _decodeMap(byTypeMatch, contentObject['byTypeMatch']);
-    _decodeIntIntMap(distanceByDepthMap, contentObject['distanceByDepthMap']);
-  }
 }
 
 /// An object that visits a compilation unit in order to record the data used to
@@ -525,6 +433,8 @@
 
   @override
   void visitClassDeclaration(ClassDeclaration node) {
+    data.recordPercentage(
+        'Classes with type parameters', node.typeParameters != null);
     var context = 'name';
     if (node.extendsClause != null) {
       _recordTokenType('ClassDeclaration ($context)', node.extendsClause,
@@ -582,7 +492,11 @@
     inheritanceManager = InheritanceManager3();
     featureComputer = FeatureComputer(typeSystem, typeProvider);
 
+    var hasPrefix = false;
     for (var directive in node.directives) {
+      if (directive is ImportDirective && directive.prefix != null) {
+        hasPrefix = true;
+      }
       _recordTokenType('CompilationUnit (directive)', directive,
           allowedKeywords: directiveKeywords);
     }
@@ -590,6 +504,8 @@
       _recordDataForNode('CompilationUnit (declaration)', declaration,
           allowedKeywords: declarationKeywords);
     }
+    data.recordPercentage(
+        'Compilation units with at least one prefix', hasPrefix);
     super.visitCompilationUnit(node);
 
     featureComputer = null;
@@ -744,6 +660,8 @@
 
   @override
   void visitExtensionDeclaration(ExtensionDeclaration node) {
+    data.recordPercentage(
+        'Extensions with type parameters', node.typeParameters != null);
     _recordDataForNode('ExtensionDeclaration (type)', node.extendedType);
     for (var member in node.members) {
       _recordDataForNode('ExtensionDeclaration (member)', member,
@@ -847,6 +765,8 @@
   @override
   void visitFunctionExpression(FunctionExpression node) {
     // There are no completions.
+    data.recordPercentage(
+        'Functions with type parameters', node.typeParameters != null);
     super.visitFunctionExpression(node);
   }
 
@@ -1038,6 +958,8 @@
   @override
   void visitMethodDeclaration(MethodDeclaration node) {
     // There are no completions.
+    data.recordPercentage(
+        'Methods with type parameters', node.typeParameters != null);
     var element = node.declaredElement;
     if (!element.isStatic && element.enclosingElement is ClassElement) {
       var overriddenMembers = inheritanceManager.getOverridden2(
@@ -1085,6 +1007,8 @@
 
   @override
   void visitMixinDeclaration(MixinDeclaration node) {
+    data.recordPercentage(
+        'Mixins with type parameters', node.typeParameters != null);
     var context = 'name';
     if (node.onClause != null) {
       _recordTokenType('MixinDeclaration ($context)', node.onClause,
@@ -2031,6 +1955,8 @@
     sink.writeln();
     _writeCounts(sink, data.simpleCounts);
     sink.writeln();
+    _writePercentageData(sink, data.percentageData);
+    sink.writeln();
     _writeSideBySide(sink, [data.byTokenType, data.byElementKind],
         ['Token Types', 'Element Kinds']);
     sink.writeln();
@@ -2047,38 +1973,6 @@
     _writeTokenData(sink, data.tokenDistances);
   }
 
-  /// Return the minimum widths for each of the columns in the given [table].
-  ///
-  /// The table is represented as a list or rows, where each row is a list of
-  /// the contents of the cells in that row.
-  ///
-  /// Throws an [ArgumentError] if the table is empty or if the rows do not
-  /// contain the same number of cells.
-  List<int> _computeColumnWidths(List<List<String>> table) {
-    if (table.isEmpty) {
-      throw ArgumentError('table cannot be empty');
-    }
-    var columnCount = table[0].length;
-    if (columnCount == 0) {
-      throw ArgumentError('rows cannot be empty');
-    }
-    var columnWidths = List<int>.filled(columnCount, 0);
-    for (var row in table) {
-      var rowLength = row.length;
-      if (rowLength > 0) {
-        if (rowLength != columnCount) {
-          throw ArgumentError(
-              'non-empty rows must contain the same number of columns');
-        }
-        for (var i = 0; i < rowLength; i++) {
-          var cellWidth = row[i].length;
-          columnWidths[i] = math.max(columnWidths[i], cellWidth);
-        }
-      }
-    }
-    return columnWidths;
-  }
-
   /// Compute the metrics for the files in the context [root], creating a
   /// separate context collection to prevent accumulating memory. The metrics
   /// should be captured in the [collector]. Include additional details in the
@@ -2239,7 +2133,7 @@
     sink.writeln();
     var column = _convertMap('identifier lengths', lengths);
     var table = _convertColumnsToRows([column]).toList();
-    _writeTable(sink, table);
+    sink.writeTable(table);
   }
 
   /// Write the given [matrix] to the [sink]. The keys of the outer map will be
@@ -2277,7 +2171,20 @@
       }
       table.add(row);
     }
-    _writeTable(sink, table);
+    sink.writeTable(table);
+  }
+
+  /// Write a [percentageMap] containing one kind of metric data to the [sink].
+  void _writePercentageData(
+      StringSink sink, Map<String, _PercentageData> percentageMap) {
+    var names = percentageMap.keys.toList()..sort();
+    for (var name in names) {
+      var data = percentageMap[name];
+      var total = data.total;
+      var value = data.positive;
+      var percent = total == 0 ? '  0.0' : _formatPercent(value, total);
+      sink.writeln('$name = $percent ($value / $total)');
+    }
   }
 
   /// Write the given [maps] to the given [sink], formatting them as side-by-side
@@ -2285,37 +2192,7 @@
   void _writeSideBySide(StringSink sink,
       List<Map<String, Map<String, int>>> maps, List<String> columnTitles) {
     var table = _createTable(maps, columnTitles);
-    _writeTable(sink, table);
-  }
-
-  /// Write the given [table] to the [sink].
-  ///
-  /// The table is represented as a list or rows, where each row is a list of the
-  /// contents of the cells in that row.
-  ///
-  /// Throws an [ArgumentError] if the table is empty or if the rows do not
-  /// contain the same number of cells.
-  void _writeTable(StringSink sink, List<List<String>> table) {
-    var columnWidths = _computeColumnWidths(table);
-    for (var row in table) {
-      var lastNonEmpty = row.length - 1;
-      while (lastNonEmpty > 0) {
-        if (row[lastNonEmpty].isNotEmpty) {
-          break;
-        }
-        lastNonEmpty--;
-      }
-      for (var i = 0; i <= lastNonEmpty; i++) {
-        var cellContent = row[i];
-        var columnWidth = columnWidths[i];
-        var padding = columnWidth - cellContent.length;
-        sink.write(cellContent);
-        if (i < lastNonEmpty) {
-          sink.write(' ' * (padding + 2));
-        }
-      }
-      sink.writeln();
-    }
+    sink.writeTable(table);
   }
 
   /// Write information about the number of identifiers that occur within a
@@ -2337,7 +2214,7 @@
     sink.writeln();
     sink.writeln('Token stream analysis');
     var table = _convertColumnsToRows([firstColumn, secondColumn]).toList();
-    _writeTable(sink, table);
+    sink.writeTable(table);
   }
 
   /// Return `true` if the [result] contains an error.
@@ -2371,3 +2248,25 @@
     count++;
   }
 }
+
+/// Information collected to compute a percentage of data points that were
+/// positive.
+class _PercentageData {
+  /// The total number of data points.
+  int total = 0;
+
+  /// The total number of positive data points.
+  int positive = 0;
+
+  /// Initialize a newly created keeper of percentage data.
+  _PercentageData();
+
+  /// Add a data point to the data being collected. If [wasPositive] is `true`
+  /// then the data point is a positive data point.
+  void addDataPoint(bool wasPositive) {
+    total++;
+    if (wasPositive) {
+      positive++;
+    }
+  }
+}
diff --git a/pkg/analysis_server/tool/completion_metrics/relevance_table_generator.dart b/pkg/analysis_server/tool/completion_metrics/relevance_table_generator.dart
index fb0bff8..5a89a32 100644
--- a/pkg/analysis_server/tool/completion_metrics/relevance_table_generator.dart
+++ b/pkg/analysis_server/tool/completion_metrics/relevance_table_generator.dart
@@ -877,7 +877,7 @@
 
   @override
   void visitMethodInvocation(MethodInvocation node) {
-    _recordDataForNode('MethodInvocation_argumentList', node.argumentList);
+    // There are no completions.
     super.visitMethodInvocation(node);
   }
 
diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
index 53267ad..388a2c7 100644
--- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
+++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java
@@ -215,16 +215,11 @@
    * @param excluded A list of the files and directories within the included directories that should
    *         not be analyzed.
    * @param packageRoots A mapping from source directories to package roots that should override the
-   *         normal package: URI resolution mechanism. If a package root is a directory, then the
-   *         analyzer will behave as though the associated source directory in the map contains a
-   *         special pubspec.yaml file which resolves any package: URI to the corresponding path
-   *         within that package root directory. The effect is the same as specifying the package
-   *         root directory as a "--package_root" parameter to the Dart VM when executing any Dart
-   *         file inside the source directory. If a package root is a file, then the analyzer will
-   *         behave as though that file is a ".packages" file in the source directory. The effect is
-   *         the same as specifying the file as a "--packages" parameter to the Dart VM when
-   *         executing any Dart file inside the source directory. Files in any directories that are
-   *         not overridden by this mapping have their package: URI's resolved using the normal
+   *         normal package: URI resolution mechanism. If a package root is a file, then the analyzer
+   *         will behave as though that file is a ".packages" file in the source directory. The
+   *         effect is the same as specifying the file as a "--packages" parameter to the Dart VM
+   *         when executing any Dart file inside the source directory. Files in any directories that
+   *         are not overridden by this mapping have their package: URI's resolved using the normal
    *         pubspec.yaml mechanism. If this field is absent, or the empty map is specified, that
    *         indicates that the normal pubspec.yaml mechanism should always be used.
    */
diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html
index a85f883..097bc1a 100644
--- a/pkg/analysis_server/tool/spec/spec_input.html
+++ b/pkg/analysis_server/tool/spec/spec_input.html
@@ -793,16 +793,6 @@
           mechanism.
         </p>
         <p>
-          If a package root is a directory, then
-          the analyzer will behave as though the associated
-          source directory in the map contains a special
-          pubspec.yaml file which resolves any package: URI to the
-          corresponding path within that package root directory. The
-          effect is the same as specifying the package root directory as
-          a "--package_root" parameter to the Dart VM when
-          executing any Dart file inside the source directory.
-        </p>
-        <p>
           If a package root is a file, then the analyzer
           will behave as though that file is a ".packages" file in the
           source directory. The effect is the same as specifying the file
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
index 21a2c04..a9a1cf0 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -3323,13 +3323,6 @@
   /// A mapping from source directories to package roots that should override
   /// the normal package: URI resolution mechanism.
   ///
-  /// If a package root is a directory, then the analyzer will behave as though
-  /// the associated source directory in the map contains a special
-  /// pubspec.yaml file which resolves any package: URI to the corresponding
-  /// path within that package root directory. The effect is the same as
-  /// specifying the package root directory as a "--package_root" parameter to
-  /// the Dart VM when executing any Dart file inside the source directory.
-  ///
   /// If a package root is a file, then the analyzer will behave as though that
   /// file is a ".packages" file in the source directory. The effect is the
   /// same as specifying the file as a "--packages" parameter to the Dart VM
@@ -3344,13 +3337,6 @@
   /// A mapping from source directories to package roots that should override
   /// the normal package: URI resolution mechanism.
   ///
-  /// If a package root is a directory, then the analyzer will behave as though
-  /// the associated source directory in the map contains a special
-  /// pubspec.yaml file which resolves any package: URI to the corresponding
-  /// path within that package root directory. The effect is the same as
-  /// specifying the package root directory as a "--package_root" parameter to
-  /// the Dart VM when executing any Dart file inside the source directory.
-  ///
   /// If a package root is a file, then the analyzer will behave as though that
   /// file is a ".packages" file in the source directory. The effect is the
   /// same as specifying the file as a "--packages" parameter to the Dart VM
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index 105cec6..2bd4343 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -370,7 +370,13 @@
   _PhysicalResource(this._entry);
 
   @override
-  bool get exists => _entry.existsSync();
+  bool get exists {
+    try {
+      return _entry.existsSync();
+    } on FileSystemException {
+      return false;
+    }
+  }
 
   @override
   get hashCode => path.hashCode;
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index be14894..b398086 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -5,7 +5,6 @@
 import 'package:analyzer/dart/analysis/declared_variables.dart';
 import 'package:analyzer/dart/analysis/features.dart';
 import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/error/listener.dart';
@@ -29,6 +28,7 @@
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
 import 'package:analyzer/src/dart/element/type_provider.dart';
+import 'package:analyzer/src/dart/error/syntactic_errors.dart';
 import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
 import 'package:analyzer/src/dart/resolver/legacy_type_asserter.dart';
 import 'package:analyzer/src/dart/resolver/resolution_visitor.dart';
@@ -235,6 +235,8 @@
       unit.accept(DeadCodeVerifier(errorReporter, typeSystem: _typeSystem));
     }
 
+    unit.accept(UnusedLabelVerifier(errorReporter));
+
     // Dart2js analysis.
     if (_analysisOptions.dart2jsHint) {
       unit.accept(Dart2JSVerifier(errorReporter));
@@ -322,18 +324,7 @@
     );
     for (Linter linter in _analysisOptions.lintRules) {
       linter.reporter = errorReporter;
-      if (linter is NodeLintRule) {
-        (linter as NodeLintRule).registerNodeProcessors(nodeRegistry, context);
-      } else {
-        AstVisitor visitor = linter.getVisitor();
-        if (visitor != null) {
-          if (_analysisOptions.enableTiming) {
-            var timer = lintRegistry.getTimer(linter);
-            visitor = TimedAstVisitor(visitor, timer);
-          }
-          visitors.add(visitor);
-        }
-      }
+      linter.registerNodeProcessors(nodeRegistry, context);
     }
 
     // Run lints that handle specific node types.
@@ -436,8 +427,11 @@
           }
         }
 
-        if (code == CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY &&
-            file.path.contains('tests/compiler/dart2js')) {
+        if ((code == CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY ||
+                code == CompileTimeErrorCode.UNDEFINED_ANNOTATION ||
+                code == ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE) &&
+            (file.path.contains('tests/compiler/dart2js') ||
+                file.path.contains('pkg/compiler/test'))) {
           // Special case the dart2js language tests. Some of these import
           // various internal libraries.
           privileged = true;
diff --git a/pkg/analyzer/lib/src/dart/element/type_demotion.dart b/pkg/analyzer/lib/src/dart/element/type_demotion.dart
index f6adb1b..cd2ad8b 100644
--- a/pkg/analyzer/lib/src/dart/element/type_demotion.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_demotion.dart
@@ -30,7 +30,7 @@
 /// Returns [type] in which all legacy types have been replaced with
 /// non-nullable types.
 DartType nonNullifyType(LibraryElement library, DartType type) {
-  if (library.isNonNullableByDefault) {
+  if (library.isNonNullableByDefault && type != null) {
     var visitor = const _DemotionNonNullification(demoteTypeVariables: false);
     return visitor.visit(type) ?? type;
   }
diff --git a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
index 710453b8..4335e79 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_analyzer.dart
@@ -5,7 +5,6 @@
 import 'package:analyzer/dart/analysis/declared_variables.dart';
 import 'package:analyzer/dart/analysis/features.dart';
 import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/error/listener.dart';
@@ -260,7 +259,11 @@
     AnalysisErrorListener errorListener = _getErrorListener(file);
     ErrorReporter errorReporter = _getErrorReporter(file);
 
-    unit.accept(DeadCodeVerifier(errorReporter, typeSystem: _typeSystem));
+    if (!_libraryElement.isNonNullableByDefault) {
+      unit.accept(DeadCodeVerifier(errorReporter, typeSystem: _typeSystem));
+    }
+
+    unit.accept(UnusedLabelVerifier(errorReporter));
 
     // Dart2js analysis.
     if (_analysisOptions.dart2jsHint) {
@@ -346,18 +349,7 @@
         workspacePackage);
     for (Linter linter in _analysisOptions.lintRules) {
       linter.reporter = errorReporter;
-      if (linter is NodeLintRule) {
-        (linter as NodeLintRule).registerNodeProcessors(nodeRegistry, context);
-      } else {
-        AstVisitor visitor = linter.getVisitor();
-        if (visitor != null) {
-          if (_analysisOptions.enableTiming) {
-            var timer = lintRegistry.getTimer(linter);
-            visitor = TimedAstVisitor(visitor, timer);
-          }
-          visitors.add(visitor);
-        }
-      }
+      linter.registerNodeProcessors(nodeRegistry, context);
     }
 
     // Run lints that handle specific node types.
diff --git a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
index fad0ca3..395039a 100644
--- a/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/flow_analysis_visitor.dart
@@ -278,7 +278,7 @@
   /// Return the target of the `break` or `continue` statement with the
   /// [element] label. The [element] might be `null` (when the statement does
   /// not specify a label), so the default enclosing target is returned.
-  static Statement getLabelTarget(AstNode node, LabelElement element) {
+  static Statement getLabelTarget(AstNode node, Element element) {
     for (; node != null; node = node.parent) {
       if (element == null) {
         if (node is DoStatement ||
@@ -311,7 +311,7 @@
     return null;
   }
 
-  static bool _hasLabel(List<Label> labels, LabelElement element) {
+  static bool _hasLabel(List<Label> labels, Element element) {
     for (var nodeLabel in labels) {
       if (identical(nodeLabel.label.staticElement, element)) {
         return true;
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 8cea01f..236219d 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
@@ -7,6 +7,7 @@
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type_demotion.dart';
 import 'package:analyzer/src/dart/resolver/body_inference_context.dart';
 import 'package:analyzer/src/dart/resolver/flow_analysis_visitor.dart';
 import 'package:analyzer/src/dart/resolver/invocation_inference_helper.dart';
@@ -50,6 +51,8 @@
     }
 
     var contextType = InferenceContext.getContext(node);
+    contextType = nonNullifyType(_resolver.definingLibrary, contextType);
+
     if (contextType is FunctionType) {
       contextType = _matchFunctionTypeParameters(
         node.typeParameters,
diff --git a/pkg/analyzer/lib/src/error/dead_code_verifier.dart b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
index 7f8baf6..0046452 100644
--- a/pkg/analyzer/lib/src/error/dead_code_verifier.dart
+++ b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
@@ -25,7 +25,7 @@
   List<Object> arguments,
 );
 
-/// A visitor that finds dead code and unused labels.
+/// A visitor that finds dead code.
 class DeadCodeVerifier extends RecursiveAstVisitor<void> {
   /// The error reporter by which errors will be reported.
   final ErrorReporter _errorReporter;
@@ -33,9 +33,6 @@
   ///  The type system for this visitor
   final TypeSystemImpl _typeSystem;
 
-  /// The object used to track the usage of labels within a given label scope.
-  _LabelTracker labelTracker;
-
   /// Initialize a newly created dead code verifier that will report dead code
   /// to the given [errorReporter] and will use the given [typeSystem] if one is
   /// provided.
@@ -109,11 +106,6 @@
   }
 
   @override
-  void visitBreakStatement(BreakStatement node) {
-    labelTracker?.recordUsage(node.label?.name);
-  }
-
-  @override
   void visitConditionalExpression(ConditionalExpression node) {
     Expression conditionExpression = node.condition;
     conditionExpression?.accept(this);
@@ -140,11 +132,6 @@
   }
 
   @override
-  void visitContinueStatement(ContinueStatement node) {
-    labelTracker?.recordUsage(node.label?.name);
-  }
-
-  @override
   void visitExportDirective(ExportDirective node) {
     ExportElement exportElement = node.element;
     if (exportElement != null) {
@@ -233,16 +220,6 @@
   }
 
   @override
-  void visitLabeledStatement(LabeledStatement node) {
-    _pushLabels(node.labels);
-    try {
-      super.visitLabeledStatement(node);
-    } finally {
-      _popLabels();
-    }
-  }
-
-  @override
   void visitSwitchCase(SwitchCase node) {
     _checkForDeadStatementsInNodeList(node.statements, allowMandated: true);
     super.visitSwitchCase(node);
@@ -255,20 +232,6 @@
   }
 
   @override
-  void visitSwitchStatement(SwitchStatement node) {
-    List<Label> labels = <Label>[];
-    for (SwitchMember member in node.members) {
-      labels.addAll(member.labels);
-    }
-    _pushLabels(labels);
-    try {
-      super.visitSwitchStatement(node);
-    } finally {
-      _popLabels();
-    }
-  }
-
-  @override
   void visitTryStatement(TryStatement node) {
     node.body?.accept(this);
     node.finallyBlock?.accept(this);
@@ -420,21 +383,6 @@
     }
     return false;
   }
-
-  /// Exit the most recently entered label scope after reporting any labels that
-  /// were not referenced within that scope.
-  void _popLabels() {
-    for (Label label in labelTracker.unusedLabels()) {
-      _errorReporter
-          .reportErrorForNode(HintCode.UNUSED_LABEL, label, [label.label.name]);
-    }
-    labelTracker = labelTracker.outerTracker;
-  }
-
-  /// Enter a new label scope in which the given [labels] are defined.
-  void _pushLabels(List<Label> labels) {
-    labelTracker = _LabelTracker(labelTracker, labels);
-  }
 }
 
 /// Helper for tracking dead code - [CatchClause]s and unreachable code.
@@ -574,6 +522,66 @@
   }
 }
 
+/// A visitor that finds unused labels.
+class UnusedLabelVerifier extends RecursiveAstVisitor<void> {
+  /// The error reporter by which errors will be reported.
+  final ErrorReporter _errorReporter;
+
+  /// The object used to track the usage of labels within a given label scope.
+  _LabelTracker labelTracker;
+
+  UnusedLabelVerifier(this._errorReporter);
+
+  @override
+  void visitBreakStatement(BreakStatement node) {
+    labelTracker?.recordUsage(node.label?.name);
+  }
+
+  @override
+  void visitContinueStatement(ContinueStatement node) {
+    labelTracker?.recordUsage(node.label?.name);
+  }
+
+  @override
+  void visitLabeledStatement(LabeledStatement node) {
+    _pushLabels(node.labels);
+    try {
+      super.visitLabeledStatement(node);
+    } finally {
+      _popLabels();
+    }
+  }
+
+  @override
+  void visitSwitchStatement(SwitchStatement node) {
+    List<Label> labels = <Label>[];
+    for (SwitchMember member in node.members) {
+      labels.addAll(member.labels);
+    }
+    _pushLabels(labels);
+    try {
+      super.visitSwitchStatement(node);
+    } finally {
+      _popLabels();
+    }
+  }
+
+  /// Exit the most recently entered label scope after reporting any labels that
+  /// were not referenced within that scope.
+  void _popLabels() {
+    for (Label label in labelTracker.unusedLabels()) {
+      _errorReporter
+          .reportErrorForNode(HintCode.UNUSED_LABEL, label, [label.label.name]);
+    }
+    labelTracker = labelTracker.outerTracker;
+  }
+
+  /// Enter a new label scope in which the given [labels] are defined.
+  void _pushLabels(List<Label> labels) {
+    labelTracker = _LabelTracker(labelTracker, labels);
+  }
+}
+
 class _CatchClausesVerifier {
   final TypeSystemImpl _typeSystem;
   final _CatchClausesVerifierReporter _errorReporter;
diff --git a/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
index 0d8516d..e47a635 100644
--- a/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
+++ b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
@@ -62,6 +62,9 @@
   String get encoding => '$uri';
 
   @override
+  String get fullName => uri.path;
+
+  @override
   noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
 }
 
diff --git a/pkg/analyzer/lib/src/services/lint.dart b/pkg/analyzer/lib/src/services/lint.dart
index c6342a4..2fdce7b 100644
--- a/pkg/analyzer/lib/src/services/lint.dart
+++ b/pkg/analyzer/lib/src/services/lint.dart
@@ -8,13 +8,14 @@
 import 'package:analyzer/error/listener.dart';
 import 'package:analyzer/src/dart/error/lint_codes.dart';
 import 'package:analyzer/src/generated/engine.dart';
-
-/// Shared lint registry.
-LintRegistry lintRegistry = LintRegistry();
+import 'package:analyzer/src/lint/linter.dart';
 
 /// Current linter version.
 String linterVersion;
 
+/// Shared lint registry.
+LintRegistry lintRegistry = LintRegistry();
+
 /// Return lints associated with this [context], or an empty list if there are
 /// none.
 List<Linter> getLints(AnalysisContext context) =>
@@ -29,7 +30,7 @@
 }
 
 /// Implementers contribute lint warnings via the provided error [reporter].
-abstract class Linter {
+abstract class Linter implements NodeLintRule {
   /// Used to report lint warnings.
   /// NOTE: this is set by the framework before visit begins.
   ErrorReporter reporter;
@@ -45,7 +46,12 @@
   /// Return a visitor to be passed to compilation units to perform lint
   /// analysis.
   /// Lint errors are reported via this [Linter]'s error [reporter].
+  @Deprecated('Use registerNodeProcessors() instead.')
   AstVisitor getVisitor();
+
+  @override
+  void registerNodeProcessors(
+      NodeLintRegistry registry, LinterContext context) {}
 }
 
 /// Manages lint timing.
diff --git a/pkg/analyzer/lib/src/test_utilities/find_element.dart b/pkg/analyzer/lib/src/test_utilities/find_element.dart
index 25dcc7d..2b1860b 100644
--- a/pkg/analyzer/lib/src/test_utilities/find_element.dart
+++ b/pkg/analyzer/lib/src/test_utilities/find_element.dart
@@ -169,9 +169,11 @@
     }
 
     unit.accept(
-      FunctionAstVisitor(functionDeclarationStatement: (node) {
-        var functionElement = node.functionDeclaration.declaredElement;
-        findIn(functionElement.parameters);
+      FunctionAstVisitor(functionExpression: (node, local) {
+        if (local) {
+          var functionElement = node.declaredElement;
+          findIn(functionElement.parameters);
+        }
       }),
     );
 
diff --git a/pkg/analyzer/lib/src/test_utilities/function_ast_visitor.dart b/pkg/analyzer/lib/src/test_utilities/function_ast_visitor.dart
index 28284ee..0c7d2ad 100644
--- a/pkg/analyzer/lib/src/test_utilities/function_ast_visitor.dart
+++ b/pkg/analyzer/lib/src/test_utilities/function_ast_visitor.dart
@@ -10,12 +10,14 @@
   final void Function(DeclaredIdentifier) declaredIdentifier;
   final void Function(FunctionDeclarationStatement)
       functionDeclarationStatement;
+  final void Function(FunctionExpression, bool) functionExpression;
   final void Function(SimpleIdentifier) simpleIdentifier;
   final void Function(VariableDeclaration) variableDeclaration;
 
   FunctionAstVisitor({
     this.declaredIdentifier,
     this.functionDeclarationStatement,
+    this.functionExpression,
     this.simpleIdentifier,
     this.variableDeclaration,
   });
@@ -37,6 +39,16 @@
   }
 
   @override
+  void visitFunctionExpression(FunctionExpression node) {
+    if (functionExpression != null) {
+      var local = node.parent is! FunctionDeclaration ||
+          node.parent.parent is FunctionDeclarationStatement;
+      functionExpression(node, local);
+    }
+    super.visitFunctionExpression(node);
+  }
+
+  @override
   void visitSimpleIdentifier(SimpleIdentifier node) {
     if (simpleIdentifier != null) {
       simpleIdentifier(node);
diff --git a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
index 3459910..2f1038a 100644
--- a/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
+++ b/pkg/analyzer/lib/src/test_utilities/mock_sdk.dart
@@ -1090,7 +1090,6 @@
   /// Optional [additionalLibraries] should have unique URIs, and paths in
   /// their units are relative (will be put into `sdkRoot/lib`).
   MockSdk({
-    bool generateSummaryFiles = false,
     @required this.resourceProvider,
     AnalysisOptionsImpl analysisOptions,
     List<MockSdkLibrary> additionalLibraries = const [],
@@ -1157,12 +1156,6 @@
 }
 ''',
     );
-
-    if (generateSummaryFiles) {
-      List<int> bytes = _computeLinkedBundleBytes();
-      resourceProvider.newFileWithBytes(
-          resourceProvider.convertPath('/lib/_internal/strong.sum'), bytes);
-    }
   }
 
   @override
diff --git a/pkg/analyzer/test/file_system/physical_file_system_test.dart b/pkg/analyzer/test/file_system/physical_file_system_test.dart
index 09e42a5..03e0f0c 100644
--- a/pkg/analyzer/test/file_system/physical_file_system_test.dart
+++ b/pkg/analyzer/test/file_system/physical_file_system_test.dart
@@ -104,6 +104,13 @@
     expect(() => file.delete(), throwsA(isFileSystemException));
   }
 
+  test_exists_invalidPath() {
+    Folder folder = getFolder(exists: false);
+    File file = folder.getChildAssumingFile(r'\l\package:o\other.dart');
+
+    expect(file.exists, isFalse);
+  }
+
   @override
   test_renameSync_notExisting() {
     String oldPath = join(tempPath, 'file.txt');
diff --git a/pkg/analyzer/test/src/dart/resolution/local_variable_test.dart b/pkg/analyzer/test/src/dart/resolution/local_variable_test.dart
index caa900f..84d0e75 100644
--- a/pkg/analyzer/test/src/dart/resolution/local_variable_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/local_variable_test.dart
@@ -2,24 +2,40 @@
 // 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/dart/analysis/features.dart';
-import 'package:analyzer/src/dart/analysis/experiments.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
+import '../constant/potentially_constant_test.dart';
 import 'driver_resolution.dart';
 
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LocalVariableResolutionTest);
-    defineReflectiveTests(LocalVariableResolutionTest_NNBD);
+    defineReflectiveTests(LocalVariableResolutionWithNullSafetyTest);
   });
 }
 
 @reflectiveTest
 class LocalVariableResolutionTest extends DriverResolutionTest {
+  test_demoteTypeParameterType() async {
+    await assertNoErrorsInCode('''
+void f<T>(T a, T b) {
+  if (a is String) {
+    var o = a;
+    o = b;
+    o; // ref
+  }
+}
+''');
+
+    var type = findNode.simple('o; // ref').staticType;
+    assertType(type, 'T');
+    _assertPromotedBound(type, isNull);
+  }
+
   test_element_block() async {
     await assertErrorsInCode(r'''
 void f() {
@@ -84,16 +100,17 @@
     expect(x.isLate, isFalse);
     expect(x.isStatic, isFalse);
   }
+
+  void _assertPromotedBound(DartType type, Matcher promotedBound) {
+    if (type is TypeParameterTypeImpl) {
+      expect(type.promotedBound, promotedBound);
+    }
+  }
 }
 
 @reflectiveTest
-class LocalVariableResolutionTest_NNBD extends LocalVariableResolutionTest {
-  @override
-  AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
-    ..contextFeatures = FeatureSet.fromEnableFlags(
-      [EnableString.non_nullable],
-    );
-
+class LocalVariableResolutionWithNullSafetyTest
+    extends LocalVariableResolutionTest with WithNullSafetyMixin {
   test_element_late() async {
     await assertErrorsInCode(r'''
 void f() {
@@ -109,4 +126,23 @@
     expect(x.isLate, isTrue);
     expect(x.isStatic, isFalse);
   }
+
+  test_nonNullifyType() async {
+    newFile('/test/lib/a.dart', content: r'''
+// @dart = 2.7
+var a = 0;
+''');
+
+    await assertNoErrorsInCode('''
+import 'a.dart';
+
+void f() {
+  var x = a;
+  x;
+}
+''');
+
+    var x = findElement.localVar('x');
+    assertType(x.type, 'int');
+  }
 }
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
index fca62c4..a112ed2 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/function_expression_test.dart
@@ -366,6 +366,28 @@
   @override
   bool get typeToStringWithNullability => true;
 
+  test_contextFunctionType_nonNullify() async {
+    newFile('/test/lib/a.dart', content: r'''
+// @dart = 2.7
+
+int Function(int a) v;
+''');
+
+    await assertNoErrorsInCode('''
+import 'a.dart';
+
+T foo<T>() => throw 0;
+
+void f() {
+  v = (a) {
+    return foo();
+  };
+}
+''');
+    assertType(findElement.parameter('a').type, 'int');
+    _assertReturnType('(a) {', 'int');
+  }
+
   test_contextFunctionType_returnType_async_blockBody_objectQ() async {
     await assertNoErrorsInCode('''
 T foo<T>() => throw 0;
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/local_variable_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/local_variable_test.dart
deleted file mode 100644
index 89060e8..0000000
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/local_variable_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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/dart/element/type.dart';
-import 'package:analyzer/src/dart/element/type.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../driver_resolution.dart';
-
-main() {
-  defineReflectiveSuite(() {
-    defineReflectiveTests(LocalVariableTest);
-  });
-}
-
-@reflectiveTest
-class LocalVariableTest extends DriverResolutionTest {
-  void assertPromotedBound(DartType type, Matcher promotedBound) {
-    if (type is TypeParameterTypeImpl) {
-      expect(type.promotedBound, promotedBound);
-    }
-  }
-
-  test_demoteTypeParameterType() async {
-    await assertNoErrorsInCode('''
-void f<T>(T a, T b) {
-  if (a is String) {
-    var o = a;
-    o = b;
-    o; // ref
-  }
-}
-''');
-
-    var type = findNode.simple('o; // ref').staticType;
-    assertType(type, 'T');
-    assertPromotedBound(type, isNull);
-  }
-}
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart
index a998d76..8262958 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/test_all.dart
@@ -10,7 +10,6 @@
 import 'extension_methods_test.dart' as extension_methods;
 import 'function_expression_test.dart' as function_expression;
 import 'list_literal_test.dart' as list_literal;
-import 'local_variable_test.dart' as local_variable;
 import 'logical_boolean_expressions_test.dart' as logical_boolean_expressions;
 import 'map_literal_test.dart' as map_literal;
 import 'set_literal_test.dart' as set_literal;
@@ -27,7 +26,6 @@
     extension_methods.main();
     function_expression.main();
     list_literal.main();
-    local_variable.main();
     logical_boolean_expressions.main();
     map_literal.main();
     set_literal.main();
diff --git a/pkg/analyzer/test/src/diagnostics/label_undefined_test.dart b/pkg/analyzer/test/src/diagnostics/label_undefined_test.dart
index 44c4b6f..503c009 100644
--- a/pkg/analyzer/test/src/diagnostics/label_undefined_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/label_undefined_test.dart
@@ -6,11 +6,13 @@
 import 'package:analyzer/src/error/codes.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
+import '../dart/constant/potentially_constant_test.dart';
 import '../dart/resolution/driver_resolution.dart';
 
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LabelUndefinedTest);
+    defineReflectiveTests(LabelUndefinedWithNullSafetyTest);
   });
 }
 
@@ -29,6 +31,18 @@
     ]);
   }
 
+  test_break_notLabel() async {
+    await assertErrorsInCode(r'''
+f(int x) {
+  while (true) {
+    break x;
+  }
+}
+''', [
+      error(CompileTimeErrorCode.LABEL_UNDEFINED, 38, 1),
+    ]);
+  }
+
   test_continue() async {
     await assertErrorsInCode(r'''
 f() {
@@ -41,4 +55,20 @@
       error(CompileTimeErrorCode.LABEL_UNDEFINED, 39, 1),
     ]);
   }
+
+  test_continue_notLabel() async {
+    await assertErrorsInCode(r'''
+f(int x) {
+  while (true) {
+    continue x;
+  }
 }
+''', [
+      error(CompileTimeErrorCode.LABEL_UNDEFINED, 41, 1),
+    ]);
+  }
+}
+
+@reflectiveTest
+class LabelUndefinedWithNullSafetyTest extends LabelUndefinedTest
+    with WithNullSafetyMixin {}
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index 58e8c1a..60d403e 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -19,10 +19,8 @@
 import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/dart/analysis/performance_logger.dart';
 import 'package:analyzer/src/dart/analysis/session.dart';
-import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
 import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/source/source_resource.dart';
@@ -391,6 +389,12 @@
       return bundle;
     }
 
+    SummaryBasedDartSdk sdk;
+    logger.run('Add SDK bundle', () {
+      sdk = SummaryBasedDartSdk(options.dartSdkSummaryPath, true);
+      summaryDataStore.addBundle(null, sdk.bundle);
+    });
+
     var numInputs = options.buildSummaryInputs.length;
     logger.run('Add $numInputs input summaries', () {
       for (var path in options.buildSummaryInputs) {
@@ -400,26 +404,6 @@
 
     var rootPath =
         options.sourceFiles.isEmpty ? null : options.sourceFiles.first;
-    DartSdk sdk;
-    logger.run('Add SDK bundle', () {
-      PackageBundle sdkBundle;
-      if (options.dartSdkSummaryPath != null) {
-        var summarySdk = SummaryBasedDartSdk(options.dartSdkSummaryPath, true);
-        sdk = summarySdk;
-        sdkBundle = summarySdk.bundle;
-      } else {
-        var dartSdk = FolderBasedDartSdk(
-            resourceProvider, resourceProvider.getFolder(options.dartSdkPath));
-        dartSdk.analysisOptions =
-            createAnalysisOptionsForCommandLineOptions(options, rootPath);
-        dartSdk.useSummary = !options.buildSummaryOnly;
-        sdk = dartSdk;
-        sdkBundle = dartSdk.getSummarySdkBundle();
-      }
-
-      // Include SDK bundle to avoid parsing SDK sources.
-      summaryDataStore.addBundle(null, sdkBundle);
-    });
 
     var packages = _findPackages(rootPath);
 
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index 90deb09..fd0f95d 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -243,10 +243,26 @@
     }
 
     // Build mode.
-    if (options.buildModePersistentWorker && !options.buildMode) {
-      printAndFail('The option --persistent_worker can be used only '
-          'together with --build-mode.');
-      return null; // Only reachable in testing.
+    if (options.buildMode) {
+      if (options.dartSdkSummaryPath == null) {
+        // It is OK to not specify when persistent worker.
+        // We will be given another set of options with each request.
+        if (!options.buildModePersistentWorker) {
+          printAndFail(
+            'The option --build-mode also requires --dart-sdk-summary '
+            'to be specified.',
+          );
+          return null; // Only reachable in testing.
+        }
+      }
+    } else {
+      if (options.buildModePersistentWorker) {
+        printAndFail(
+          'The option --persistent_worker can be used only '
+          'together with --build-mode.',
+        );
+        return null; // Only reachable in testing.
+      }
     }
 
     return options;
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index 6d547b3..8a29242 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -38,82 +38,48 @@
 }
 
 class AbstractBuildModeTest extends BaseTest {
-  Future<void> _doDrive(String path,
-      {String uri,
-      List<String> additionalArgs = const [],
-      String dartSdkSummaryPath}) async {
-    path = _p(path);
+  Future<void> _doDrive(
+    String filePath, {
+    String sourceArgument,
+    String fileUri,
+    List<String> additionalArgs = const [],
+  }) async {
+    filePath = _posixToPlatformPath(filePath);
 
     var optionsFileName = AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
-    var options = _p('data/options_tests_project/' + optionsFileName);
+    var options =
+        _posixToPlatformPath('data/options_tests_project/' + optionsFileName);
 
     var args = <String>[];
-    if (dartSdkSummaryPath != null) {
-      args.add('--dart-sdk-summary');
-      args.add(dartSdkSummaryPath);
-    } else {
-      var sdkPath = _findSdkDirForSummaries();
-      args.add('--dart-sdk');
-      args.add(sdkPath);
-    }
     args.add('--build-mode');
     args.add('--format=machine');
+
+    {
+      var sdkPath = path.dirname(
+        path.dirname(
+          Platform.resolvedExecutable,
+        ),
+      );
+
+      var dartSdkSummaryPath = path.join(
+        sdkPath,
+        'lib',
+        '_internal',
+        'strong.sum',
+      );
+
+      args.add('--dart-sdk-summary');
+      args.add(dartSdkSummaryPath);
+    }
+
     args.addAll(additionalArgs);
 
-    uri ??= 'file:///test_file.dart';
-    var source = '$uri|$path';
-
-    await drive(source, args: args, options: options);
-  }
-
-  /// Try to find a appropriate directory to pass to "--dart-sdk" that will
-  /// allow summaries to be found.
-  String _findSdkDirForSummaries() {
-    var triedDirectories = <String>{};
-    bool isSuitable(String sdkDir) {
-      triedDirectories.add(sdkDir);
-      return File(path.join(sdkDir, 'lib', '_internal', 'strong.sum'))
-          .existsSync();
+    if (sourceArgument == null) {
+      fileUri ??= 'file:///test_file.dart';
+      sourceArgument = '$fileUri|$filePath';
     }
 
-    String makeAbsoluteAndNormalized(String result) {
-      result = path.absolute(result);
-      result = path.normalize(result);
-      return result;
-    }
-
-    // Usually the sdk directory is the parent of the parent of the "dart"
-    // executable.
-    var executableParent = File(Platform.executable).parent;
-    var executableGrandparent = executableParent.parent;
-    if (isSuitable(executableGrandparent.path)) {
-      return makeAbsoluteAndNormalized(executableGrandparent.path);
-    }
-    // During build bot execution, the sdk directory is simply the parent of the
-    // "dart" executable.
-    if (isSuitable(executableParent.path)) {
-      return makeAbsoluteAndNormalized(executableParent.path);
-    }
-    // If neither of those are suitable, assume we are running locally within the
-    // SDK project (e.g. within an IDE). Find the build output directory and
-    // search all built configurations.
-    var sdkRootDir =
-        File(Platform.script.toFilePath()).parent.parent.parent.parent;
-    for (var outDirName in ['out', 'xcodebuild']) {
-      var outDir = Directory(path.join(sdkRootDir.path, outDirName));
-      if (outDir.existsSync()) {
-        for (var subdir in outDir.listSync()) {
-          if (subdir is Directory) {
-            var candidateSdkDir = path.join(subdir.path, 'dart-sdk');
-            if (isSuitable(candidateSdkDir)) {
-              return makeAbsoluteAndNormalized(candidateSdkDir);
-            }
-          }
-        }
-      }
-    }
-    throw Exception('Could not find an SDK directory containing summaries.'
-        '  Tried: ${triedDirectories.toList()}');
+    await drive(sourceArgument, args: args, options: options);
   }
 }
 
@@ -151,7 +117,7 @@
     String options = emptyOptionsFile,
     List<String> args = const <String>[],
   }) async {
-    options = _p(options);
+    options = _posixToPlatformPath(options);
 
     driver = Driver(isTesting: true);
     var cmd = <String>[];
@@ -197,17 +163,19 @@
     return '$uriPrefix${path.join(testDirectory, relativePath)}';
   }
 
-  /// Convert the given posix [filePath] to conform to this provider's path context.
+  /// Convert the given posix [filePath] to conform to to the platform style.
   ///
   /// This is a utility method for testing; paths passed in to other methods in
   /// this class are never converted automatically.
-  String _p(String filePath) {
+  String _posixToPlatformPath(String filePath) {
     if (filePath == null) {
       return null;
     }
     if (path.style == path.windows.style) {
-      filePath =
-          filePath.replaceAll(path.posix.separator, path.windows.separator);
+      filePath = filePath.replaceAll(
+        path.posix.separator,
+        path.windows.separator,
+      );
     }
     return filePath;
   }
@@ -458,7 +426,7 @@
     args.add('--build-summary-output=${pkg.sum}');
     args.add('--summary-deps-output=${pkg.dep}');
 
-    await _doDrive(pkg.path, uri: pkg.uri, additionalArgs: args);
+    await _doDrive(pkg.path, fileUri: pkg.uri, additionalArgs: args);
     expect(exitCode, 0);
 
     return pkg;
@@ -510,7 +478,7 @@
 ''');
 
       await _doDrive(aDart,
-          uri: aUri, additionalArgs: ['--build-summary-output=$aSum']);
+          fileUri: aUri, additionalArgs: ['--build-summary-output=$aSum']);
       expect(exitCode, ErrorSeverity.ERROR.ordinal);
       var bytes = File(aSum).readAsBytesSync();
       var bundle = PackageBundle.fromBuffer(bytes);
@@ -560,7 +528,7 @@
       // Analyze package:aaa/a.dart and compute summary.
       {
         await _doDrive(aDart,
-            uri: aUri, additionalArgs: ['--build-summary-output=$aSum']);
+            fileUri: aUri, additionalArgs: ['--build-summary-output=$aSum']);
         expect(exitCode, 0);
         var bytes = File(aSum).readAsBytesSync();
         var bundle = PackageBundle.fromBuffer(bytes);
@@ -571,7 +539,7 @@
 
       // Analyze package:bbb/b.dart and compute summary.
       {
-        await _doDrive(bDart, uri: bUri, additionalArgs: [
+        await _doDrive(bDart, fileUri: bUri, additionalArgs: [
           '--build-summary-input=$aSum',
           '--build-summary-output=$bSum'
         ]);
@@ -585,7 +553,7 @@
 
       // Analyze package:ccc/c.dart and compute summary.
       {
-        await _doDrive(cDart, uri: cUri, additionalArgs: [
+        await _doDrive(cDart, fileUri: cUri, additionalArgs: [
           '--build-summary-input=$aSum,$bSum',
           '--build-summary-output=$cSum'
         ]);
@@ -599,35 +567,17 @@
     });
   }
 
-  Future<void> test_dartSdkSummaryPath_strong() async {
-    await withTempDirAsync((tempDir) async {
-      var sdkPath = _findSdkDirForSummaries();
-      var strongSummaryPath =
-          path.join(sdkPath, 'lib', '_internal', 'strong.sum');
-
-      var testDart = path.join(tempDir, 'test.dart');
-      var testSum = path.join(tempDir, 'test.sum');
-      File(testDart).writeAsStringSync('var v = 42;');
-
-      await _doDrive(testDart,
-          additionalArgs: [
-            '--build-summary-only',
-            '--build-summary-output=$testSum'
-          ],
-          dartSdkSummaryPath: strongSummaryPath);
-      var output = File(testSum);
-      expect(output.existsSync(), isTrue);
-      expect(exitCode, 0);
-    });
-  }
-
   Future<void> test_error_notUriPipePath() async {
     await withTempDirAsync((tempDir) async {
       var testDart = path.join(tempDir, 'test.dart');
       File(testDart).writeAsStringSync('var v = 42;');
 
       // We pass just path, not "uri|path", this is a fatal error.
-      await drive(testDart, args: ['--build-mode', '--format=machine']);
+      await _doDrive(
+        testDart,
+        additionalArgs: ['--build-mode', '--format=machine'],
+        sourceArgument: testDart,
+      );
       expect(exitCode, ErrorSeverity.ERROR.ordinal);
     });
   }
@@ -667,7 +617,7 @@
 
       // Analyze b.dart (part) and then a.dart (its library).
       // No errors should be reported - the part should know its library.
-      await _doDrive(bDart, uri: bUri, additionalArgs: ['$aUri|$aDart']);
+      await _doDrive(bDart, fileUri: bUri, additionalArgs: ['$aUri|$aDart']);
       expect(errorSink, isEmpty);
     });
   }
diff --git a/pkg/analyzer_cli/test/options_test.dart b/pkg/analyzer_cli/test/options_test.dart
index 9c3b28f..d427a0e 100644
--- a/pkg/analyzer_cli/test/options_test.dart
+++ b/pkg/analyzer_cli/test/options_test.dart
@@ -251,7 +251,7 @@
       });
     });
   });
-  defineReflectiveTests(CommandLineOptionsTest);
+  defineReflectiveTests(CommandLineOptions_BuildMode_Test);
 }
 
 @reflectiveTest
@@ -285,35 +285,45 @@
 }
 
 @reflectiveTest
-class CommandLineOptionsTest extends AbstractStatusTest {
+class CommandLineOptions_BuildMode_Test extends AbstractStatusTest {
   CommandLineOptions options;
+  String failureMessage;
 
   void test_buildAnalysisOutput() {
-    _parse([
-      '--build-mode',
+    _parseBuildMode([
       '--build-analysis-output=//path/to/output.analysis',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isTrue);
     expect(options.buildAnalysisOutput, '//path/to/output.analysis');
   }
 
   void test_buildMode() {
-    _parse(['--build-mode', 'package:p/foo.dart|/path/to/p/lib/foo.dart']);
+    _parseBuildMode([
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
+    ]);
     expect(options.buildMode, isTrue);
   }
 
   void test_buildMode_allowsEmptyFileList() {
-    _parse(['--build-mode']);
+    _parseBuildMode([]);
     expect(options.buildMode, isTrue);
     expect(options.sourceFiles, isEmpty);
   }
 
+  void test_buildMode_noDartSdkSummary() {
+    _parseBuildMode(
+      ['package:aaa/a.dart|/aaa/lib/a.dart'],
+      withDartSdkSummary: false,
+    );
+    expect(options, isNull);
+    expect(failureMessage, contains('--dart-sdk-summary'));
+  }
+
   void test_buildSummaryInputs_commaSeparated() {
-    _parse([
-      '--build-mode',
+    _parseBuildMode([
       '--build-summary-input=/path/to/aaa.sum,/path/to/bbb.sum',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isTrue);
     expect(
@@ -323,7 +333,7 @@
   void test_buildSummaryInputs_commaSeparated_normalMode() {
     _parse([
       '--build-summary-input=/path/to/aaa.sum,/path/to/bbb.sum',
-      '/path/to/p/lib/foo.dart'
+      '/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isFalse);
     expect(
@@ -331,11 +341,10 @@
   }
 
   void test_buildSummaryInputs_separateFlags() {
-    _parse([
-      '--build-mode',
+    _parseBuildMode([
       '--build-summary-input=/path/to/aaa.sum',
       '--build-summary-input=/path/to/bbb.sum',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isTrue);
     expect(
@@ -346,7 +355,7 @@
     _parse([
       '--build-summary-input=/path/to/aaa.sum',
       '--build-summary-input=/path/to/bbb.sum',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isFalse);
     expect(
@@ -354,47 +363,58 @@
   }
 
   void test_buildSummaryOnly() {
-    _parse([
-      '--build-mode',
+    _parseBuildMode([
       '--build-summary-output=/path/to/aaa.sum',
       '--build-summary-only',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isTrue);
     expect(options.buildSummaryOnly, isTrue);
   }
 
   void test_buildSummaryOutput() {
-    _parse([
-      '--build-mode',
+    _parseBuildMode([
       '--build-summary-output=//path/to/output.sum',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isTrue);
     expect(options.buildSummaryOutput, '//path/to/output.sum');
   }
 
   void test_buildSummaryOutputSemantic() {
-    _parse([
-      '--build-mode',
+    _parseBuildMode([
       '--build-summary-output-semantic=//path/to/output.sum',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isTrue);
     expect(options.buildSummaryOutputSemantic, '//path/to/output.sum');
   }
 
   void test_buildSuppressExitCode() {
-    _parse([
-      '--build-mode',
+    _parseBuildMode([
       '--build-suppress-exit-code',
-      'package:p/foo.dart|/path/to/p/lib/foo.dart'
+      'package:p/foo.dart|/path/to/p/lib/foo.dart',
     ]);
     expect(options.buildMode, isTrue);
     expect(options.buildSuppressExitCode, isTrue);
   }
 
   void _parse(List<String> args) {
-    options = CommandLineOptions.parse(args);
+    options = CommandLineOptions.parse(args, printAndFail: (msg) {
+      failureMessage = msg;
+    });
+  }
+
+  void _parseBuildMode(List<String> specificArguments,
+      {bool withDartSdkSummary = true}) {
+    var args = [
+      '--build-mode',
+      if (withDartSdkSummary) ...[
+        '--dart-sdk-summary',
+        '/sdk/lib/strong.sum',
+      ],
+      ...specificArguments
+    ];
+    _parse(args);
   }
 }
diff --git a/pkg/analyzer_plugin/CHANGELOG.md b/pkg/analyzer_plugin/CHANGELOG.md
index c9543da..43fa9c2 100644
--- a/pkg/analyzer_plugin/CHANGELOG.md
+++ b/pkg/analyzer_plugin/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 0.2.3
+- Added class `Relevance`.
+- Removed `FixKind.name`, replaced with `FixKind.id`.  Technically this is a
+  breaking change but we believe that in practice it is benign, since
+  `FixKind.name` was only used for debugging.
+- Added function `computeDartNavigation`.
+
 ## 0.2.2
 - Change supported analyzer version to `^0.39.0`
 
diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
index c2683e3..7d53182 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
@@ -975,14 +975,24 @@
       optype.isPrefixed = true;
     } else if (identical(entity, node.methodName)) {
       optype.includeReturnValueSuggestions = true;
-//      optype.includeTypeNameSuggestions = !isThis;
       optype.includeVoidReturnSuggestions = true;
       optype.isPrefixed = true;
     } else if (identical(entity, node.argumentList)) {
       // Note that when the cursor is in a type argument list (f<^>()), the
       // entity is (surprisingly) the invocation's argumentList (and not it's
       // typeArgumentList as you'd expect).
-      optype.completionLocation = 'MethodInvocation_argumentList';
+      if (offset < node.argumentList.offset) {
+        optype.completionLocation = 'TypeArgumentList_argument';
+      } else {
+        var argKind = 'unnamed';
+        var method = node.methodName.staticElement;
+        if (method is MethodElement &&
+            method.parameters.isNotEmpty &&
+            method.parameters[0].isNamed) {
+          argKind = 'named';
+        }
+        optype.completionLocation = 'ArgumentList_method_$argKind';
+      }
       optype.includeTypeNameSuggestions = true;
     }
   }
diff --git a/pkg/analyzer_plugin/pubspec.yaml b/pkg/analyzer_plugin/pubspec.yaml
index 2975a31..9b537c1 100644
--- a/pkg/analyzer_plugin/pubspec.yaml
+++ b/pkg/analyzer_plugin/pubspec.yaml
@@ -1,6 +1,6 @@
 name: analyzer_plugin
 description: A framework and support code for building plugins for the analysis server.
-version: 0.2.2
+version: 0.2.3
 author: Dart Team <misc@dartlang.org>
 homepage: https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_plugin
 
diff --git a/pkg/analyzer_plugin/test/plugin/mocks.dart b/pkg/analyzer_plugin/test/plugin/mocks.dart
index 8f18c06..6d466d2 100644
--- a/pkg/analyzer_plugin/test/plugin/mocks.dart
+++ b/pkg/analyzer_plugin/test/plugin/mocks.dart
@@ -3,16 +3,12 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:async';
-import 'dart:collection';
 
 import 'package:analyzer/dart/analysis/results.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/context/packages.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
-import 'package:analyzer/src/dart/analysis/file_state.dart';
-import 'package:analyzer/src/generated/engine.dart'
-    show AnalysisOptionsImpl, TimestampedData;
+import 'package:analyzer/src/generated/engine.dart' show TimestampedData;
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/timestamped_data.dart';
 import 'package:analyzer_plugin/channel/channel.dart';
@@ -22,41 +18,22 @@
 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
 import 'package:test/test.dart';
 
-class MockAnalysisDriver extends AnalysisDriver {
+class MockAnalysisDriver implements AnalysisDriver {
   @override
-  Set<String> addedFiles = HashSet<String>();
-
-  MockAnalysisDriver()
-      : super(
-            AnalysisDriverScheduler(null),
-            null,
-            MockResourceProvider(),
-            null,
-            FileContentOverlay(),
-            null,
-            SourceFactory([]),
-            AnalysisOptionsImpl(),
-            packages: Packages.empty);
-
-  @override
-  bool get hasFilesToAnalyze => false;
+  final Set<String> addedFiles = {};
 
   @override
   set priorityFiles(List<String> priorityPaths) {}
 
   @override
-  AnalysisDriverPriority get workPriority => AnalysisDriverPriority.nothing;
-
-  @override
   void addFile(String path) {
     addedFiles.add(path);
   }
 
   @override
-  void dispose() {}
-
-  @override
-  Future<Null> performWork() => Future.value(null);
+  dynamic noSuchMethod(Invocation invocation) {
+    return super.noSuchMethod(invocation);
+  }
 }
 
 class MockChannel implements PluginCommunicationChannel {
diff --git a/pkg/compiler/README.md b/pkg/compiler/README.md
index f9fc05c..f4e2a49 100644
--- a/pkg/compiler/README.md
+++ b/pkg/compiler/README.md
@@ -284,7 +284,7 @@
   added to make it easier to create a `MockCompiler` implementation for unit
   testing. The `MockCompiler` has been replaced in most unit tests by a regular
   `CompilerImpl` that uses a mock of the file-system (see
-  `tests/compiler/dart2js/memory_compiler.dart`).
+  `pkg/compiler/test/memory_compiler.dart`).
 
   AI: Once all tests are migrated to this memory compiler, we should merge
   `Compiler` and `CompilerImpl` and remove this file.
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 7b300b0..7e909f2 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -650,7 +650,7 @@
 
   @override
   DiagnosticMessage createMessage(Spannable spannable, MessageKind messageKind,
-      [Map arguments = const {}]) {
+      [Map<String, String> arguments = const {}]) {
     SourceSpan span = spanFromSpannable(spannable);
     MessageTemplate template = MessageTemplate.TEMPLATES[messageKind];
     Message message = template.message(arguments, options);
@@ -678,7 +678,7 @@
   @deprecated
   @override
   void reportInfo(Spannable node, MessageKind messageKind,
-      [Map arguments = const {}]) {
+      [Map<String, String> arguments = const {}]) {
     reportDiagnosticInternal(createMessage(node, messageKind, arguments),
         const <DiagnosticMessage>[], api.Diagnostic.INFO);
   }
@@ -899,9 +899,11 @@
           kind = MessageKind.HIDDEN_WARNINGS;
         }
         MessageTemplate template = MessageTemplate.TEMPLATES[kind];
-        Message message = template.message(
-            {'warnings': info.warnings, 'hints': info.hints, 'uri': uri},
-            options);
+        Message message = template.message({
+          'warnings': info.warnings.toString(),
+          'hints': info.hints.toString(),
+          'uri': uri.toString(),
+        }, options);
         reportDiagnostic(new DiagnosticMessage(null, null, message),
             const <DiagnosticMessage>[], api.Diagnostic.HINT);
       });
diff --git a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
index e44df31..554e809 100644
--- a/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
+++ b/pkg/compiler/lib/src/diagnostics/diagnostic_listener.dart
@@ -26,7 +26,7 @@
   SourceSpan spanFromSpannable(Spannable node);
 
   void reportErrorMessage(Spannable spannable, MessageKind messageKind,
-      [Map arguments = const {}]) {
+      [Map<String, String> arguments = const {}]) {
     reportError(createMessage(spannable, messageKind, arguments));
   }
 
@@ -34,7 +34,7 @@
       [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]);
 
   void reportWarningMessage(Spannable spannable, MessageKind messageKind,
-      [Map arguments = const {}]) {
+      [Map<String, String> arguments = const {}]) {
     reportWarning(createMessage(spannable, messageKind, arguments));
   }
 
@@ -42,7 +42,7 @@
       [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]);
 
   void reportHintMessage(Spannable spannable, MessageKind messageKind,
-      [Map arguments = const {}]) {
+      [Map<String, String> arguments = const {}]) {
     reportHint(createMessage(spannable, messageKind, arguments));
   }
 
@@ -51,14 +51,14 @@
 
   @deprecated
   void reportInfo(Spannable node, MessageKind errorCode,
-      [Map arguments = const {}]);
+      [Map<String, String> arguments = const {}]);
 
   /// Set current element of this reporter to [element]. This is used for
   /// creating [SourceSpan] in [spanFromSpannable].
   withCurrentElement(Entity element, f());
 
   DiagnosticMessage createMessage(Spannable spannable, MessageKind messageKind,
-      [Map arguments = const {}]);
+      [Map<String, String> arguments = const {}]);
 
   /// Returns `true` if a crash, an error or a fatal warning has been reported.
   bool get hasReportedError;
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index 09f7fab..33d7b23 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -14,12 +14,8 @@
 /// location of the existing element.
 library dart2js.messages;
 
-import 'package:front_end/src/api_unstable/dart2js.dart' show tokenToString;
-
 import 'generated/shared_messages.dart' as shared_messages;
-import '../constants/values.dart' show ConstantValue;
 import '../commandline_options.dart';
-import '../elements/types.dart';
 import '../options.dart';
 import 'invariant.dart' show failedAt;
 import 'spannable.dart' show CURRENT_ELEMENT_SPANNABLE;
@@ -134,7 +130,7 @@
   final String howToFix;
 
   ///  Examples will be checked by
-  ///  tests/compiler/dart2js/message_kind_test.dart.
+  ///  pkg/compiler/test/message_kind_test.dart.
   ///
   ///  An example is either a String containing the example source code or a Map
   ///  from filenames to source code. In the latter case, the filename for the
@@ -650,7 +646,7 @@
   @override
   String toString() => template;
 
-  Message message(Map arguments, CompilerOptions options) {
+  Message message(Map<String, String> arguments, CompilerOptions options) {
     return new Message(this, arguments, options);
   }
 
@@ -659,11 +655,9 @@
 
 class Message {
   final MessageTemplate template;
-  final Map arguments;
+  final Map<String, String> arguments;
   final CompilerOptions _options;
   bool get terse => _options?.terseDiagnostics ?? false;
-  bool get _printLegacyStars => _options?.printLegacyStars ?? false;
-  bool get _useLegacySubtyping => _options?.useLegacySubtyping ?? false;
   String message;
 
   Message(this.template, this.arguments, this._options) {
@@ -678,8 +672,8 @@
   String computeMessage() {
     if (message == null) {
       message = template.template;
-      arguments.forEach((key, value) {
-        message = message.replaceAll('#{${key}}', convertToString(value));
+      arguments.forEach((String key, String value) {
+        message = message.replaceAll('#{$key}', value);
       });
       assert(
           kind == MessageKind.GENERIC ||
@@ -688,8 +682,8 @@
               'Missing arguments in error message: "$message"'));
       if (!terse && template.hasHowToFix) {
         String howToFix = template.howToFix;
-        arguments.forEach((key, value) {
-          howToFix = howToFix.replaceAll('#{${key}}', convertToString(value));
+        arguments.forEach((String key, String value) {
+          howToFix = howToFix.replaceAll('#{$key}', value);
         });
         message = '$message\n$howToFix';
       }
@@ -710,17 +704,4 @@
 
   @override
   int get hashCode => throw new UnsupportedError('Message.hashCode');
-
-  String convertToString(value) {
-    if (value is DartType) {
-      value = value.toStructuredText(
-          printLegacyStars: _printLegacyStars,
-          useLegacySubtyping: _useLegacySubtyping);
-    } else if (value is ConstantValue) {
-      value = value.toDartText();
-    } else {
-      value = tokenToString(value);
-    }
-    return '$value';
-  }
 }
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
index 96702e1..022604e 100644
--- a/pkg/compiler/lib/src/elements/types.dart
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -4,6 +4,7 @@
 
 import '../common/names.dart';
 import '../common_elements.dart';
+import '../options.dart';
 import '../serialization/serialization.dart';
 import '../util/util.dart' show equalElements, equalSets, identicalElements;
 import 'entities.dart';
@@ -91,17 +92,6 @@
   /// returns this type otherwise.
   DartType get withoutNullability => this;
 
-  /// Is `true` if this type is a top type but not a legacy top type.
-  bool _isStrongTop(bool useLegacySubtyping) => false;
-
-  /// Is `true` if this type is a top type.
-  bool _isTop(bool useLegacySubtyping) => _isStrongTop(useLegacySubtyping);
-
-  /// Is `true` if every type argument of this type is a top type.
-  // TODO(fishythefish): Should we instead check if each type argument is at its
-  // bound?
-  bool _treatAsRaw(bool useLegacySubtyping) => true;
-
   /// Whether this type contains a type variable.
   bool get containsTypeVariables => false;
 
@@ -128,11 +118,10 @@
   bool _equals(DartType other, _Assumptions assumptions);
 
   @override
-  String toString() => toStructuredText();
+  String toString() => toStructuredText(null, null);
 
-  String toStructuredText(
-          {bool printLegacyStars = true, bool useLegacySubtyping = false}) =>
-      _DartTypeToStringVisitor(printLegacyStars, useLegacySubtyping).run(this);
+  String toStructuredText(DartTypes dartTypes, CompilerOptions options) =>
+      _DartTypeToStringVisitor(dartTypes, options).run(this);
 }
 
 /// Pairs of [FunctionTypeVariable]s that are currently assumed to be
@@ -233,13 +222,6 @@
   DartType get withoutNullability => baseType;
 
   @override
-  bool _isTop(bool useLegacySubtyping) => baseType.isObject;
-
-  @override
-  bool _treatAsRaw(bool useLegacySubtyping) =>
-      baseType._treatAsRaw(useLegacySubtyping);
-
-  @override
   bool get containsTypeVariables => baseType.containsTypeVariables;
 
   @override
@@ -295,13 +277,6 @@
   DartType get withoutNullability => baseType;
 
   @override
-  bool _isStrongTop(bool useLegacySubtyping) => baseType.isObject;
-
-  @override
-  bool _treatAsRaw(bool useLegacySubtyping) =>
-      baseType._treatAsRaw(useLegacySubtyping);
-
-  @override
   bool get containsTypeVariables => baseType.containsTypeVariables;
 
   @override
@@ -357,9 +332,6 @@
   }
 
   @override
-  bool _isTop(bool useLegacySubtyping) => useLegacySubtyping && isObject;
-
-  @override
   bool get isObject =>
       element.name == 'Object' &&
       element.library.canonicalUri == Uris.dart_core;
@@ -378,14 +350,6 @@
   }
 
   @override
-  bool _treatAsRaw(bool useLegacySubtyping) {
-    for (DartType type in typeArguments) {
-      if (!type._isTop(useLegacySubtyping)) return false;
-    }
-    return true;
-  }
-
-  @override
   R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
       visitor.visitInterfaceType(this, argument);
 
@@ -565,9 +529,6 @@
   }
 
   @override
-  bool _isStrongTop(bool useLegacySubtyping) => true;
-
-  @override
   R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
       visitor.visitVoidType(this, argument);
 
@@ -595,9 +556,6 @@
   }
 
   @override
-  bool _isStrongTop(bool useLegacySubtyping) => true;
-
-  @override
   R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
       visitor.visitDynamicType(this, argument);
 
@@ -625,9 +583,6 @@
   }
 
   @override
-  bool _isStrongTop(bool useLegacySubtyping) => true;
-
-  @override
   R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
       visitor.visitErasedType(this, argument);
 
@@ -666,9 +621,6 @@
   }
 
   @override
-  bool _isStrongTop(bool useLegacySubtyping) => true;
-
-  @override
   R accept<R, A>(DartTypeVisitor<R, A> visitor, A argument) =>
       visitor.visitAnyType(this, argument);
 
@@ -1525,15 +1477,15 @@
 }
 
 class _DartTypeToStringVisitor extends DartTypeVisitor<void, void> {
-  final bool _printLegacyStars;
-  final bool _useLegacySubtyping;
+  final DartTypes _dartTypes; // May be null.
+  final CompilerOptions _options; // May be null.
   final List _fragments = []; // Strings and _DeferredNames
   bool _lastIsIdentifier = false;
   List<FunctionTypeVariable> _boundVariables;
   Map<FunctionTypeVariable, _DeferredName> _variableToName;
   Set<FunctionType> _genericFunctions;
 
-  _DartTypeToStringVisitor(this._printLegacyStars, this._useLegacySubtyping);
+  _DartTypeToStringVisitor(this._dartTypes, this._options);
 
   String run(DartType type) {
     _visit(type);
@@ -1596,7 +1548,7 @@
     // internal notion. The language specification does not define a '*' token
     // in the type language, and no such token should be surfaced to users.
     // For debugging, pass `--debug-print-legacy-stars` to emit the '*'.
-    if (_printLegacyStars) {
+    if (_options == null || _options.printLegacyStars) {
       _token('*');
     }
   }
@@ -1685,7 +1637,7 @@
         needsComma = _comma(needsComma);
         _visit(typeVariable);
         DartType bound = typeVariable.bound;
-        if (!bound._isTop(_useLegacySubtyping)) {
+        if (_dartTypes == null || !_dartTypes.isTopType(bound)) {
           _token(' extends ');
           _visit(bound);
         }
@@ -1916,12 +1868,32 @@
   /// Returns `true` if every type argument of [t] is a top type.
   // TODO(fishythefish): Should we instead check if each type argument is at its
   // bound?
-  bool treatAsRawType(DartType t) => t._treatAsRaw(useLegacySubtyping);
+  bool treatAsRawType(DartType t) {
+    t = t.withoutNullability;
+    if (t is InterfaceType) {
+      for (DartType type in t.typeArguments) {
+        if (!isTopType(type)) return false;
+      }
+    }
+    return true;
+  }
+
+  /// Returns `true` if [t] is a bottom type, that is, a subtype of every type.
+  bool isBottomType(DartType t) =>
+      t is NeverType || (useLegacySubtyping && t.isNull);
 
   /// Returns `true` if [t] is a top type, that is, a supertype of every type.
-  bool isTopType(DartType t) => t._isTop(useLegacySubtyping);
+  bool isTopType(DartType t) =>
+      isStrongTopType(t) ||
+      t is LegacyType && t.baseType.isObject ||
+      useLegacySubtyping && t.isObject;
 
-  bool isStrongTopType(DartType t) => t._isStrongTop(useLegacySubtyping);
+  bool isStrongTopType(DartType t) =>
+      t is VoidType ||
+      t is DynamicType ||
+      t is ErasedType ||
+      t is AnyType ||
+      t is NullableType && t.baseType.isObject;
 
   /// Returns `true` if [s] is a subtype of [t].
   bool isSubtype(DartType s, DartType t) => _subtypeHelper(s, t);
@@ -1967,11 +1939,7 @@
       if (isStrongTopType(s)) return false;
 
       // Left Bottom:
-      if (useLegacySubtyping) {
-        if (s.isNull) return true;
-      } else {
-        if (s is NeverType) return true;
-      }
+      if (isBottomType(s)) return true;
 
       // Left Type Variable Bound 1:
       if (s is TypeVariableType) {
diff --git a/pkg/compiler/lib/src/kernel/kernel_impact.dart b/pkg/compiler/lib/src/kernel/kernel_impact.dart
index 7e1739f..1698b28 100644
--- a/pkg/compiler/lib/src/kernel/kernel_impact.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_impact.dart
@@ -131,6 +131,9 @@
   ConstantValuefier get _constantValuefier;
   ir.StaticTypeContext get staticTypeContext;
 
+  String typeToString(DartType type) =>
+      type.toStructuredText(dartTypes, _options);
+
   Object _computeReceiverConstraint(
       ir.DartType receiverType, ClassRelation relation) {
     if (receiverType is ir.InterfaceType) {
@@ -367,7 +370,7 @@
         reporter.reportErrorMessage(
             CURRENT_ELEMENT_SPANNABLE,
             MessageKind.STRING_EXPECTED,
-            {'type': value.getType(elementMap.commonElements)});
+            {'type': typeToString(value.getType(elementMap.commonElements))});
         return;
       }
       StringConstantValue stringValue = value;
@@ -871,7 +874,7 @@
             reporter.reportErrorMessage(
                 computeSourceSpanFromTreeNode(firstCase),
                 MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS,
-                {'type': type});
+                {'type': typeToString(type)});
           }
         } else {
           if (type != firstCaseType) {
@@ -879,16 +882,16 @@
               error = reporter.createMessage(
                   computeSourceSpanFromTreeNode(node),
                   MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL,
-                  {'type': firstCaseType});
+                  {'type': typeToString(firstCaseType)});
               infos.add(reporter.createMessage(
                   computeSourceSpanFromTreeNode(firstCase),
                   MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
-                  {'type': firstCaseType}));
+                  {'type': typeToString(firstCaseType)}));
             }
             infos.add(reporter.createMessage(
                 computeSourceSpanFromTreeNode(expression),
                 MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL_CASE,
-                {'type': type}));
+                {'type': typeToString(type)}));
           }
         }
       }
diff --git a/tests/compiler/dart2js/analyses/analysis_helper.dart b/pkg/compiler/test/analyses/analysis_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/analyses/analysis_helper.dart
rename to pkg/compiler/test/analyses/analysis_helper.dart
diff --git a/tests/compiler/dart2js/analyses/analyze_test.dart b/pkg/compiler/test/analyses/analyze_test.dart
similarity index 100%
rename from tests/compiler/dart2js/analyses/analyze_test.dart
rename to pkg/compiler/test/analyses/analyze_test.dart
diff --git a/tests/compiler/dart2js/analyses/api_allowed.json b/pkg/compiler/test/analyses/api_allowed.json
similarity index 74%
rename from tests/compiler/dart2js/analyses/api_allowed.json
rename to pkg/compiler/test/analyses/api_allowed.json
index fec741e..b0b2932 100644
--- a/tests/compiler/dart2js/analyses/api_allowed.json
+++ b/pkg/compiler/test/analyses/api_allowed.json
@@ -1,12 +1,12 @@
 {
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_number.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_number.dart": {
     "Dynamic invocation of '[]'.": 5,
     "Dynamic invocation of '<'.": 4,
     "Dynamic invocation of '>='.": 1,
     "Dynamic invocation of '<='.": 1,
     "Dynamic invocation of '>'.": 2
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_helper.dart": {
     "Dynamic invocation of '[]'.": 3,
     "Dynamic access of 'isNaN'.": 3,
     "Dynamic invocation of '<='.": 2,
@@ -18,7 +18,7 @@
     "Dynamic invocation of '>'.": 1,
     "Dynamic access of 'length'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/string_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/string_helper.dart": {
     "Dynamic invocation of '<'.": 1,
     "Dynamic invocation of '+'.": 1,
     "Dynamic invocation of '>='.": 1,
@@ -35,39 +35,39 @@
     "Dynamic access of 'iterator'.": 2,
     "Dynamic invocation of 'replaceRange'.": 2
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/linked_hash_map.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/linked_hash_map.dart": {
     "Dynamic access of '_js_helper::_length'.": 2,
     "Dynamic access of '_js_helper::_modifications'.": 4,
     "Dynamic invocation of 'containsKey'.": 1,
     "Dynamic access of '_js_helper::_first'.": 2
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_rti.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_rti.dart": {
     "Dynamic invocation of '<'.": 1,
     "Dynamic invocation of '-'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/native_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/native_helper.dart": {
     "Dynamic access of 'length'.": 2,
     "Dynamic invocation of '[]'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/regexp_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/regexp_helper.dart": {
     "Dynamic access of 'length'.": 1,
     "Dynamic invocation of '-'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/native_typed_data.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/native_typed_data.dart": {
     "Dynamic invocation of '>'.": 1,
     "Dynamic invocation of '|'.": 3,
     "Dynamic invocation of '>='.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/async_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart": {
     "Dynamic invocation of '-'.": 1,
     "Dynamic access of 'iterator'.": 1,
     "Dynamic invocation of 'call'.": 4,
     "Dynamic invocation of 'then'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/async/async_error.dart": {
+  "org-dartlang-sdk:///lib/async/async_error.dart": {
     "Dynamic invocation of 'call'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/collection_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/collection_patch.dart": {
     "Dynamic access of 'dart.collection::_length'.": 2,
     "Dynamic invocation of 'dart.collection::_computeKeys'.": 2,
     "Dynamic invocation of 'containsKey'.": 2,
@@ -80,7 +80,7 @@
     "Dynamic access of 'dart.collection::_element'.": 1,
     "Dynamic access of 'dart.collection::_first'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/html/dart2js/html_dart2js.dart": {
+  "org-dartlang-sdk:///lib/html/dart2js/html_dart2js.dart": {
     "Dynamic access of 'style'.": 1,
     "Dynamic invocation of 'remove'.": 2,
     "Dynamic update to 'dart.dom.html::_innerHtml'.": 1,
@@ -97,31 +97,31 @@
     "Dynamic invocation of 'attributeChanged'.": 1,
     "Dynamic invocation of 'createElement'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/html/html_common/conversions.dart": {
+  "org-dartlang-sdk:///lib/html/html_common/conversions.dart": {
     "Dynamic invocation of '[]='.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/html/html_common/filtered_element_list.dart": {
+  "org-dartlang-sdk:///lib/html/html_common/filtered_element_list.dart": {
     "Dynamic invocation of 'remove'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/indexed_db/dart2js/indexed_db_dart2js.dart": {
+  "org-dartlang-sdk:///lib/indexed_db/dart2js/indexed_db_dart2js.dart": {
     "Dynamic access of 'onUpgradeNeeded'.": 1,
     "Dynamic invocation of 'listen'.": 2,
     "Dynamic access of 'onBlocked'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/io/directory_impl.dart": {
+  "org-dartlang-sdk:///lib/io/directory_impl.dart": {
     "Dynamic invocation of '[]'.": 10
   },
-  "org-dartlang-sdk:///sdk/lib/io/file_impl.dart": {
+  "org-dartlang-sdk:///lib/io/file_impl.dart": {
     "Dynamic invocation of 'cancel'.": 1,
     "Dynamic invocation of 'pause'.": 1,
     "Dynamic invocation of 'resume'.": 1,
     "Dynamic invocation of '[]'.": 4,
     "Dynamic access of 'length'.": 2
   },
-  "org-dartlang-sdk:///sdk/lib/io/file_system_entity.dart": {
+  "org-dartlang-sdk:///lib/io/file_system_entity.dart": {
     "Dynamic invocation of '[]'.": 7
   },
-  "org-dartlang-sdk:///sdk/lib/io/io_resource_info.dart": {
+  "org-dartlang-sdk:///lib/io/io_resource_info.dart": {
     "Dynamic invocation of 'containsKey'.": 1,
     "Dynamic invocation of '[]'.": 1,
     "Dynamic access of 'path'.": 1,
@@ -139,19 +139,19 @@
     "Dynamic access of 'type'.": 1,
     "Dynamic access of 'name'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/io/link.dart": {
+  "org-dartlang-sdk:///lib/io/link.dart": {
     "Dynamic invocation of '[]'.": 3
   },
-  "org-dartlang-sdk:///sdk/lib/io/platform_impl.dart": {
+  "org-dartlang-sdk:///lib/io/platform_impl.dart": {
     "Dynamic invocation of 'indexOf'.": 1,
     "Dynamic invocation of '>'.": 1,
     "Dynamic invocation of 'substring'.": 2,
     "Dynamic invocation of '+'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/io/secure_server_socket.dart": {
+  "org-dartlang-sdk:///lib/io/secure_server_socket.dart": {
     "Dynamic update to 'dart.io::_owner'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/io/secure_socket.dart": {
+  "org-dartlang-sdk:///lib/io/secure_socket.dart": {
     "Dynamic invocation of '[]'.": 10,
     "Dynamic invocation of 'dart.io::_detachRaw'.": 2,
     "Dynamic access of 'closedReadEventSent'.": 1,
@@ -161,48 +161,48 @@
     "Dynamic invocation of '+'.": 2,
     "Dynamic invocation of '-'.": 7
   },
-  "org-dartlang-sdk:///sdk/lib/io/stdio.dart": {
+  "org-dartlang-sdk:///lib/io/stdio.dart": {
     "Dynamic invocation of 'writeFromSync'.": 1,
     "Dynamic invocation of 'cancel'.": 1,
     "Dynamic invocation of 'closeSync'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/io/common.dart": {
+  "org-dartlang-sdk:///lib/io/common.dart": {
     "Dynamic invocation of '[]'.": 3
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_patch.dart": {
     "Dynamic invocation of '[]'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/svg/dart2js/svg_dart2js.dart": {
+  "org-dartlang-sdk:///lib/svg/dart2js/svg_dart2js.dart": {
     "Dynamic invocation of 'createFragment'.": 1,
     "Dynamic access of 'nodes'.": 1,
     "Dynamic invocation of 'where'.": 1,
     "Dynamic access of 'single'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/core/errors.dart": {
+  "org-dartlang-sdk:///lib/core/errors.dart": {
     "Dynamic access of 'length'.": 2
   },
-  "org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/convert_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/convert_patch.dart": {
     "Dynamic invocation of 'clear'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/convert/json.dart": {
+  "org-dartlang-sdk:///lib/convert/json.dart": {
     "Dynamic invocation of 'toJson'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_http/crypto.dart": {
+  "org-dartlang-sdk:///lib/_http/crypto.dart": {
     "Dynamic invocation of '+'.": 2,
     "Dynamic invocation of '&'.": 3,
     "Dynamic invocation of 'unary-'.": 1,
     "Dynamic invocation of '-'.": 2
   },
-  "org-dartlang-sdk:///sdk/lib/_http/http_date.dart": {
+  "org-dartlang-sdk:///lib/_http/http_date.dart": {
     "Dynamic access of 'length'.": 3,
     "Dynamic invocation of '<'.": 1,
     "Dynamic invocation of '>='.": 2,
     "Dynamic invocation of '[]'.": 7
   },
-  "org-dartlang-sdk:///sdk/lib/_http/http_headers.dart": {
+  "org-dartlang-sdk:///lib/_http/http_headers.dart": {
     "Dynamic invocation of 'toLowerCase'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_http/http_impl.dart": {
+  "org-dartlang-sdk:///lib/_http/http_impl.dart": {
     "Dynamic access of 'message'.": 3,
     "Dynamic invocation of 'trim'.": 1,
     "Dynamic invocation of 'toLowerCase'.": 1,
@@ -219,10 +219,10 @@
     "Dynamic invocation of 'listen'.": 1,
     "Dynamic invocation of 'close'.": 1
   },
-  "org-dartlang-sdk:///sdk/lib/_http/websocket_impl.dart": {
+  "org-dartlang-sdk:///lib/_http/websocket_impl.dart": {
     "Dynamic access of 'address'.": 1,
     "Dynamic access of 'host'.": 1,
     "Dynamic access of 'port'.": 1,
     "Dynamic invocation of 'dart._http::_toJSON'.": 1
   }
-}
\ No newline at end of file
+}
diff --git a/tests/compiler/dart2js/analyses/api_allowed_nnbd.json b/pkg/compiler/test/analyses/api_allowed_nnbd.json
similarity index 71%
rename from tests/compiler/dart2js/analyses/api_allowed_nnbd.json
rename to pkg/compiler/test/analyses/api_allowed_nnbd.json
index e32d5da..e303631 100644
--- a/tests/compiler/dart2js/analyses/api_allowed_nnbd.json
+++ b/pkg/compiler/test/analyses/api_allowed_nnbd.json
@@ -1,12 +1,12 @@
 {
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/js_number.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_number.dart": {
     "Dynamic invocation of '[]'.": 5,
     "Dynamic invocation of '<'.": 4,
     "Dynamic invocation of '>='.": 1,
     "Dynamic invocation of '<='.": 1,
     "Dynamic invocation of '>'.": 2
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/js_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_helper.dart": {
     "Dynamic invocation of '[]'.": 3,
     "Dynamic access of 'isNaN'.": 3,
     "Dynamic invocation of '<='.": 2,
@@ -18,7 +18,7 @@
     "Dynamic invocation of '>'.": 1,
     "Dynamic access of 'length'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/string_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/string_helper.dart": {
     "Dynamic invocation of '<'.": 1,
     "Dynamic invocation of '+'.": 1,
     "Dynamic invocation of '>='.": 1,
@@ -35,35 +35,35 @@
     "Dynamic access of 'iterator'.": 2,
     "Dynamic invocation of 'replaceRange'.": 2
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/linked_hash_map.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/linked_hash_map.dart": {
     "Dynamic access of '_js_helper::_length'.": 2,
     "Dynamic access of '_js_helper::_modifications'.": 4,
     "Dynamic invocation of 'containsKey'.": 1,
     "Dynamic access of '_js_helper::_first'.": 2
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/js_rti.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_rti.dart": {
     "Dynamic invocation of '<'.": 1,
     "Dynamic invocation of '-'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/native_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/native_helper.dart": {
     "Dynamic access of 'length'.": 2,
     "Dynamic invocation of '[]'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/regexp_helper.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/regexp_helper.dart": {
     "Dynamic access of 'length'.": 1,
     "Dynamic invocation of '-'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/native_typed_data.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/native_typed_data.dart": {
     "Dynamic invocation of '>'.": 1,
     "Dynamic invocation of '>='.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/async_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/async_patch.dart": {
     "Dynamic invocation of '-'.": 1,
     "Dynamic access of 'iterator'.": 1,
     "Dynamic invocation of 'call'.": 4,
     "Dynamic invocation of 'then'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/collection_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/collection_patch.dart": {
     "Dynamic access of 'dart.collection::_length'.": 2,
     "Dynamic invocation of 'dart.collection::_computeKeys'.": 2,
     "Dynamic invocation of 'containsKey'.": 2,
@@ -76,7 +76,7 @@
     "Dynamic access of 'dart.collection::_element'.": 1,
     "Dynamic access of 'dart.collection::_first'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/html/dart2js/html_dart2js.dart": {
+  "org-dartlang-sdk:///lib/html/dart2js/html_dart2js.dart": {
     "Dynamic access of 'style'.": 1,
     "Dynamic invocation of 'remove'.": 2,
     "Dynamic update to 'dart.dom.html::_innerHtml'.": 1,
@@ -92,23 +92,23 @@
     "Dynamic invocation of 'attributeChanged'.": 1,
     "Dynamic invocation of 'createElement'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/html/html_common/conversions.dart": {
+  "org-dartlang-sdk:///lib/html/html_common/conversions.dart": {
     "Dynamic invocation of '[]='.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/html/html_common/filtered_element_list.dart": {
+  "org-dartlang-sdk:///lib/html/html_common/filtered_element_list.dart": {
     "Dynamic invocation of 'remove'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/directory_impl.dart": {
+  "org-dartlang-sdk:///lib/io/directory_impl.dart": {
     "Dynamic invocation of '[]'.": 10
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/file_impl.dart": {
+  "org-dartlang-sdk:///lib/io/file_impl.dart": {
     "Dynamic invocation of '[]'.": 4,
     "Dynamic access of 'length'.": 2
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/file_system_entity.dart": {
+  "org-dartlang-sdk:///lib/io/file_system_entity.dart": {
     "Dynamic invocation of '[]'.": 7
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/io_resource_info.dart": {
+  "org-dartlang-sdk:///lib/io/io_resource_info.dart": {
     "Dynamic invocation of '[]'.": 1,
     "Dynamic access of 'path'.": 1,
     "Dynamic access of 'dart.io::_path'.": 1,
@@ -125,67 +125,67 @@
     "Dynamic access of 'type'.": 1,
     "Dynamic access of 'name'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/link.dart": {
+  "org-dartlang-sdk:///lib/io/link.dart": {
     "Dynamic invocation of '[]'.": 3
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/platform_impl.dart": {
+  "org-dartlang-sdk:///lib/io/platform_impl.dart": {
     "Dynamic invocation of 'indexOf'.": 1,
     "Dynamic invocation of '>'.": 1,
     "Dynamic invocation of 'substring'.": 2,
     "Dynamic invocation of '+'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/secure_server_socket.dart": {
+  "org-dartlang-sdk:///lib/io/secure_server_socket.dart": {
     "Dynamic update to 'dart.io::_owner'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/secure_socket.dart": {
+  "org-dartlang-sdk:///lib/io/secure_socket.dart": {
     "Dynamic invocation of '[]'.": 10,
     "Dynamic invocation of 'dart.io::_detachRaw'.": 2,
     "Dynamic access of 'closedReadEventSent'.": 1,
     "Dynamic update to 'dart.io::_owner'.": 1,
     "Dynamic access of 'length'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/stdio.dart": {
+  "org-dartlang-sdk:///lib/io/stdio.dart": {
     "Dynamic invocation of 'writeFromSync'.": 1,
     "Dynamic invocation of 'cancel'.": 1,
     "Dynamic invocation of 'closeSync'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/io/common.dart": {
+  "org-dartlang-sdk:///lib/io/common.dart": {
     "Dynamic invocation of '[]'.": 3
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/js_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/js_patch.dart": {
     "Dynamic invocation of '[]'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/svg/dart2js/svg_dart2js.dart": {
+  "org-dartlang-sdk:///lib/svg/dart2js/svg_dart2js.dart": {
     "Dynamic invocation of 'createFragment'.": 1,
     "Dynamic access of 'nodes'.": 1,
     "Dynamic invocation of 'where'.": 1,
     "Dynamic access of 'single'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/core/errors.dart": {
+  "org-dartlang-sdk:///lib/core/errors.dart": {
     "Dynamic access of 'length'.": 2
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_internal/js_runtime/lib/convert_patch.dart": {
+  "org-dartlang-sdk:///lib/_internal/js_runtime/lib/convert_patch.dart": {
     "Dynamic invocation of 'clear'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/convert/json.dart": {
+  "org-dartlang-sdk:///lib/convert/json.dart": {
     "Dynamic invocation of 'toJson'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_http/crypto.dart": {
+  "org-dartlang-sdk:///lib/_http/crypto.dart": {
     "Dynamic invocation of '+'.": 2,
     "Dynamic invocation of '&'.": 3,
     "Dynamic invocation of 'unary-'.": 1,
     "Dynamic invocation of '-'.": 2
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_http/http_date.dart": {
+  "org-dartlang-sdk:///lib/_http/http_date.dart": {
     "Dynamic access of 'length'.": 3,
     "Dynamic invocation of '<'.": 1,
     "Dynamic invocation of '>='.": 2,
     "Dynamic invocation of '[]'.": 7
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_http/http_headers.dart": {
+  "org-dartlang-sdk:///lib/_http/http_headers.dart": {
     "Dynamic invocation of 'toLowerCase'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_http/http_impl.dart": {
+  "org-dartlang-sdk:///lib/_http/http_impl.dart": {
     "Dynamic access of 'message'.": 3,
     "Dynamic invocation of 'call'.": 1,
     "Dynamic invocation of 'destroy'.": 2,
@@ -199,7 +199,7 @@
     "Dynamic invocation of 'listen'.": 1,
     "Dynamic invocation of 'close'.": 1
   },
-  "org-dartlang-sdk:///sdk_nnbd/lib/_http/websocket_impl.dart": {
+  "org-dartlang-sdk:///lib/_http/websocket_impl.dart": {
     "Dynamic invocation of 'dart._http::_toJSON'.": 1
   }
-}
\ No newline at end of file
+}
diff --git a/tests/compiler/dart2js/analyses/api_dynamic_test.dart b/pkg/compiler/test/analyses/api_dynamic_test.dart
similarity index 88%
rename from tests/compiler/dart2js/analyses/api_dynamic_test.dart
rename to pkg/compiler/test/analyses/api_dynamic_test.dart
index 53e4196..476cda5 100644
--- a/tests/compiler/dart2js/analyses/api_dynamic_test.dart
+++ b/pkg/compiler/test/analyses/api_dynamic_test.dart
@@ -13,8 +13,8 @@
 main(List<String> args) {
   var goldenFile = isDart2jsNnbd ? 'api_allowed_nnbd.json' : 'api_allowed.json';
   asyncTest(() async {
-    await run(Uri.parse('memory:main.dart'),
-        'tests/compiler/dart2js/analyses/$goldenFile',
+    await run(
+        Uri.parse('memory:main.dart'), 'pkg/compiler/test/analyses/$goldenFile',
         analyzedUrisFilter: (Uri uri) => uri.scheme == 'dart',
         memorySourceFiles: {'main.dart': 'main() {}'},
         verbose: args.contains('-v'),
diff --git a/tests/compiler/dart2js/analyses/dart2js_allowed.json b/pkg/compiler/test/analyses/dart2js_allowed.json
similarity index 100%
rename from tests/compiler/dart2js/analyses/dart2js_allowed.json
rename to pkg/compiler/test/analyses/dart2js_allowed.json
diff --git a/tests/compiler/dart2js/analyses/dart2js_dynamic_test.dart b/pkg/compiler/test/analyses/dart2js_dynamic_test.dart
similarity index 93%
rename from tests/compiler/dart2js/analyses/dart2js_dynamic_test.dart
rename to pkg/compiler/test/analyses/dart2js_dynamic_test.dart
index e435e6d..2a545af 100644
--- a/tests/compiler/dart2js/analyses/dart2js_dynamic_test.dart
+++ b/pkg/compiler/test/analyses/dart2js_dynamic_test.dart
@@ -28,7 +28,7 @@
 main(List<String> args) {
   asyncTest(() async {
     await run(Uri.parse('package:compiler/src/dart2js.dart'),
-        'tests/compiler/dart2js/analyses/dart2js_allowed.json',
+        'pkg/compiler/test/analyses/dart2js_allowed.json',
         analyzedUrisFilter: dart2jsOnly,
         verbose: args.contains('-v'),
         generate: args.contains('-g'));
diff --git a/tests/compiler/dart2js/analyses/static_type_visitor_test.dart b/pkg/compiler/test/analyses/static_type_visitor_test.dart
similarity index 100%
rename from tests/compiler/dart2js/analyses/static_type_visitor_test.dart
rename to pkg/compiler/test/analyses/static_type_visitor_test.dart
diff --git a/tests/compiler/dart2js/analysis_options.yaml b/pkg/compiler/test/analysis_options.yaml
similarity index 100%
rename from tests/compiler/dart2js/analysis_options.yaml
rename to pkg/compiler/test/analysis_options.yaml
diff --git a/tests/compiler/dart2js/annotations/annotations_test.dart b/pkg/compiler/test/annotations/annotations_test.dart
similarity index 100%
rename from tests/compiler/dart2js/annotations/annotations_test.dart
rename to pkg/compiler/test/annotations/annotations_test.dart
diff --git a/tests/compiler/dart2js/annotations/data/basic.dart b/pkg/compiler/test/annotations/data/basic.dart
similarity index 100%
rename from tests/compiler/dart2js/annotations/data/basic.dart
rename to pkg/compiler/test/annotations/data/basic.dart
diff --git a/tests/compiler/dart2js/annotations/data/directives.dart b/pkg/compiler/test/annotations/data/directives.dart
similarity index 100%
rename from tests/compiler/dart2js/annotations/data/directives.dart
rename to pkg/compiler/test/annotations/data/directives.dart
diff --git a/tests/compiler/dart2js/annotations/data/errors.dart b/pkg/compiler/test/annotations/data/errors.dart
similarity index 100%
rename from tests/compiler/dart2js/annotations/data/errors.dart
rename to pkg/compiler/test/annotations/data/errors.dart
diff --git a/pkg/compiler/test/annotations/data/marker.options b/pkg/compiler/test/annotations/data/marker.options
new file mode 100644
index 0000000..58771f4
--- /dev/null
+++ b/pkg/compiler/test/annotations/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/annotations/annotations_test.dart
+prod:nnbd-off=pkg/compiler/test/annotations/annotations_test.dart
+spec:nnbd-sdk=pkg/compiler/test/annotations/annotations_test.dart
+prod:nnbd-sdk=pkg/compiler/test/annotations/annotations_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/async_await/async_await_js_transform_test.dart b/pkg/compiler/test/async_await/async_await_js_transform_test.dart
similarity index 100%
rename from tests/compiler/dart2js/async_await/async_await_js_transform_test.dart
rename to pkg/compiler/test/async_await/async_await_js_transform_test.dart
diff --git a/tests/compiler/dart2js/closure/closure_test.dart b/pkg/compiler/test/closure/closure_test.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/closure_test.dart
rename to pkg/compiler/test/closure/closure_test.dart
diff --git a/tests/compiler/dart2js/closure/data/captured_variable.dart b/pkg/compiler/test/closure/data/captured_variable.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/captured_variable.dart
rename to pkg/compiler/test/closure/data/captured_variable.dart
diff --git a/tests/compiler/dart2js/closure/data/generic.dart b/pkg/compiler/test/closure/data/generic.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/generic.dart
rename to pkg/compiler/test/closure/data/generic.dart
diff --git a/tests/compiler/dart2js/closure/data/instantiation.dart b/pkg/compiler/test/closure/data/instantiation.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/instantiation.dart
rename to pkg/compiler/test/closure/data/instantiation.dart
diff --git a/tests/compiler/dart2js/closure/data/instantiation1.dart b/pkg/compiler/test/closure/data/instantiation1.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/instantiation1.dart
rename to pkg/compiler/test/closure/data/instantiation1.dart
diff --git a/tests/compiler/dart2js/closure/data/instantiation2.dart b/pkg/compiler/test/closure/data/instantiation2.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/instantiation2.dart
rename to pkg/compiler/test/closure/data/instantiation2.dart
diff --git a/tests/compiler/dart2js/closure/data/instantiation3.dart b/pkg/compiler/test/closure/data/instantiation3.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/instantiation3.dart
rename to pkg/compiler/test/closure/data/instantiation3.dart
diff --git a/tests/compiler/dart2js/closure/data/instantiation4.dart b/pkg/compiler/test/closure/data/instantiation4.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/instantiation4.dart
rename to pkg/compiler/test/closure/data/instantiation4.dart
diff --git a/tests/compiler/dart2js/closure/data/list_literal_class.dart b/pkg/compiler/test/closure/data/list_literal_class.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/list_literal_class.dart
rename to pkg/compiler/test/closure/data/list_literal_class.dart
diff --git a/tests/compiler/dart2js/closure/data/list_literal_method.dart b/pkg/compiler/test/closure/data/list_literal_method.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/list_literal_method.dart
rename to pkg/compiler/test/closure/data/list_literal_method.dart
diff --git a/tests/compiler/dart2js/closure/data/list_literal_untested_class.dart b/pkg/compiler/test/closure/data/list_literal_untested_class.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/list_literal_untested_class.dart
rename to pkg/compiler/test/closure/data/list_literal_untested_class.dart
diff --git a/tests/compiler/dart2js/closure/data/list_literal_untested_method.dart b/pkg/compiler/test/closure/data/list_literal_untested_method.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/list_literal_untested_method.dart
rename to pkg/compiler/test/closure/data/list_literal_untested_method.dart
diff --git a/tests/compiler/dart2js/closure/data/map_literal_class.dart b/pkg/compiler/test/closure/data/map_literal_class.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/map_literal_class.dart
rename to pkg/compiler/test/closure/data/map_literal_class.dart
diff --git a/tests/compiler/dart2js/closure/data/map_literal_method.dart b/pkg/compiler/test/closure/data/map_literal_method.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/map_literal_method.dart
rename to pkg/compiler/test/closure/data/map_literal_method.dart
diff --git a/tests/compiler/dart2js/closure/data/map_literal_untested_class.dart b/pkg/compiler/test/closure/data/map_literal_untested_class.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/map_literal_untested_class.dart
rename to pkg/compiler/test/closure/data/map_literal_untested_class.dart
diff --git a/tests/compiler/dart2js/closure/data/map_literal_untested_method.dart b/pkg/compiler/test/closure/data/map_literal_untested_method.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/map_literal_untested_method.dart
rename to pkg/compiler/test/closure/data/map_literal_untested_method.dart
diff --git a/pkg/compiler/test/closure/data/marker.options b/pkg/compiler/test/closure/data/marker.options
new file mode 100644
index 0000000..60c4c7e
--- /dev/null
+++ b/pkg/compiler/test/closure/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/closure/closure_test.dart
+prod:nnbd-off=pkg/compiler/test/closure/closure_test.dart
+spec:nnbd-sdk=pkg/compiler/test/closure/closure_test.dart
+prod:nnbd-sdk=pkg/compiler/test/closure/closure_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/closure/data/mixed.dart b/pkg/compiler/test/closure/data/mixed.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/mixed.dart
rename to pkg/compiler/test/closure/data/mixed.dart
diff --git a/tests/compiler/dart2js/closure/data/mutations.dart b/pkg/compiler/test/closure/data/mutations.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/mutations.dart
rename to pkg/compiler/test/closure/data/mutations.dart
diff --git a/tests/compiler/dart2js/closure/data/nested_closures.dart b/pkg/compiler/test/closure/data/nested_closures.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/nested_closures.dart
rename to pkg/compiler/test/closure/data/nested_closures.dart
diff --git a/tests/compiler/dart2js/closure/data/parameter_in_try.dart b/pkg/compiler/test/closure/data/parameter_in_try.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/parameter_in_try.dart
rename to pkg/compiler/test/closure/data/parameter_in_try.dart
diff --git a/tests/compiler/dart2js/closure/data/test_type_class.dart b/pkg/compiler/test/closure/data/test_type_class.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/test_type_class.dart
rename to pkg/compiler/test/closure/data/test_type_class.dart
diff --git a/tests/compiler/dart2js/closure/data/test_type_method.dart b/pkg/compiler/test/closure/data/test_type_method.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/test_type_method.dart
rename to pkg/compiler/test/closure/data/test_type_method.dart
diff --git a/tests/compiler/dart2js/closure/data/two_local_functions.dart b/pkg/compiler/test/closure/data/two_local_functions.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/two_local_functions.dart
rename to pkg/compiler/test/closure/data/two_local_functions.dart
diff --git a/tests/compiler/dart2js/closure/data/type_annotations_class.dart b/pkg/compiler/test/closure/data/type_annotations_class.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/type_annotations_class.dart
rename to pkg/compiler/test/closure/data/type_annotations_class.dart
diff --git a/tests/compiler/dart2js/closure/data/type_annotations_method.dart b/pkg/compiler/test/closure/data/type_annotations_method.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/type_annotations_method.dart
rename to pkg/compiler/test/closure/data/type_annotations_method.dart
diff --git a/tests/compiler/dart2js/closure/data/type_arguments_class.dart b/pkg/compiler/test/closure/data/type_arguments_class.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/type_arguments_class.dart
rename to pkg/compiler/test/closure/data/type_arguments_class.dart
diff --git a/tests/compiler/dart2js/closure/data/type_arguments_method.dart b/pkg/compiler/test/closure/data/type_arguments_method.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/type_arguments_method.dart
rename to pkg/compiler/test/closure/data/type_arguments_method.dart
diff --git a/tests/compiler/dart2js/closure/data/type_variables.dart b/pkg/compiler/test/closure/data/type_variables.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/data/type_variables.dart
rename to pkg/compiler/test/closure/data/type_variables.dart
diff --git a/tests/compiler/dart2js/closure/show.dart b/pkg/compiler/test/closure/show.dart
similarity index 100%
rename from tests/compiler/dart2js/closure/show.dart
rename to pkg/compiler/test/closure/show.dart
diff --git a/tests/compiler/dart2js/codegen/arithmetic_simplification_test.dart b/pkg/compiler/test/codegen/arithmetic_simplification_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/arithmetic_simplification_test.dart
rename to pkg/compiler/test/codegen/arithmetic_simplification_test.dart
diff --git a/tests/compiler/dart2js/codegen/array_static_intercept_test.dart b/pkg/compiler/test/codegen/array_static_intercept_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/array_static_intercept_test.dart
rename to pkg/compiler/test/codegen/array_static_intercept_test.dart
diff --git a/tests/compiler/dart2js/codegen/builtin_equals_test.dart b/pkg/compiler/test/codegen/builtin_equals_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/builtin_equals_test.dart
rename to pkg/compiler/test/codegen/builtin_equals_test.dart
diff --git a/tests/compiler/dart2js/codegen/builtin_interceptor_test.dart b/pkg/compiler/test/codegen/builtin_interceptor_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/builtin_interceptor_test.dart
rename to pkg/compiler/test/codegen/builtin_interceptor_test.dart
diff --git a/tests/compiler/dart2js/codegen/class_codegen2_test.dart b/pkg/compiler/test/codegen/class_codegen2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/class_codegen2_test.dart
rename to pkg/compiler/test/codegen/class_codegen2_test.dart
diff --git a/tests/compiler/dart2js/codegen/class_codegen_test.dart b/pkg/compiler/test/codegen/class_codegen_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/class_codegen_test.dart
rename to pkg/compiler/test/codegen/class_codegen_test.dart
diff --git a/tests/compiler/dart2js/codegen/class_order_test.dart b/pkg/compiler/test/codegen/class_order_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/class_order_test.dart
rename to pkg/compiler/test/codegen/class_order_test.dart
diff --git a/tests/compiler/dart2js/codegen/closure_call_of_static_reduction_test.dart b/pkg/compiler/test/codegen/closure_call_of_static_reduction_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/closure_call_of_static_reduction_test.dart
rename to pkg/compiler/test/codegen/closure_call_of_static_reduction_test.dart
diff --git a/tests/compiler/dart2js/codegen/closure_codegen_test.dart b/pkg/compiler/test/codegen/closure_codegen_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/closure_codegen_test.dart
rename to pkg/compiler/test/codegen/closure_codegen_test.dart
diff --git a/tests/compiler/dart2js/codegen/code_motion_test.dart b/pkg/compiler/test/codegen/code_motion_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/code_motion_test.dart
rename to pkg/compiler/test/codegen/code_motion_test.dart
diff --git a/tests/compiler/dart2js/codegen/constant_folding_codeUnitAt_test.dart b/pkg/compiler/test/codegen/constant_folding_codeUnitAt_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/constant_folding_codeUnitAt_test.dart
rename to pkg/compiler/test/codegen/constant_folding_codeUnitAt_test.dart
diff --git a/tests/compiler/dart2js/codegen/constant_folding_test.dart b/pkg/compiler/test/codegen/constant_folding_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/constant_folding_test.dart
rename to pkg/compiler/test/codegen/constant_folding_test.dart
diff --git a/tests/compiler/dart2js/codegen/constant_namer_test.dart b/pkg/compiler/test/codegen/constant_namer_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/constant_namer_test.dart
rename to pkg/compiler/test/codegen/constant_namer_test.dart
diff --git a/tests/compiler/dart2js/codegen/dead_code_test.dart b/pkg/compiler/test/codegen/dead_code_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/dead_code_test.dart
rename to pkg/compiler/test/codegen/dead_code_test.dart
diff --git a/tests/compiler/dart2js/codegen/dead_phi_eliminator_test.dart b/pkg/compiler/test/codegen/dead_phi_eliminator_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/dead_phi_eliminator_test.dart
rename to pkg/compiler/test/codegen/dead_phi_eliminator_test.dart
diff --git a/tests/compiler/dart2js/codegen/declare_once_test.dart b/pkg/compiler/test/codegen/declare_once_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/declare_once_test.dart
rename to pkg/compiler/test/codegen/declare_once_test.dart
diff --git a/tests/compiler/dart2js/codegen/elide_callthrough_stub_test.dart b/pkg/compiler/test/codegen/elide_callthrough_stub_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/elide_callthrough_stub_test.dart
rename to pkg/compiler/test/codegen/elide_callthrough_stub_test.dart
diff --git a/tests/compiler/dart2js/codegen/emit_const_fields_test.dart b/pkg/compiler/test/codegen/emit_const_fields_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/emit_const_fields_test.dart
rename to pkg/compiler/test/codegen/emit_const_fields_test.dart
diff --git a/tests/compiler/dart2js/codegen/equals_test.dart b/pkg/compiler/test/codegen/equals_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/equals_test.dart
rename to pkg/compiler/test/codegen/equals_test.dart
diff --git a/tests/compiler/dart2js/codegen/expect_annotations2_test.dart b/pkg/compiler/test/codegen/expect_annotations2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/expect_annotations2_test.dart
rename to pkg/compiler/test/codegen/expect_annotations2_test.dart
diff --git a/tests/compiler/dart2js/codegen/expect_annotations_test.dart b/pkg/compiler/test/codegen/expect_annotations_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/expect_annotations_test.dart
rename to pkg/compiler/test/codegen/expect_annotations_test.dart
diff --git a/tests/compiler/dart2js/codegen/field_codegen_test.dart b/pkg/compiler/test/codegen/field_codegen_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/field_codegen_test.dart
rename to pkg/compiler/test/codegen/field_codegen_test.dart
diff --git a/tests/compiler/dart2js/codegen/field_update_test.dart b/pkg/compiler/test/codegen/field_update_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/field_update_test.dart
rename to pkg/compiler/test/codegen/field_update_test.dart
diff --git a/tests/compiler/dart2js/codegen/for_in_test.dart b/pkg/compiler/test/codegen/for_in_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/for_in_test.dart
rename to pkg/compiler/test/codegen/for_in_test.dart
diff --git a/tests/compiler/dart2js/codegen/forloop_box_test.dart b/pkg/compiler/test/codegen/forloop_box_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/forloop_box_test.dart
rename to pkg/compiler/test/codegen/forloop_box_test.dart
diff --git a/tests/compiler/dart2js/codegen/generate_at_use_site_test.dart b/pkg/compiler/test/codegen/generate_at_use_site_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/generate_at_use_site_test.dart
rename to pkg/compiler/test/codegen/generate_at_use_site_test.dart
diff --git a/tests/compiler/dart2js/codegen/gvn_test.dart b/pkg/compiler/test/codegen/gvn_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/gvn_test.dart
rename to pkg/compiler/test/codegen/gvn_test.dart
diff --git a/tests/compiler/dart2js/codegen/identity_test.dart b/pkg/compiler/test/codegen/identity_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/identity_test.dart
rename to pkg/compiler/test/codegen/identity_test.dart
diff --git a/tests/compiler/dart2js/codegen/if_do_while_test.dart b/pkg/compiler/test/codegen/if_do_while_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/if_do_while_test.dart
rename to pkg/compiler/test/codegen/if_do_while_test.dart
diff --git a/tests/compiler/dart2js/codegen/interceptor_almost_constant_test.dart b/pkg/compiler/test/codegen/interceptor_almost_constant_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/interceptor_almost_constant_test.dart
rename to pkg/compiler/test/codegen/interceptor_almost_constant_test.dart
diff --git a/tests/compiler/dart2js/codegen/interceptor_test.dart b/pkg/compiler/test/codegen/interceptor_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/interceptor_test.dart
rename to pkg/compiler/test/codegen/interceptor_test.dart
diff --git a/tests/compiler/dart2js/codegen/interpolation_folding_test.dart b/pkg/compiler/test/codegen/interpolation_folding_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/interpolation_folding_test.dart
rename to pkg/compiler/test/codegen/interpolation_folding_test.dart
diff --git a/tests/compiler/dart2js/codegen/inverse_operator_test.dart b/pkg/compiler/test/codegen/inverse_operator_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/inverse_operator_test.dart
rename to pkg/compiler/test/codegen/inverse_operator_test.dart
diff --git a/tests/compiler/dart2js/codegen/is_function_test.dart b/pkg/compiler/test/codegen/is_function_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/is_function_test.dart
rename to pkg/compiler/test/codegen/is_function_test.dart
diff --git a/tests/compiler/dart2js/codegen/is_inference2_test.dart b/pkg/compiler/test/codegen/is_inference2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/is_inference2_test.dart
rename to pkg/compiler/test/codegen/is_inference2_test.dart
diff --git a/tests/compiler/dart2js/codegen/is_inference_test.dart b/pkg/compiler/test/codegen/is_inference_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/is_inference_test.dart
rename to pkg/compiler/test/codegen/is_inference_test.dart
diff --git a/tests/compiler/dart2js/codegen/jsarray_indexof_test.dart b/pkg/compiler/test/codegen/jsarray_indexof_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/jsarray_indexof_test.dart
rename to pkg/compiler/test/codegen/jsarray_indexof_test.dart
diff --git a/tests/compiler/dart2js/codegen/licm_test.dart b/pkg/compiler/test/codegen/licm_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/licm_test.dart
rename to pkg/compiler/test/codegen/licm_test.dart
diff --git a/tests/compiler/dart2js/codegen/list_tracer_length_test.dart b/pkg/compiler/test/codegen/list_tracer_length_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/list_tracer_length_test.dart
rename to pkg/compiler/test/codegen/list_tracer_length_test.dart
diff --git a/tests/compiler/dart2js/codegen/list_tracer_node_type_test.dart b/pkg/compiler/test/codegen/list_tracer_node_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/list_tracer_node_type_test.dart
rename to pkg/compiler/test/codegen/list_tracer_node_type_test.dart
diff --git a/tests/compiler/dart2js/codegen/literal_list_test.dart b/pkg/compiler/test/codegen/literal_list_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/literal_list_test.dart
rename to pkg/compiler/test/codegen/literal_list_test.dart
diff --git a/tests/compiler/dart2js/codegen/literal_map_test.dart b/pkg/compiler/test/codegen/literal_map_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/literal_map_test.dart
rename to pkg/compiler/test/codegen/literal_map_test.dart
diff --git a/tests/compiler/dart2js/codegen/load_elimination_test.dart b/pkg/compiler/test/codegen/load_elimination_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/load_elimination_test.dart
rename to pkg/compiler/test/codegen/load_elimination_test.dart
diff --git a/tests/compiler/dart2js/codegen/logical_expression_test.dart b/pkg/compiler/test/codegen/logical_expression_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/logical_expression_test.dart
rename to pkg/compiler/test/codegen/logical_expression_test.dart
diff --git a/tests/compiler/dart2js/codegen/loop_test.dart b/pkg/compiler/test/codegen/loop_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/loop_test.dart
rename to pkg/compiler/test/codegen/loop_test.dart
diff --git a/tests/compiler/dart2js/codegen/minify_many_locals_test.dart b/pkg/compiler/test/codegen/minify_many_locals_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/minify_many_locals_test.dart
rename to pkg/compiler/test/codegen/minify_many_locals_test.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/capture.dart b/pkg/compiler/test/codegen/model_data/capture.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/capture.dart
rename to pkg/compiler/test/codegen/model_data/capture.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/constant_folding.dart b/pkg/compiler/test/codegen/model_data/constant_folding.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/constant_folding.dart
rename to pkg/compiler/test/codegen/model_data/constant_folding.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/constructors.dart b/pkg/compiler/test/codegen/model_data/constructors.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/constructors.dart
rename to pkg/compiler/test/codegen/model_data/constructors.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/dynamic_get.dart b/pkg/compiler/test/codegen/model_data/dynamic_get.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/dynamic_get.dart
rename to pkg/compiler/test/codegen/model_data/dynamic_get.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/dynamic_set.dart b/pkg/compiler/test/codegen/model_data/dynamic_set.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/dynamic_set.dart
rename to pkg/compiler/test/codegen/model_data/dynamic_set.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/dynamic_set_unread.dart b/pkg/compiler/test/codegen/model_data/dynamic_set_unread.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/dynamic_set_unread.dart
rename to pkg/compiler/test/codegen/model_data/dynamic_set_unread.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/effectively_constant_fields.dart b/pkg/compiler/test/codegen/model_data/effectively_constant_fields.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/effectively_constant_fields.dart
rename to pkg/compiler/test/codegen/model_data/effectively_constant_fields.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/effectively_constant_state.dart b/pkg/compiler/test/codegen/model_data/effectively_constant_state.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/effectively_constant_state.dart
rename to pkg/compiler/test/codegen/model_data/effectively_constant_state.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/field_set.dart b/pkg/compiler/test/codegen/model_data/field_set.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/field_set.dart
rename to pkg/compiler/test/codegen/model_data/field_set.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/fields.dart b/pkg/compiler/test/codegen/model_data/fields.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/fields.dart
rename to pkg/compiler/test/codegen/model_data/fields.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/instance_method_parameters.dart b/pkg/compiler/test/codegen/model_data/instance_method_parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/instance_method_parameters.dart
rename to pkg/compiler/test/codegen/model_data/instance_method_parameters.dart
diff --git a/pkg/compiler/test/codegen/model_data/marker.options b/pkg/compiler/test/codegen/model_data/marker.options
new file mode 100644
index 0000000..d74f3c6
--- /dev/null
+++ b/pkg/compiler/test/codegen/model_data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/codegen/model_test.dart
+prod:nnbd-off=pkg/compiler/test/codegen/model_test.dart
+spec:nnbd-sdk=pkg/compiler/test/codegen/model_test.dart
+prod:nnbd-sdk=pkg/compiler/test/codegen/model_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/codegen/model_data/native.dart b/pkg/compiler/test/codegen/model_data/native.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/native.dart
rename to pkg/compiler/test/codegen/model_data/native.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/native_inlined.dart b/pkg/compiler/test/codegen/model_data/native_inlined.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/native_inlined.dart
rename to pkg/compiler/test/codegen/model_data/native_inlined.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/native_unused_parameters.dart b/pkg/compiler/test/codegen/model_data/native_unused_parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/native_unused_parameters.dart
rename to pkg/compiler/test/codegen/model_data/native_unused_parameters.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/regress_36222.dart b/pkg/compiler/test/codegen/model_data/regress_36222.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/regress_36222.dart
rename to pkg/compiler/test/codegen/model_data/regress_36222.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/static_method_parameters.dart b/pkg/compiler/test/codegen/model_data/static_method_parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/static_method_parameters.dart
rename to pkg/compiler/test/codegen/model_data/static_method_parameters.dart
diff --git a/tests/compiler/dart2js/codegen/model_data/static_tearoff.dart b/pkg/compiler/test/codegen/model_data/static_tearoff.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_data/static_tearoff.dart
rename to pkg/compiler/test/codegen/model_data/static_tearoff.dart
diff --git a/tests/compiler/dart2js/codegen/model_test.dart b/pkg/compiler/test/codegen/model_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/model_test.dart
rename to pkg/compiler/test/codegen/model_test.dart
diff --git a/tests/compiler/dart2js/codegen/modulo_remainder_test.dart b/pkg/compiler/test/codegen/modulo_remainder_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/modulo_remainder_test.dart
rename to pkg/compiler/test/codegen/modulo_remainder_test.dart
diff --git a/tests/compiler/dart2js/codegen/negation_shift_regression_test.dart b/pkg/compiler/test/codegen/negation_shift_regression_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/negation_shift_regression_test.dart
rename to pkg/compiler/test/codegen/negation_shift_regression_test.dart
diff --git a/tests/compiler/dart2js/codegen/new_rti_is_test.dart b/pkg/compiler/test/codegen/new_rti_is_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/new_rti_is_test.dart
rename to pkg/compiler/test/codegen/new_rti_is_test.dart
diff --git a/tests/compiler/dart2js/codegen/no_constructor_body_test.dart b/pkg/compiler/test/codegen/no_constructor_body_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/no_constructor_body_test.dart
rename to pkg/compiler/test/codegen/no_constructor_body_test.dart
diff --git a/tests/compiler/dart2js/codegen/no_duplicate_constructor_body2_test.dart b/pkg/compiler/test/codegen/no_duplicate_constructor_body2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/no_duplicate_constructor_body2_test.dart
rename to pkg/compiler/test/codegen/no_duplicate_constructor_body2_test.dart
diff --git a/tests/compiler/dart2js/codegen/no_duplicate_constructor_body_test.dart b/pkg/compiler/test/codegen/no_duplicate_constructor_body_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/no_duplicate_constructor_body_test.dart
rename to pkg/compiler/test/codegen/no_duplicate_constructor_body_test.dart
diff --git a/tests/compiler/dart2js/codegen/no_duplicate_stub_test.dart b/pkg/compiler/test/codegen/no_duplicate_stub_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/no_duplicate_stub_test.dart
rename to pkg/compiler/test/codegen/no_duplicate_stub_test.dart
diff --git a/tests/compiler/dart2js/codegen/null_check_test.dart b/pkg/compiler/test/codegen/null_check_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/null_check_test.dart
rename to pkg/compiler/test/codegen/null_check_test.dart
diff --git a/tests/compiler/dart2js/codegen/null_type_test.dart b/pkg/compiler/test/codegen/null_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/null_type_test.dart
rename to pkg/compiler/test/codegen/null_type_test.dart
diff --git a/tests/compiler/dart2js/codegen/number_output_test.dart b/pkg/compiler/test/codegen/number_output_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/number_output_test.dart
rename to pkg/compiler/test/codegen/number_output_test.dart
diff --git a/tests/compiler/dart2js/codegen/parameter_phi_elimination_test.dart b/pkg/compiler/test/codegen/parameter_phi_elimination_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/parameter_phi_elimination_test.dart
rename to pkg/compiler/test/codegen/parameter_phi_elimination_test.dart
diff --git a/tests/compiler/dart2js/codegen/pragma_annotations_test.dart b/pkg/compiler/test/codegen/pragma_annotations_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/pragma_annotations_test.dart
rename to pkg/compiler/test/codegen/pragma_annotations_test.dart
diff --git a/tests/compiler/dart2js/codegen/pretty_parameter_test.dart b/pkg/compiler/test/codegen/pretty_parameter_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/pretty_parameter_test.dart
rename to pkg/compiler/test/codegen/pretty_parameter_test.dart
diff --git a/tests/compiler/dart2js/codegen/redundant_phi_eliminator_test.dart b/pkg/compiler/test/codegen/redundant_phi_eliminator_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/redundant_phi_eliminator_test.dart
rename to pkg/compiler/test/codegen/redundant_phi_eliminator_test.dart
diff --git a/tests/compiler/dart2js/codegen/regress_10231_test.dart b/pkg/compiler/test/codegen/regress_10231_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/regress_10231_test.dart
rename to pkg/compiler/test/codegen/regress_10231_test.dart
diff --git a/tests/compiler/dart2js/codegen/side_effect_tdiv_regression_test.dart b/pkg/compiler/test/codegen/side_effect_tdiv_regression_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/side_effect_tdiv_regression_test.dart
rename to pkg/compiler/test/codegen/side_effect_tdiv_regression_test.dart
diff --git a/tests/compiler/dart2js/codegen/simple_inferrer_relations_test.dart b/pkg/compiler/test/codegen/simple_inferrer_relations_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/simple_inferrer_relations_test.dart
rename to pkg/compiler/test/codegen/simple_inferrer_relations_test.dart
diff --git a/tests/compiler/dart2js/codegen/ssa_phi_codegen_test.dart b/pkg/compiler/test/codegen/ssa_phi_codegen_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/ssa_phi_codegen_test.dart
rename to pkg/compiler/test/codegen/ssa_phi_codegen_test.dart
diff --git a/tests/compiler/dart2js/codegen/static_closure_test.dart b/pkg/compiler/test/codegen/static_closure_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/static_closure_test.dart
rename to pkg/compiler/test/codegen/static_closure_test.dart
diff --git a/tests/compiler/dart2js/codegen/strength_eq_test.dart b/pkg/compiler/test/codegen/strength_eq_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/strength_eq_test.dart
rename to pkg/compiler/test/codegen/strength_eq_test.dart
diff --git a/tests/compiler/dart2js/codegen/string_add_test.dart b/pkg/compiler/test/codegen/string_add_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/string_add_test.dart
rename to pkg/compiler/test/codegen/string_add_test.dart
diff --git a/tests/compiler/dart2js/codegen/string_escapes_test.dart b/pkg/compiler/test/codegen/string_escapes_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/string_escapes_test.dart
rename to pkg/compiler/test/codegen/string_escapes_test.dart
diff --git a/tests/compiler/dart2js/codegen/string_interpolation_test.dart b/pkg/compiler/test/codegen/string_interpolation_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/string_interpolation_test.dart
rename to pkg/compiler/test/codegen/string_interpolation_test.dart
diff --git a/tests/compiler/dart2js/codegen/switch_empty_default_test.dart b/pkg/compiler/test/codegen/switch_empty_default_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/switch_empty_default_test.dart
rename to pkg/compiler/test/codegen/switch_empty_default_test.dart
diff --git a/tests/compiler/dart2js/codegen/tdiv_test.dart b/pkg/compiler/test/codegen/tdiv_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/tdiv_test.dart
rename to pkg/compiler/test/codegen/tdiv_test.dart
diff --git a/tests/compiler/dart2js/codegen/top_level_closure_tree_shake_test.dart b/pkg/compiler/test/codegen/top_level_closure_tree_shake_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/top_level_closure_tree_shake_test.dart
rename to pkg/compiler/test/codegen/top_level_closure_tree_shake_test.dart
diff --git a/tests/compiler/dart2js/codegen/tree_shaking_test.dart b/pkg/compiler/test/codegen/tree_shaking_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/tree_shaking_test.dart
rename to pkg/compiler/test/codegen/tree_shaking_test.dart
diff --git a/tests/compiler/dart2js/codegen/trust_type_annotations2_test.dart b/pkg/compiler/test/codegen/trust_type_annotations2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/trust_type_annotations2_test.dart
rename to pkg/compiler/test/codegen/trust_type_annotations2_test.dart
diff --git a/tests/compiler/dart2js/codegen/trust_type_annotations_test.dart b/pkg/compiler/test/codegen/trust_type_annotations_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/trust_type_annotations_test.dart
rename to pkg/compiler/test/codegen/trust_type_annotations_test.dart
diff --git a/tests/compiler/dart2js/codegen/type_guard_unuser_test.dart b/pkg/compiler/test/codegen/type_guard_unuser_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/type_guard_unuser_test.dart
rename to pkg/compiler/test/codegen/type_guard_unuser_test.dart
diff --git a/tests/compiler/dart2js/codegen/type_inference2_test.dart b/pkg/compiler/test/codegen/type_inference2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/type_inference2_test.dart
rename to pkg/compiler/test/codegen/type_inference2_test.dart
diff --git a/tests/compiler/dart2js/codegen/type_inference3_test.dart b/pkg/compiler/test/codegen/type_inference3_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/type_inference3_test.dart
rename to pkg/compiler/test/codegen/type_inference3_test.dart
diff --git a/tests/compiler/dart2js/codegen/type_inference4_test.dart b/pkg/compiler/test/codegen/type_inference4_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/type_inference4_test.dart
rename to pkg/compiler/test/codegen/type_inference4_test.dart
diff --git a/tests/compiler/dart2js/codegen/type_inference5_test.dart b/pkg/compiler/test/codegen/type_inference5_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/type_inference5_test.dart
rename to pkg/compiler/test/codegen/type_inference5_test.dart
diff --git a/tests/compiler/dart2js/codegen/type_inference8_test.dart b/pkg/compiler/test/codegen/type_inference8_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/type_inference8_test.dart
rename to pkg/compiler/test/codegen/type_inference8_test.dart
diff --git a/tests/compiler/dart2js/codegen/types_of_captured_variables_test.dart b/pkg/compiler/test/codegen/types_of_captured_variables_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/types_of_captured_variables_test.dart
rename to pkg/compiler/test/codegen/types_of_captured_variables_test.dart
diff --git a/tests/compiler/dart2js/codegen/unused_empty_map_test.dart b/pkg/compiler/test/codegen/unused_empty_map_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/unused_empty_map_test.dart
rename to pkg/compiler/test/codegen/unused_empty_map_test.dart
diff --git a/tests/compiler/dart2js/codegen/use_checks_test.dart b/pkg/compiler/test/codegen/use_checks_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/use_checks_test.dart
rename to pkg/compiler/test/codegen/use_checks_test.dart
diff --git a/tests/compiler/dart2js/codegen/use_strict_test.dart b/pkg/compiler/test/codegen/use_strict_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/use_strict_test.dart
rename to pkg/compiler/test/codegen/use_strict_test.dart
diff --git a/tests/compiler/dart2js/codegen/value_range2_test.dart b/pkg/compiler/test/codegen/value_range2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/value_range2_test.dart
rename to pkg/compiler/test/codegen/value_range2_test.dart
diff --git a/tests/compiler/dart2js/codegen/value_range3_test.dart b/pkg/compiler/test/codegen/value_range3_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/value_range3_test.dart
rename to pkg/compiler/test/codegen/value_range3_test.dart
diff --git a/tests/compiler/dart2js/codegen/value_range_test.dart b/pkg/compiler/test/codegen/value_range_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/value_range_test.dart
rename to pkg/compiler/test/codegen/value_range_test.dart
diff --git a/tests/compiler/dart2js/codegen/variance_subtype_cast_test.dart b/pkg/compiler/test/codegen/variance_subtype_cast_test.dart
similarity index 100%
rename from tests/compiler/dart2js/codegen/variance_subtype_cast_test.dart
rename to pkg/compiler/test/codegen/variance_subtype_cast_test.dart
diff --git a/tests/compiler/dart2js/deferred/closures_test.dart b/pkg/compiler/test/deferred/closures_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/closures_test.dart
rename to pkg/compiler/test/deferred/closures_test.dart
diff --git a/tests/compiler/dart2js/deferred/constant_emission_test_helper.dart b/pkg/compiler/test/deferred/constant_emission_test_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/constant_emission_test_helper.dart
rename to pkg/compiler/test/deferred/constant_emission_test_helper.dart
diff --git a/tests/compiler/dart2js/deferred/custom_element_test.dart b/pkg/compiler/test/deferred/custom_element_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/custom_element_test.dart
rename to pkg/compiler/test/deferred/custom_element_test.dart
diff --git a/tests/compiler/dart2js/deferred/data/deferred_helper.dart b/pkg/compiler/test/deferred/data/deferred_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/data/deferred_helper.dart
rename to pkg/compiler/test/deferred/data/deferred_helper.dart
diff --git a/tests/compiler/dart2js/deferred/data/deferred_lib.dart b/pkg/compiler/test/deferred/data/deferred_lib.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/data/deferred_lib.dart
rename to pkg/compiler/test/deferred/data/deferred_lib.dart
diff --git a/tests/compiler/dart2js/deferred/deferred_constant3_test.dart b/pkg/compiler/test/deferred/deferred_constant3_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/deferred_constant3_test.dart
rename to pkg/compiler/test/deferred/deferred_constant3_test.dart
diff --git a/tests/compiler/dart2js/deferred/dont_inline_deferred_constants_test.dart b/pkg/compiler/test/deferred/dont_inline_deferred_constants_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/dont_inline_deferred_constants_test.dart
rename to pkg/compiler/test/deferred/dont_inline_deferred_constants_test.dart
diff --git a/tests/compiler/dart2js/deferred/dont_inline_deferred_globals_test.dart b/pkg/compiler/test/deferred/dont_inline_deferred_globals_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/dont_inline_deferred_globals_test.dart
rename to pkg/compiler/test/deferred/dont_inline_deferred_globals_test.dart
diff --git a/tests/compiler/dart2js/deferred/emit_type_checks_test.dart b/pkg/compiler/test/deferred/emit_type_checks_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/emit_type_checks_test.dart
rename to pkg/compiler/test/deferred/emit_type_checks_test.dart
diff --git a/tests/compiler/dart2js/deferred/follow_constant_dependencies_test.dart b/pkg/compiler/test/deferred/follow_constant_dependencies_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/follow_constant_dependencies_test.dart
rename to pkg/compiler/test/deferred/follow_constant_dependencies_test.dart
diff --git a/tests/compiler/dart2js/deferred/follow_implicit_super_regression_test.dart b/pkg/compiler/test/deferred/follow_implicit_super_regression_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/follow_implicit_super_regression_test.dart
rename to pkg/compiler/test/deferred/follow_implicit_super_regression_test.dart
diff --git a/tests/compiler/dart2js/deferred/inline_restrictions_test.dart b/pkg/compiler/test/deferred/inline_restrictions_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/inline_restrictions_test.dart
rename to pkg/compiler/test/deferred/inline_restrictions_test.dart
diff --git a/tests/compiler/dart2js/deferred/load_graph_segmentation2_test.dart b/pkg/compiler/test/deferred/load_graph_segmentation2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/load_graph_segmentation2_test.dart
rename to pkg/compiler/test/deferred/load_graph_segmentation2_test.dart
diff --git a/tests/compiler/dart2js/deferred/load_graph_segmentation_test.dart b/pkg/compiler/test/deferred/load_graph_segmentation_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/load_graph_segmentation_test.dart
rename to pkg/compiler/test/deferred/load_graph_segmentation_test.dart
diff --git a/tests/compiler/dart2js/deferred/load_mapping_test.dart b/pkg/compiler/test/deferred/load_mapping_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/load_mapping_test.dart
rename to pkg/compiler/test/deferred/load_mapping_test.dart
diff --git a/tests/compiler/dart2js/deferred/not_in_main_test.dart b/pkg/compiler/test/deferred/not_in_main_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/not_in_main_test.dart
rename to pkg/compiler/test/deferred/not_in_main_test.dart
diff --git a/tests/compiler/dart2js/deferred/unneeded_part_js_test.dart b/pkg/compiler/test/deferred/unneeded_part_js_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred/unneeded_part_js_test.dart
rename to pkg/compiler/test/deferred/unneeded_part_js_test.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/basic_deferred/lib.dart b/pkg/compiler/test/deferred_loading/data/basic_deferred/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/basic_deferred/lib.dart
rename to pkg/compiler/test/deferred_loading/data/basic_deferred/lib.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/basic_deferred/main.dart b/pkg/compiler/test/deferred_loading/data/basic_deferred/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/basic_deferred/main.dart
rename to pkg/compiler/test/deferred_loading/data/basic_deferred/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_class/lib.dart b/pkg/compiler/test/deferred_loading/data/deferred_class/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_class/lib.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_class/lib.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_class/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_class/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_class/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_class/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant1/lib1.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant1/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant1/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant1/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant1/lib2.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant1/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant1/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant1/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant1/lib3.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant1/lib3.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant1/lib3.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant1/lib3.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant1/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant1/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant1/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant1/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant2/lib.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant2/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant2/lib.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant2/lib.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant2/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant2/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant2/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant2/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant3/lib1.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant3/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant3/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant3/lib2.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant3/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant3/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant3/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant3/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant3/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant3/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant3/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_constant3/shared.dart b/pkg/compiler/test/deferred_loading/data/deferred_constant3/shared.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_constant3/shared.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_constant3/shared.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_fail_and_retry/lib.dart b/pkg/compiler/test/deferred_loading/data/deferred_fail_and_retry/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_fail_and_retry/lib.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_fail_and_retry/lib.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_fail_and_retry/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_fail_and_retry/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_fail_and_retry/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_fail_and_retry/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_function/lib.dart b/pkg/compiler/test/deferred_loading/data/deferred_function/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_function/lib.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_function/lib.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_function/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_function/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_function/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_function/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/deferred_overlapping_lib3.dart b/pkg/compiler/test/deferred_loading/data/deferred_overlapping/deferred_overlapping_lib3.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/deferred_overlapping_lib3.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_overlapping/deferred_overlapping_lib3.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/lib1.dart b/pkg/compiler/test/deferred_loading/data/deferred_overlapping/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_overlapping/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/lib2.dart b/pkg/compiler/test/deferred_loading/data/deferred_overlapping/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_overlapping/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_overlapping/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_overlapping/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_overlapping/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_typed_map/lib1.dart b/pkg/compiler/test/deferred_loading/data/deferred_typed_map/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_typed_map/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_typed_map/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_typed_map/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_typed_map/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_typed_map/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_typed_map/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_typedef/lib1.dart b/pkg/compiler/test/deferred_loading/data/deferred_typedef/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_typedef/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_typedef/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/deferred_typedef/main.dart b/pkg/compiler/test/deferred_loading/data/deferred_typedef/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/deferred_typedef/main.dart
rename to pkg/compiler/test/deferred_loading/data/deferred_typedef/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/exported_main.dart b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/exported_main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/exported_main.dart
rename to pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/exported_main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/lib1.dart b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/lib2.dart b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/main.dart b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_constants/main.dart
rename to pkg/compiler/test/deferred_loading/data/dont_inline_deferred_constants/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_global/lib.dart b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_global/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_global/lib.dart
rename to pkg/compiler/test/deferred_loading/data/dont_inline_deferred_global/lib.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_global/main.dart b/pkg/compiler/test/deferred_loading/data/dont_inline_deferred_global/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/dont_inline_deferred_global/main.dart
rename to pkg/compiler/test/deferred_loading/data/dont_inline_deferred_global/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/future_or/lib1.dart b/pkg/compiler/test/deferred_loading/data/future_or/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/future_or/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/future_or/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/future_or/lib2.dart b/pkg/compiler/test/deferred_loading/data/future_or/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/future_or/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/future_or/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/future_or/main.dart b/pkg/compiler/test/deferred_loading/data/future_or/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/future_or/main.dart
rename to pkg/compiler/test/deferred_loading/data/future_or/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation0/lib1.dart b/pkg/compiler/test/deferred_loading/data/instantiation0/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation0/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation0/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation0/main.dart b/pkg/compiler/test/deferred_loading/data/instantiation0/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation0/main.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation0/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation1/lib1.dart b/pkg/compiler/test/deferred_loading/data/instantiation1/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation1/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation1/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation1/lib2.dart b/pkg/compiler/test/deferred_loading/data/instantiation1/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation1/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation1/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation1/main.dart b/pkg/compiler/test/deferred_loading/data/instantiation1/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation1/main.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation1/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation2/lib1.dart b/pkg/compiler/test/deferred_loading/data/instantiation2/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation2/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation2/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation2/lib2.dart b/pkg/compiler/test/deferred_loading/data/instantiation2/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation2/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation2/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation2/main.dart b/pkg/compiler/test/deferred_loading/data/instantiation2/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation2/main.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation2/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation3/lib1.dart b/pkg/compiler/test/deferred_loading/data/instantiation3/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation3/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation3/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation3/main.dart b/pkg/compiler/test/deferred_loading/data/instantiation3/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation3/main.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation3/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation4/lib1.dart b/pkg/compiler/test/deferred_loading/data/instantiation4/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation4/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation4/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation4/lib2.dart b/pkg/compiler/test/deferred_loading/data/instantiation4/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation4/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation4/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation4/main.dart b/pkg/compiler/test/deferred_loading/data/instantiation4/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation4/main.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation4/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation5/lib1.dart b/pkg/compiler/test/deferred_loading/data/instantiation5/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation5/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation5/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation5/lib2.dart b/pkg/compiler/test/deferred_loading/data/instantiation5/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation5/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation5/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/instantiation5/main.dart b/pkg/compiler/test/deferred_loading/data/instantiation5/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/instantiation5/main.dart
rename to pkg/compiler/test/deferred_loading/data/instantiation5/main.dart
diff --git a/pkg/compiler/test/deferred_loading/data/marker.options b/pkg/compiler/test/deferred_loading/data/marker.options
new file mode 100644
index 0000000..545c1e9
--- /dev/null
+++ b/pkg/compiler/test/deferred_loading/data/marker.options
@@ -0,0 +1,2 @@
+spec:nnbd-off=pkg/compiler/test/deferred_loading/deferred_loading_test.dart
+spec:nnbd-sdk=pkg/compiler/test/deferred_loading/deferred_loading_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/deferred_loading/data/shared_constant/lib_a.dart b/pkg/compiler/test/deferred_loading/data/shared_constant/lib_a.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/shared_constant/lib_a.dart
rename to pkg/compiler/test/deferred_loading/data/shared_constant/lib_a.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/shared_constant/lib_b.dart b/pkg/compiler/test/deferred_loading/data/shared_constant/lib_b.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/shared_constant/lib_b.dart
rename to pkg/compiler/test/deferred_loading/data/shared_constant/lib_b.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/shared_constant/lib_c.dart b/pkg/compiler/test/deferred_loading/data/shared_constant/lib_c.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/shared_constant/lib_c.dart
rename to pkg/compiler/test/deferred_loading/data/shared_constant/lib_c.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/shared_constant/main.dart b/pkg/compiler/test/deferred_loading/data/shared_constant/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/shared_constant/main.dart
rename to pkg/compiler/test/deferred_loading/data/shared_constant/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/shared_constant/shared.dart b/pkg/compiler/test/deferred_loading/data/shared_constant/shared.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/shared_constant/shared.dart
rename to pkg/compiler/test/deferred_loading/data/shared_constant/shared.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/static_separate/lib1.dart b/pkg/compiler/test/deferred_loading/data/static_separate/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/static_separate/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/static_separate/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/static_separate/lib2.dart b/pkg/compiler/test/deferred_loading/data/static_separate/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/static_separate/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/static_separate/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/static_separate/main.dart b/pkg/compiler/test/deferred_loading/data/static_separate/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/static_separate/main.dart
rename to pkg/compiler/test/deferred_loading/data/static_separate/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/type_argument_dependency/lib1.dart b/pkg/compiler/test/deferred_loading/data/type_argument_dependency/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/type_argument_dependency/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/type_argument_dependency/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/type_argument_dependency/lib2.dart b/pkg/compiler/test/deferred_loading/data/type_argument_dependency/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/type_argument_dependency/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/type_argument_dependency/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/type_argument_dependency/main.dart b/pkg/compiler/test/deferred_loading/data/type_argument_dependency/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/type_argument_dependency/main.dart
rename to pkg/compiler/test/deferred_loading/data/type_argument_dependency/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/type_arguments/lib1.dart b/pkg/compiler/test/deferred_loading/data/type_arguments/lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/type_arguments/lib1.dart
rename to pkg/compiler/test/deferred_loading/data/type_arguments/lib1.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/type_arguments/lib2.dart b/pkg/compiler/test/deferred_loading/data/type_arguments/lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/type_arguments/lib2.dart
rename to pkg/compiler/test/deferred_loading/data/type_arguments/lib2.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/type_arguments/lib3.dart b/pkg/compiler/test/deferred_loading/data/type_arguments/lib3.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/type_arguments/lib3.dart
rename to pkg/compiler/test/deferred_loading/data/type_arguments/lib3.dart
diff --git a/tests/compiler/dart2js/deferred_loading/data/type_arguments/main.dart b/pkg/compiler/test/deferred_loading/data/type_arguments/main.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/data/type_arguments/main.dart
rename to pkg/compiler/test/deferred_loading/data/type_arguments/main.dart
diff --git a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart b/pkg/compiler/test/deferred_loading/deferred_loading_test.dart
similarity index 100%
rename from tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
rename to pkg/compiler/test/deferred_loading/deferred_loading_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/all_native_test.dart b/pkg/compiler/test/end_to_end/all_native_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/all_native_test.dart
rename to pkg/compiler/test/end_to_end/all_native_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/async_compiler_input_provider_test.dart b/pkg/compiler/test/end_to_end/async_compiler_input_provider_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/async_compiler_input_provider_test.dart
rename to pkg/compiler/test/end_to_end/async_compiler_input_provider_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/bad_output_io_test.dart b/pkg/compiler/test/end_to_end/bad_output_io_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/bad_output_io_test.dart
rename to pkg/compiler/test/end_to_end/bad_output_io_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/command_line_split_test.dart b/pkg/compiler/test/end_to_end/command_line_split_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/command_line_split_test.dart
rename to pkg/compiler/test/end_to_end/command_line_split_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/command_line_test.dart b/pkg/compiler/test/end_to_end/command_line_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/command_line_test.dart
rename to pkg/compiler/test/end_to_end/command_line_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/dart2js_batch2_test.dart b/pkg/compiler/test/end_to_end/dart2js_batch2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/dart2js_batch2_test.dart
rename to pkg/compiler/test/end_to_end/dart2js_batch2_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/dart2js_batch_test.dart b/pkg/compiler/test/end_to_end/dart2js_batch_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/dart2js_batch_test.dart
rename to pkg/compiler/test/end_to_end/dart2js_batch_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/data/dart2js_batch2_run.dart b/pkg/compiler/test/end_to_end/data/dart2js_batch2_run.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/data/dart2js_batch2_run.dart
rename to pkg/compiler/test/end_to_end/data/dart2js_batch2_run.dart
diff --git a/tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart b/pkg/compiler/test/end_to_end/data/exit_code_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart
rename to pkg/compiler/test/end_to_end/data/exit_code_helper.dart
diff --git a/tests/compiler/dart2js/end_to_end/data/hello_world.dart b/pkg/compiler/test/end_to_end/data/hello_world.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/data/hello_world.dart
rename to pkg/compiler/test/end_to_end/data/hello_world.dart
diff --git a/tests/compiler/dart2js/end_to_end/diagnostic_reporter_helper.dart b/pkg/compiler/test/end_to_end/diagnostic_reporter_helper.dart
similarity index 94%
rename from tests/compiler/dart2js/end_to_end/diagnostic_reporter_helper.dart
rename to pkg/compiler/test/end_to_end/diagnostic_reporter_helper.dart
index 15fb27e..63d8596 100644
--- a/tests/compiler/dart2js/end_to_end/diagnostic_reporter_helper.dart
+++ b/pkg/compiler/test/end_to_end/diagnostic_reporter_helper.dart
@@ -18,7 +18,7 @@
 
   @override
   DiagnosticMessage createMessage(Spannable spannable, MessageKind messageKind,
-      [Map arguments = const {}]) {
+      [Map<String, String> arguments = const {}]) {
     return reporter.createMessage(spannable, messageKind, arguments);
   }
 
@@ -49,7 +49,7 @@
 
   @override
   void reportInfo(Spannable node, MessageKind errorCode,
-      [Map arguments = const {}]) {
+      [Map<String, String> arguments = const {}]) {
     reporter.reportInfo(node, errorCode, arguments);
   }
 
diff --git a/tests/compiler/dart2js/end_to_end/dill_loader_test.dart b/pkg/compiler/test/end_to_end/dill_loader_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/dill_loader_test.dart
rename to pkg/compiler/test/end_to_end/dill_loader_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/dump_info2_test.dart b/pkg/compiler/test/end_to_end/dump_info2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/dump_info2_test.dart
rename to pkg/compiler/test/end_to_end/dump_info2_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/dump_info_test.dart b/pkg/compiler/test/end_to_end/dump_info_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/dump_info_test.dart
rename to pkg/compiler/test/end_to_end/dump_info_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/exit_code_test.dart b/pkg/compiler/test/end_to_end/exit_code_test.dart
similarity index 98%
rename from tests/compiler/dart2js/end_to_end/exit_code_test.dart
rename to pkg/compiler/test/end_to_end/exit_code_test.dart
index a5182d3..abe4757 100644
--- a/tests/compiler/dart2js/end_to_end/exit_code_test.dart
+++ b/pkg/compiler/test/end_to_end/exit_code_test.dart
@@ -195,7 +195,7 @@
     List<String> args = new List<String>.from(options)
       ..add("--libraries-spec=$sdkLibrariesSpecificationUri")
       ..add("--platform-binaries=$sdkPlatformBinariesPath")
-      ..add("tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart");
+      ..add("pkg/compiler/test/end_to_end/data/exit_code_helper.dart");
     Future result = entry.internalMain(args);
     return result.catchError((e, s) {
       // Capture crashes.
diff --git a/tests/compiler/dart2js/end_to_end/launch_helper.dart b/pkg/compiler/test/end_to_end/launch_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/launch_helper.dart
rename to pkg/compiler/test/end_to_end/launch_helper.dart
diff --git a/tests/compiler/dart2js/end_to_end/library_env_test.dart b/pkg/compiler/test/end_to_end/library_env_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/library_env_test.dart
rename to pkg/compiler/test/end_to_end/library_env_test.dart
diff --git a/tests/compiler/dart2js/end_to_end/modular_loader_test.dart b/pkg/compiler/test/end_to_end/modular_loader_test.dart
similarity index 94%
rename from tests/compiler/dart2js/end_to_end/modular_loader_test.dart
rename to pkg/compiler/test/end_to_end/modular_loader_test.dart
index 506d5de..76afdb2 100644
--- a/tests/compiler/dart2js/end_to_end/modular_loader_test.dart
+++ b/pkg/compiler/test/end_to_end/modular_loader_test.dart
@@ -13,6 +13,8 @@
 import 'package:compiler/src/kernel/dart2js_target.dart';
 import 'package:compiler/src/kernel/loader.dart';
 import 'package:expect/expect.dart';
+import 'package:front_end/src/api_prototype/experimental_flags.dart'
+    show ExperimentalFlag;
 import 'package:front_end/src/api_prototype/front_end.dart';
 import 'package:front_end/src/api_prototype/memory_file_system.dart';
 import 'package:front_end/src/api_prototype/standard_file_system.dart';
@@ -80,7 +82,8 @@
     ..target = new Dart2jsTarget("dart2js", new TargetFlags())
     ..fileSystem = new TestFileSystem(fs)
     ..additionalDills = additionalDills
-    ..packagesFileUri = toTestUri('.packages');
+    ..packagesFileUri = toTestUri('.packages')
+    ..experimentalFlags = {ExperimentalFlag.nonNullable: true};
   var inputUris = inputs.map(toTestUri).toList();
   var inputUriSet = inputUris.toSet();
   var component = (await kernelForModule(inputUris, options)).component;
@@ -112,12 +115,14 @@
 }
 
 const sourceA = '''
+// @dart=2.7
 class A0 {
   StringBuffer buffer = new StringBuffer();
 }
 ''';
 
 const sourceB = '''
+// @dart=2.7
 import 'a0.dart';
 
 class B1 extends A0 {
@@ -128,6 +133,7 @@
 ''';
 
 const sourceC = '''
+// @dart=2.7
 import 'b1.dart';
 
 class C2 extends B1 {
diff --git a/tests/compiler/dart2js/end_to_end/no_platform_test.dart b/pkg/compiler/test/end_to_end/no_platform_test.dart
similarity index 93%
rename from tests/compiler/dart2js/end_to_end/no_platform_test.dart
rename to pkg/compiler/test/end_to_end/no_platform_test.dart
index ef897a9..7333bf5 100644
--- a/tests/compiler/dart2js/end_to_end/no_platform_test.dart
+++ b/pkg/compiler/test/end_to_end/no_platform_test.dart
@@ -30,9 +30,7 @@
         (fe.DiagnosticMessage message) {
       message.plainTextFormatted.forEach(print);
       Expect.notEquals(fe.Severity.error, message.severity);
-    },
-        Uri.base.resolve(
-            'tests/compiler/dart2js/end_to_end/data/hello_world.dart'));
+    }, Uri.base.resolve('pkg/compiler/test/end_to_end/data/hello_world.dart'));
     Expect.isNotNull(new ir.CoreTypes(component).futureClass);
   }
 
diff --git a/tests/compiler/dart2js/end_to_end/output_type_test.dart b/pkg/compiler/test/end_to_end/output_type_test.dart
similarity index 93%
rename from tests/compiler/dart2js/end_to_end/output_type_test.dart
rename to pkg/compiler/test/end_to_end/output_type_test.dart
index bd7c075..e48e089 100644
--- a/tests/compiler/dart2js/end_to_end/output_type_test.dart
+++ b/pkg/compiler/test/end_to_end/output_type_test.dart
@@ -46,8 +46,8 @@
 Future<Null> test(List<String> arguments, List<String> expectedOutput,
     {List<String> groupOutputs: const <String>[]}) async {
   List<String> options = new List<String>.from(arguments)
-    ..add("--platform-binaries=$sdkPlatformBinariesPath")
-    ..add("--libraries-spec=$sdkLibrariesSpecificationUri");
+    ..add('--platform-binaries=$sdkPlatformBinariesPath')
+    ..add('--libraries-spec=$sdkLibrariesSpecificationUri');
   print('--------------------------------------------------------------------');
   print('dart2js ${options.join(' ')}');
   TestRandomAccessFileOutputProvider outputProvider;
@@ -84,7 +84,7 @@
     PRINT_GRAPH = true;
     TRACE_FILTER_PATTERN_FOR_TEST = 'x';
     await test([
-      'tests/compiler/dart2js/deferred/data/deferred_helper.dart',
+      'pkg/compiler/test/deferred/data/deferred_helper.dart',
       '--out=custom.js',
       '--deferred-map=def/deferred.json',
       Flags.dumpInfo,
@@ -110,7 +110,7 @@
 
     await test(
         [
-          'tests/compiler/dart2js/deferred/data/deferred_helper.dart',
+          'pkg/compiler/test/deferred/data/deferred_helper.dart',
           Flags.useContentSecurityPolicy,
         ]..addAll(additionOptionals),
         expectedOutput);
diff --git a/tests/compiler/dart2js/end_to_end/user_crash_test.dart b/pkg/compiler/test/end_to_end/user_crash_test.dart
similarity index 100%
rename from tests/compiler/dart2js/end_to_end/user_crash_test.dart
rename to pkg/compiler/test/end_to_end/user_crash_test.dart
diff --git a/tests/compiler/dart2js/equivalence/check_functions.dart b/pkg/compiler/test/equivalence/check_functions.dart
similarity index 100%
rename from tests/compiler/dart2js/equivalence/check_functions.dart
rename to pkg/compiler/test/equivalence/check_functions.dart
diff --git a/tests/compiler/dart2js/equivalence/check_helpers.dart b/pkg/compiler/test/equivalence/check_helpers.dart
similarity index 100%
rename from tests/compiler/dart2js/equivalence/check_helpers.dart
rename to pkg/compiler/test/equivalence/check_helpers.dart
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence.dart b/pkg/compiler/test/equivalence/id_equivalence.dart
similarity index 100%
rename from tests/compiler/dart2js/equivalence/id_equivalence.dart
rename to pkg/compiler/test/equivalence/id_equivalence.dart
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart b/pkg/compiler/test/equivalence/id_equivalence_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
rename to pkg/compiler/test/equivalence/id_equivalence_helper.dart
diff --git a/tests/compiler/dart2js/equivalence/id_testing_test.dart b/pkg/compiler/test/equivalence/id_testing_test.dart
similarity index 100%
rename from tests/compiler/dart2js/equivalence/id_testing_test.dart
rename to pkg/compiler/test/equivalence/id_testing_test.dart
diff --git a/tests/compiler/dart2js/equivalence/show_helper.dart b/pkg/compiler/test/equivalence/show_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/equivalence/show_helper.dart
rename to pkg/compiler/test/equivalence/show_helper.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/constant_fields.dart b/pkg/compiler/test/field_analysis/jdata/constant_fields.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/constant_fields.dart
rename to pkg/compiler/test/field_analysis/jdata/constant_fields.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/dynamic_set.dart b/pkg/compiler/test/field_analysis/jdata/dynamic_set.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/dynamic_set.dart
rename to pkg/compiler/test/field_analysis/jdata/dynamic_set.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/effectively_constant_state.dart b/pkg/compiler/test/field_analysis/jdata/effectively_constant_state.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/effectively_constant_state.dart
rename to pkg/compiler/test/field_analysis/jdata/effectively_constant_state.dart
diff --git a/pkg/compiler/test/field_analysis/jdata/marker.options b/pkg/compiler/test/field_analysis/jdata/marker.options
new file mode 100644
index 0000000..bba8a34
--- /dev/null
+++ b/pkg/compiler/test/field_analysis/jdata/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/field_analysis/jfield_analysis_test.dart
+prod:nnbd-off=pkg/compiler/test/field_analysis/jfield_analysis_test.dart
+spec:nnbd-sdk=pkg/compiler/test/field_analysis/jfield_analysis_test.dart
+prod:nnbd-sdk=pkg/compiler/test/field_analysis/jfield_analysis_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/field_analysis/jdata/multi_initializers.dart b/pkg/compiler/test/field_analysis/jdata/multi_initializers.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/multi_initializers.dart
rename to pkg/compiler/test/field_analysis/jdata/multi_initializers.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/optional_parameters.dart b/pkg/compiler/test/field_analysis/jdata/optional_parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/optional_parameters.dart
rename to pkg/compiler/test/field_analysis/jdata/optional_parameters.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/regress_36222.dart b/pkg/compiler/test/field_analysis/jdata/regress_36222.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/regress_36222.dart
rename to pkg/compiler/test/field_analysis/jdata/regress_36222.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/simple_initializers.dart b/pkg/compiler/test/field_analysis/jdata/simple_initializers.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/simple_initializers.dart
rename to pkg/compiler/test/field_analysis/jdata/simple_initializers.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/static_initializers.dart b/pkg/compiler/test/field_analysis/jdata/static_initializers.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/static_initializers.dart
rename to pkg/compiler/test/field_analysis/jdata/static_initializers.dart
diff --git a/tests/compiler/dart2js/field_analysis/jdata/unused_constructors.dart b/pkg/compiler/test/field_analysis/jdata/unused_constructors.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jdata/unused_constructors.dart
rename to pkg/compiler/test/field_analysis/jdata/unused_constructors.dart
diff --git a/tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart b/pkg/compiler/test/field_analysis/jfield_analysis_test.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart
rename to pkg/compiler/test/field_analysis/jfield_analysis_test.dart
diff --git a/tests/compiler/dart2js/field_analysis/kdata/constant_fields.dart b/pkg/compiler/test/field_analysis/kdata/constant_fields.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kdata/constant_fields.dart
rename to pkg/compiler/test/field_analysis/kdata/constant_fields.dart
diff --git a/pkg/compiler/test/field_analysis/kdata/marker.options b/pkg/compiler/test/field_analysis/kdata/marker.options
new file mode 100644
index 0000000..8620c4d
--- /dev/null
+++ b/pkg/compiler/test/field_analysis/kdata/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/field_analysis/kfield_analysis_test.dart
+prod:nnbd-off=pkg/compiler/test/field_analysis/kfield_analysis_test.dart
+spec:nnbd-sdk=pkg/compiler/test/field_analysis/kfield_analysis_test.dart
+prod:nnbd-sdk=pkg/compiler/test/field_analysis/kfield_analysis_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/field_analysis/kdata/multi_initializers.dart b/pkg/compiler/test/field_analysis/kdata/multi_initializers.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kdata/multi_initializers.dart
rename to pkg/compiler/test/field_analysis/kdata/multi_initializers.dart
diff --git a/tests/compiler/dart2js/field_analysis/kdata/optional_parameters.dart b/pkg/compiler/test/field_analysis/kdata/optional_parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kdata/optional_parameters.dart
rename to pkg/compiler/test/field_analysis/kdata/optional_parameters.dart
diff --git a/tests/compiler/dart2js/field_analysis/kdata/regress_36222.dart b/pkg/compiler/test/field_analysis/kdata/regress_36222.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kdata/regress_36222.dart
rename to pkg/compiler/test/field_analysis/kdata/regress_36222.dart
diff --git a/tests/compiler/dart2js/field_analysis/kdata/side_effects.dart b/pkg/compiler/test/field_analysis/kdata/side_effects.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kdata/side_effects.dart
rename to pkg/compiler/test/field_analysis/kdata/side_effects.dart
diff --git a/tests/compiler/dart2js/field_analysis/kdata/simple_initializers.dart b/pkg/compiler/test/field_analysis/kdata/simple_initializers.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kdata/simple_initializers.dart
rename to pkg/compiler/test/field_analysis/kdata/simple_initializers.dart
diff --git a/tests/compiler/dart2js/field_analysis/kdata/static_initializers.dart b/pkg/compiler/test/field_analysis/kdata/static_initializers.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kdata/static_initializers.dart
rename to pkg/compiler/test/field_analysis/kdata/static_initializers.dart
diff --git a/tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart b/pkg/compiler/test/field_analysis/kfield_analysis_test.dart
similarity index 100%
rename from tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart
rename to pkg/compiler/test/field_analysis/kfield_analysis_test.dart
diff --git a/tests/compiler/dart2js/generic_methods/function_type_variable_test.dart b/pkg/compiler/test/generic_methods/function_type_variable_test.dart
similarity index 100%
rename from tests/compiler/dart2js/generic_methods/function_type_variable_test.dart
rename to pkg/compiler/test/generic_methods/function_type_variable_test.dart
diff --git a/tests/compiler/dart2js/generic_methods/generic_method_test.dart b/pkg/compiler/test/generic_methods/generic_method_test.dart
similarity index 97%
rename from tests/compiler/dart2js/generic_methods/generic_method_test.dart
rename to pkg/compiler/test/generic_methods/generic_method_test.dart
index e9cd93a..14a4038 100644
--- a/tests/compiler/dart2js/generic_methods/generic_method_test.dart
+++ b/pkg/compiler/test/generic_methods/generic_method_test.dart
@@ -14,6 +14,7 @@
 import 'package:compiler/src/world.dart';
 import 'package:expect/expect.dart';
 import '../helpers/d8_helper.dart';
+import '../helpers/memory_compiler.dart';
 
 const String SOURCE = r'''
 @pragma('dart2js:noInline')
@@ -179,6 +180,7 @@
       'main.dart': SOURCE
     }, options: [
       Flags.disableRtiOptimization,
+      '--libraries-spec=$sdkLibrariesSpecificationUri',
     ], expectedOutput: OUTPUT, printJs: args.contains('-v'));
     Compiler compiler = result.compilationResult.compiler;
     JsBackendStrategy backendStrategy = compiler.backendStrategy;
diff --git a/tests/compiler/dart2js/generic_methods/generic_method_type_test.dart b/pkg/compiler/test/generic_methods/generic_method_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js/generic_methods/generic_method_type_test.dart
rename to pkg/compiler/test/generic_methods/generic_method_type_test.dart
diff --git a/tests/compiler/dart2js/generic_methods/instantiation_stub_test.dart b/pkg/compiler/test/generic_methods/instantiation_stub_test.dart
similarity index 100%
rename from tests/compiler/dart2js/generic_methods/instantiation_stub_test.dart
rename to pkg/compiler/test/generic_methods/instantiation_stub_test.dart
diff --git a/tests/compiler/dart2js/generic_methods/world_test.dart b/pkg/compiler/test/generic_methods/world_test.dart
similarity index 100%
rename from tests/compiler/dart2js/generic_methods/world_test.dart
rename to pkg/compiler/test/generic_methods/world_test.dart
diff --git a/tests/compiler/dart2js/helpers/args_helper.dart b/pkg/compiler/test/helpers/args_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/args_helper.dart
rename to pkg/compiler/test/helpers/args_helper.dart
diff --git a/tests/compiler/dart2js/helpers/compiler_helper.dart b/pkg/compiler/test/helpers/compiler_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/compiler_helper.dart
rename to pkg/compiler/test/helpers/compiler_helper.dart
diff --git a/tests/compiler/dart2js/helpers/d8_helper.dart b/pkg/compiler/test/helpers/d8_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/d8_helper.dart
rename to pkg/compiler/test/helpers/d8_helper.dart
diff --git a/tests/compiler/dart2js/helpers/diagnostic_helper.dart b/pkg/compiler/test/helpers/diagnostic_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/diagnostic_helper.dart
rename to pkg/compiler/test/helpers/diagnostic_helper.dart
diff --git a/tests/compiler/dart2js/helpers/element_lookup.dart b/pkg/compiler/test/helpers/element_lookup.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/element_lookup.dart
rename to pkg/compiler/test/helpers/element_lookup.dart
diff --git a/tests/compiler/dart2js/helpers/ir_types.dart b/pkg/compiler/test/helpers/ir_types.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/ir_types.dart
rename to pkg/compiler/test/helpers/ir_types.dart
diff --git a/tests/compiler/dart2js/helpers/link_helper.dart b/pkg/compiler/test/helpers/link_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/link_helper.dart
rename to pkg/compiler/test/helpers/link_helper.dart
diff --git a/tests/compiler/dart2js/helpers/memory_compiler.dart b/pkg/compiler/test/helpers/memory_compiler.dart
similarity index 96%
rename from tests/compiler/dart2js/helpers/memory_compiler.dart
rename to pkg/compiler/test/helpers/memory_compiler.dart
index 3fd019f..b6dbd63 100644
--- a/tests/compiler/dart2js/helpers/memory_compiler.dart
+++ b/pkg/compiler/test/helpers/memory_compiler.dart
@@ -8,7 +8,6 @@
 
 import 'dart:async';
 
-import 'package:_fe_analyzer_shared/src/util/filenames.dart';
 import 'package:compiler/compiler.dart' show DiagnosticHandler;
 import 'package:compiler/compiler_new.dart'
     show CompilationResult, CompilerDiagnostics, CompilerOutput, Diagnostic;
@@ -18,6 +17,8 @@
 import 'package:compiler/src/options.dart' show CompilerOptions;
 
 import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
+import 'package:front_end/src/compute_platform_binaries_location.dart'
+    show computePlatformBinariesLocation;
 
 import 'memory_source_file_helper.dart';
 
@@ -35,8 +36,9 @@
 Uri sdkLibrariesSpecificationUri =
     Uri.base.resolve(sdkLibrariesSpecificationPath);
 
-Uri sdkPlatformBinariesUri =
-    Uri.parse(nativeToUriPath(Platform.resolvedExecutable)).resolve('.');
+Uri sdkPlatformBinariesUri = computePlatformBinariesLocation()
+    .resolve("dart2js_platform.dill")
+    .resolve('.');
 
 String sdkPlatformBinariesPath = sdkPlatformBinariesUri.toString();
 
diff --git a/tests/compiler/dart2js/helpers/memory_source_file_helper.dart b/pkg/compiler/test/helpers/memory_source_file_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/memory_source_file_helper.dart
rename to pkg/compiler/test/helpers/memory_source_file_helper.dart
diff --git a/tests/compiler/dart2js/helpers/output_collector.dart b/pkg/compiler/test/helpers/output_collector.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/output_collector.dart
rename to pkg/compiler/test/helpers/output_collector.dart
diff --git a/tests/compiler/dart2js/helpers/program_lookup.dart b/pkg/compiler/test/helpers/program_lookup.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/program_lookup.dart
rename to pkg/compiler/test/helpers/program_lookup.dart
diff --git a/tests/compiler/dart2js/helpers/shared_helper.dart b/pkg/compiler/test/helpers/shared_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/shared_helper.dart
rename to pkg/compiler/test/helpers/shared_helper.dart
diff --git a/tests/compiler/dart2js/helpers/stats_test.dart b/pkg/compiler/test/helpers/stats_test.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/stats_test.dart
rename to pkg/compiler/test/helpers/stats_test.dart
diff --git a/tests/compiler/dart2js/helpers/text_helpers.dart b/pkg/compiler/test/helpers/text_helpers.dart
similarity index 100%
rename from tests/compiler/dart2js/helpers/text_helpers.dart
rename to pkg/compiler/test/helpers/text_helpers.dart
diff --git a/tests/compiler/dart2js/helpers/type_test_helper.dart b/pkg/compiler/test/helpers/type_test_helper.dart
similarity index 97%
rename from tests/compiler/dart2js/helpers/type_test_helper.dart
rename to pkg/compiler/test/helpers/type_test_helper.dart
index a6e089c..f7b6f65 100644
--- a/tests/compiler/dart2js/helpers/type_test_helper.dart
+++ b/pkg/compiler/test/helpers/type_test_helper.dart
@@ -197,9 +197,7 @@
     return compiler.frontendClosedWorldForTesting;
   }
 
-  String printType(DartType type) => type.toStructuredText(
-      printLegacyStars: options.printLegacyStars,
-      useLegacySubtyping: options.useLegacySubtyping);
+  String printType(DartType type) => type.toStructuredText(types, options);
 
   List<String> printTypes(List<DartType> types) =>
       types.map(printType).toList();
diff --git a/tests/compiler/dart2js/impact/data/as.dart b/pkg/compiler/test/impact/data/as.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/as.dart
rename to pkg/compiler/test/impact/data/as.dart
diff --git a/tests/compiler/dart2js/impact/data/async.dart b/pkg/compiler/test/impact/data/async.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/async.dart
rename to pkg/compiler/test/impact/data/async.dart
diff --git a/tests/compiler/dart2js/impact/data/classes.dart b/pkg/compiler/test/impact/data/classes.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/classes.dart
rename to pkg/compiler/test/impact/data/classes.dart
diff --git a/tests/compiler/dart2js/impact/data/constants/lib.dart b/pkg/compiler/test/impact/data/constants/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/constants/lib.dart
rename to pkg/compiler/test/impact/data/constants/lib.dart
diff --git a/tests/compiler/dart2js/impact/data/constants/main.dart b/pkg/compiler/test/impact/data/constants/main.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/constants/main.dart
rename to pkg/compiler/test/impact/data/constants/main.dart
diff --git a/tests/compiler/dart2js/impact/data/constructors.dart b/pkg/compiler/test/impact/data/constructors.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/constructors.dart
rename to pkg/compiler/test/impact/data/constructors.dart
diff --git a/tests/compiler/dart2js/impact/data/effectively_final.dart b/pkg/compiler/test/impact/data/effectively_final.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/effectively_final.dart
rename to pkg/compiler/test/impact/data/effectively_final.dart
diff --git a/tests/compiler/dart2js/impact/data/exact.dart b/pkg/compiler/test/impact/data/exact.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/exact.dart
rename to pkg/compiler/test/impact/data/exact.dart
diff --git a/tests/compiler/dart2js/impact/data/expressions.dart b/pkg/compiler/test/impact/data/expressions.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/expressions.dart
rename to pkg/compiler/test/impact/data/expressions.dart
diff --git a/tests/compiler/dart2js/impact/data/extract_type_arguments.dart b/pkg/compiler/test/impact/data/extract_type_arguments.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/extract_type_arguments.dart
rename to pkg/compiler/test/impact/data/extract_type_arguments.dart
diff --git a/tests/compiler/dart2js/impact/data/future_or.dart b/pkg/compiler/test/impact/data/future_or.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/future_or.dart
rename to pkg/compiler/test/impact/data/future_or.dart
diff --git a/tests/compiler/dart2js/impact/data/initializers.dart b/pkg/compiler/test/impact/data/initializers.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/initializers.dart
rename to pkg/compiler/test/impact/data/initializers.dart
diff --git a/tests/compiler/dart2js/impact/data/injected_cast.dart b/pkg/compiler/test/impact/data/injected_cast.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/injected_cast.dart
rename to pkg/compiler/test/impact/data/injected_cast.dart
diff --git a/tests/compiler/dart2js/impact/data/invokes.dart b/pkg/compiler/test/impact/data/invokes.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/invokes.dart
rename to pkg/compiler/test/impact/data/invokes.dart
diff --git a/tests/compiler/dart2js/impact/data/jsinterop.dart b/pkg/compiler/test/impact/data/jsinterop.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/jsinterop.dart
rename to pkg/compiler/test/impact/data/jsinterop.dart
diff --git a/tests/compiler/dart2js/impact/data/jsinterop_setter1.dart b/pkg/compiler/test/impact/data/jsinterop_setter1.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/jsinterop_setter1.dart
rename to pkg/compiler/test/impact/data/jsinterop_setter1.dart
diff --git a/tests/compiler/dart2js/impact/data/jsinterop_setter2.dart b/pkg/compiler/test/impact/data/jsinterop_setter2.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/jsinterop_setter2.dart
rename to pkg/compiler/test/impact/data/jsinterop_setter2.dart
diff --git a/tests/compiler/dart2js/impact/data/literals.dart b/pkg/compiler/test/impact/data/literals.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/literals.dart
rename to pkg/compiler/test/impact/data/literals.dart
diff --git a/pkg/compiler/test/impact/data/marker.options b/pkg/compiler/test/impact/data/marker.options
new file mode 100644
index 0000000..748dd96
--- /dev/null
+++ b/pkg/compiler/test/impact/data/marker.options
@@ -0,0 +1,2 @@
+spec:nnbd-off=pkg/compiler/test/impact/impact_test.dart
+spec:nnbd-sdk=pkg/compiler/test/impact/impact_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/impact/data/native.dart b/pkg/compiler/test/impact/data/native.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/native.dart
rename to pkg/compiler/test/impact/data/native.dart
diff --git a/tests/compiler/dart2js/impact/data/promotion.dart b/pkg/compiler/test/impact/data/promotion.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/promotion.dart
rename to pkg/compiler/test/impact/data/promotion.dart
diff --git a/tests/compiler/dart2js/impact/data/runtime_type.dart b/pkg/compiler/test/impact/data/runtime_type.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/runtime_type.dart
rename to pkg/compiler/test/impact/data/runtime_type.dart
diff --git a/tests/compiler/dart2js/impact/data/statements.dart b/pkg/compiler/test/impact/data/statements.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/statements.dart
rename to pkg/compiler/test/impact/data/statements.dart
diff --git a/tests/compiler/dart2js/impact/data/this.dart b/pkg/compiler/test/impact/data/this.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/data/this.dart
rename to pkg/compiler/test/impact/data/this.dart
diff --git a/tests/compiler/dart2js/impact/impact_test.dart b/pkg/compiler/test/impact/impact_test.dart
similarity index 100%
rename from tests/compiler/dart2js/impact/impact_test.dart
rename to pkg/compiler/test/impact/impact_test.dart
diff --git a/tests/compiler/dart2js/inference/callers/field_access.dart b/pkg/compiler/test/inference/callers/field_access.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/callers/field_access.dart
rename to pkg/compiler/test/inference/callers/field_access.dart
diff --git a/pkg/compiler/test/inference/callers/marker.options b/pkg/compiler/test/inference/callers/marker.options
new file mode 100644
index 0000000..ffdf5f7
--- /dev/null
+++ b/pkg/compiler/test/inference/callers/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/inference/callers_test.dart
+prod:nnbd-off=pkg/compiler/test/inference/callers_test.dart
+spec:nnbd-sdk=pkg/compiler/test/inference/callers_test.dart
+prod:nnbd-sdk=pkg/compiler/test/inference/callers_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/callers_test.dart b/pkg/compiler/test/inference/callers_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/callers_test.dart
rename to pkg/compiler/test/inference/callers_test.dart
diff --git a/tests/compiler/dart2js/inference/data/abstract_method.dart b/pkg/compiler/test/inference/data/abstract_method.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/abstract_method.dart
rename to pkg/compiler/test/inference/data/abstract_method.dart
diff --git a/tests/compiler/dart2js/inference/data/and_or.dart b/pkg/compiler/test/inference/data/and_or.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/and_or.dart
rename to pkg/compiler/test/inference/data/and_or.dart
diff --git a/tests/compiler/dart2js/inference/data/as.dart b/pkg/compiler/test/inference/data/as.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/as.dart
rename to pkg/compiler/test/inference/data/as.dart
diff --git a/tests/compiler/dart2js/inference/data/assert.dart b/pkg/compiler/test/inference/data/assert.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/assert.dart
rename to pkg/compiler/test/inference/data/assert.dart
diff --git a/tests/compiler/dart2js/inference/data/assert_ea.dart b/pkg/compiler/test/inference/data/assert_ea.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/assert_ea.dart
rename to pkg/compiler/test/inference/data/assert_ea.dart
diff --git a/tests/compiler/dart2js/inference/data/assert_message_throw.dart b/pkg/compiler/test/inference/data/assert_message_throw.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/assert_message_throw.dart
rename to pkg/compiler/test/inference/data/assert_message_throw.dart
diff --git a/tests/compiler/dart2js/inference/data/assert_message_throw_ea.dart b/pkg/compiler/test/inference/data/assert_message_throw_ea.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/assert_message_throw_ea.dart
rename to pkg/compiler/test/inference/data/assert_message_throw_ea.dart
diff --git a/tests/compiler/dart2js/inference/data/assign_op.dart b/pkg/compiler/test/inference/data/assign_op.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/assign_op.dart
rename to pkg/compiler/test/inference/data/assign_op.dart
diff --git a/tests/compiler/dart2js/inference/data/async_marker.dart b/pkg/compiler/test/inference/data/async_marker.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/async_marker.dart
rename to pkg/compiler/test/inference/data/async_marker.dart
diff --git a/tests/compiler/dart2js/inference/data/await.dart b/pkg/compiler/test/inference/data/await.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/await.dart
rename to pkg/compiler/test/inference/data/await.dart
diff --git a/tests/compiler/dart2js/inference/data/break_continue.dart b/pkg/compiler/test/inference/data/break_continue.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/break_continue.dart
rename to pkg/compiler/test/inference/data/break_continue.dart
diff --git a/tests/compiler/dart2js/inference/data/call_in_loop.dart b/pkg/compiler/test/inference/data/call_in_loop.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/call_in_loop.dart
rename to pkg/compiler/test/inference/data/call_in_loop.dart
diff --git a/tests/compiler/dart2js/inference/data/call_method_function_typed_value.dart b/pkg/compiler/test/inference/data/call_method_function_typed_value.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/call_method_function_typed_value.dart
rename to pkg/compiler/test/inference/data/call_method_function_typed_value.dart
diff --git a/tests/compiler/dart2js/inference/data/call_site.dart b/pkg/compiler/test/inference/data/call_site.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/call_site.dart
rename to pkg/compiler/test/inference/data/call_site.dart
diff --git a/tests/compiler/dart2js/inference/data/catch.dart b/pkg/compiler/test/inference/data/catch.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/catch.dart
rename to pkg/compiler/test/inference/data/catch.dart
diff --git a/tests/compiler/dart2js/inference/data/closure.dart b/pkg/compiler/test/inference/data/closure.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closure.dart
rename to pkg/compiler/test/inference/data/closure.dart
diff --git a/tests/compiler/dart2js/inference/data/closure2.dart b/pkg/compiler/test/inference/data/closure2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closure2.dart
rename to pkg/compiler/test/inference/data/closure2.dart
diff --git a/tests/compiler/dart2js/inference/data/closure_tracer.dart b/pkg/compiler/test/inference/data/closure_tracer.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closure_tracer.dart
rename to pkg/compiler/test/inference/data/closure_tracer.dart
diff --git a/tests/compiler/dart2js/inference/data/closure_tracer_28919.dart b/pkg/compiler/test/inference/data/closure_tracer_28919.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closure_tracer_28919.dart
rename to pkg/compiler/test/inference/data/closure_tracer_28919.dart
diff --git a/tests/compiler/dart2js/inference/data/closurization_instance.dart b/pkg/compiler/test/inference/data/closurization_instance.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closurization_instance.dart
rename to pkg/compiler/test/inference/data/closurization_instance.dart
diff --git a/tests/compiler/dart2js/inference/data/closurization_instance_call.dart b/pkg/compiler/test/inference/data/closurization_instance_call.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closurization_instance_call.dart
rename to pkg/compiler/test/inference/data/closurization_instance_call.dart
diff --git a/tests/compiler/dart2js/inference/data/closurization_local_call.dart b/pkg/compiler/test/inference/data/closurization_local_call.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closurization_local_call.dart
rename to pkg/compiler/test/inference/data/closurization_local_call.dart
diff --git a/tests/compiler/dart2js/inference/data/closurization_static.dart b/pkg/compiler/test/inference/data/closurization_static.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closurization_static.dart
rename to pkg/compiler/test/inference/data/closurization_static.dart
diff --git a/tests/compiler/dart2js/inference/data/closurization_static_call.dart b/pkg/compiler/test/inference/data/closurization_static_call.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/closurization_static_call.dart
rename to pkg/compiler/test/inference/data/closurization_static_call.dart
diff --git a/tests/compiler/dart2js/inference/data/conditional.dart b/pkg/compiler/test/inference/data/conditional.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/conditional.dart
rename to pkg/compiler/test/inference/data/conditional.dart
diff --git a/tests/compiler/dart2js/inference/data/const_closure.dart b/pkg/compiler/test/inference/data/const_closure.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/const_closure.dart
rename to pkg/compiler/test/inference/data/const_closure.dart
diff --git a/tests/compiler/dart2js/inference/data/const_closure2.dart b/pkg/compiler/test/inference/data/const_closure2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/const_closure2.dart
rename to pkg/compiler/test/inference/data/const_closure2.dart
diff --git a/tests/compiler/dart2js/inference/data/const_closure3.dart b/pkg/compiler/test/inference/data/const_closure3.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/const_closure3.dart
rename to pkg/compiler/test/inference/data/const_closure3.dart
diff --git a/tests/compiler/dart2js/inference/data/const_closure4.dart b/pkg/compiler/test/inference/data/const_closure4.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/const_closure4.dart
rename to pkg/compiler/test/inference/data/const_closure4.dart
diff --git a/tests/compiler/dart2js/inference/data/const_closure5.dart b/pkg/compiler/test/inference/data/const_closure5.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/const_closure5.dart
rename to pkg/compiler/test/inference/data/const_closure5.dart
diff --git a/tests/compiler/dart2js/inference/data/const_closure_default.dart b/pkg/compiler/test/inference/data/const_closure_default.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/const_closure_default.dart
rename to pkg/compiler/test/inference/data/const_closure_default.dart
diff --git a/tests/compiler/dart2js/inference/data/container_mask_equal.dart b/pkg/compiler/test/inference/data/container_mask_equal.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/container_mask_equal.dart
rename to pkg/compiler/test/inference/data/container_mask_equal.dart
diff --git a/tests/compiler/dart2js/inference/data/default_value.dart b/pkg/compiler/test/inference/data/default_value.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/default_value.dart
rename to pkg/compiler/test/inference/data/default_value.dart
diff --git a/tests/compiler/dart2js/inference/data/deferred_load.dart b/pkg/compiler/test/inference/data/deferred_load.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/deferred_load.dart
rename to pkg/compiler/test/inference/data/deferred_load.dart
diff --git a/tests/compiler/dart2js/inference/data/deferred_load_get.dart b/pkg/compiler/test/inference/data/deferred_load_get.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/deferred_load_get.dart
rename to pkg/compiler/test/inference/data/deferred_load_get.dart
diff --git a/tests/compiler/dart2js/inference/data/dictionary_types.dart b/pkg/compiler/test/inference/data/dictionary_types.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/dictionary_types.dart
rename to pkg/compiler/test/inference/data/dictionary_types.dart
diff --git a/tests/compiler/dart2js/inference/data/do.dart b/pkg/compiler/test/inference/data/do.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/do.dart
rename to pkg/compiler/test/inference/data/do.dart
diff --git a/tests/compiler/dart2js/inference/data/enum.dart b/pkg/compiler/test/inference/data/enum.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/enum.dart
rename to pkg/compiler/test/inference/data/enum.dart
diff --git a/tests/compiler/dart2js/inference/data/expose_this.dart b/pkg/compiler/test/inference/data/expose_this.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/expose_this.dart
rename to pkg/compiler/test/inference/data/expose_this.dart
diff --git a/tests/compiler/dart2js/inference/data/expose_this_closure.dart b/pkg/compiler/test/inference/data/expose_this_closure.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/expose_this_closure.dart
rename to pkg/compiler/test/inference/data/expose_this_closure.dart
diff --git a/tests/compiler/dart2js/inference/data/expose_this_field.dart b/pkg/compiler/test/inference/data/expose_this_field.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/expose_this_field.dart
rename to pkg/compiler/test/inference/data/expose_this_field.dart
diff --git a/tests/compiler/dart2js/inference/data/expose_this_mask.dart b/pkg/compiler/test/inference/data/expose_this_mask.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/expose_this_mask.dart
rename to pkg/compiler/test/inference/data/expose_this_mask.dart
diff --git a/tests/compiler/dart2js/inference/data/expose_this_super.dart b/pkg/compiler/test/inference/data/expose_this_super.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/expose_this_super.dart
rename to pkg/compiler/test/inference/data/expose_this_super.dart
diff --git a/tests/compiler/dart2js/inference/data/factory.dart b/pkg/compiler/test/inference/data/factory.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/factory.dart
rename to pkg/compiler/test/inference/data/factory.dart
diff --git a/tests/compiler/dart2js/inference/data/field_type.dart b/pkg/compiler/test/inference/data/field_type.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/field_type.dart
rename to pkg/compiler/test/inference/data/field_type.dart
diff --git a/tests/compiler/dart2js/inference/data/fields.dart b/pkg/compiler/test/inference/data/fields.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/fields.dart
rename to pkg/compiler/test/inference/data/fields.dart
diff --git a/tests/compiler/dart2js/inference/data/final_field.dart b/pkg/compiler/test/inference/data/final_field.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/final_field.dart
rename to pkg/compiler/test/inference/data/final_field.dart
diff --git a/tests/compiler/dart2js/inference/data/final_field2.dart b/pkg/compiler/test/inference/data/final_field2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/final_field2.dart
rename to pkg/compiler/test/inference/data/final_field2.dart
diff --git a/tests/compiler/dart2js/inference/data/final_field3.dart b/pkg/compiler/test/inference/data/final_field3.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/final_field3.dart
rename to pkg/compiler/test/inference/data/final_field3.dart
diff --git a/tests/compiler/dart2js/inference/data/finalized_type_variable.dart b/pkg/compiler/test/inference/data/finalized_type_variable.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/finalized_type_variable.dart
rename to pkg/compiler/test/inference/data/finalized_type_variable.dart
diff --git a/tests/compiler/dart2js/inference/data/for.dart b/pkg/compiler/test/inference/data/for.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/for.dart
rename to pkg/compiler/test/inference/data/for.dart
diff --git a/tests/compiler/dart2js/inference/data/for_in.dart b/pkg/compiler/test/inference/data/for_in.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/for_in.dart
rename to pkg/compiler/test/inference/data/for_in.dart
diff --git a/tests/compiler/dart2js/inference/data/foreign.dart b/pkg/compiler/test/inference/data/foreign.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/foreign.dart
rename to pkg/compiler/test/inference/data/foreign.dart
diff --git a/tests/compiler/dart2js/inference/data/general.dart b/pkg/compiler/test/inference/data/general.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/general.dart
rename to pkg/compiler/test/inference/data/general.dart
diff --git a/tests/compiler/dart2js/inference/data/general6.dart b/pkg/compiler/test/inference/data/general6.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/general6.dart
rename to pkg/compiler/test/inference/data/general6.dart
diff --git a/tests/compiler/dart2js/inference/data/general7.dart b/pkg/compiler/test/inference/data/general7.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/general7.dart
rename to pkg/compiler/test/inference/data/general7.dart
diff --git a/tests/compiler/dart2js/inference/data/general7_ea.dart b/pkg/compiler/test/inference/data/general7_ea.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/general7_ea.dart
rename to pkg/compiler/test/inference/data/general7_ea.dart
diff --git a/tests/compiler/dart2js/inference/data/general8a.dart b/pkg/compiler/test/inference/data/general8a.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/general8a.dart
rename to pkg/compiler/test/inference/data/general8a.dart
diff --git a/tests/compiler/dart2js/inference/data/general8b.dart b/pkg/compiler/test/inference/data/general8b.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/general8b.dart
rename to pkg/compiler/test/inference/data/general8b.dart
diff --git a/tests/compiler/dart2js/inference/data/global_field_closure.dart b/pkg/compiler/test/inference/data/global_field_closure.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/global_field_closure.dart
rename to pkg/compiler/test/inference/data/global_field_closure.dart
diff --git a/tests/compiler/dart2js/inference/data/global_field_closure2.dart b/pkg/compiler/test/inference/data/global_field_closure2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/global_field_closure2.dart
rename to pkg/compiler/test/inference/data/global_field_closure2.dart
diff --git a/tests/compiler/dart2js/inference/data/if.dart b/pkg/compiler/test/inference/data/if.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/if.dart
rename to pkg/compiler/test/inference/data/if.dart
diff --git a/tests/compiler/dart2js/inference/data/if_null.dart b/pkg/compiler/test/inference/data/if_null.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/if_null.dart
rename to pkg/compiler/test/inference/data/if_null.dart
diff --git a/tests/compiler/dart2js/inference/data/index.dart b/pkg/compiler/test/inference/data/index.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/index.dart
rename to pkg/compiler/test/inference/data/index.dart
diff --git a/tests/compiler/dart2js/inference/data/index_call.dart b/pkg/compiler/test/inference/data/index_call.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/index_call.dart
rename to pkg/compiler/test/inference/data/index_call.dart
diff --git a/tests/compiler/dart2js/inference/data/index_postfix.dart b/pkg/compiler/test/inference/data/index_postfix.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/index_postfix.dart
rename to pkg/compiler/test/inference/data/index_postfix.dart
diff --git a/tests/compiler/dart2js/inference/data/index_set.dart b/pkg/compiler/test/inference/data/index_set.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/index_set.dart
rename to pkg/compiler/test/inference/data/index_set.dart
diff --git a/tests/compiler/dart2js/inference/data/init_get.dart b/pkg/compiler/test/inference/data/init_get.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/init_get.dart
rename to pkg/compiler/test/inference/data/init_get.dart
diff --git a/tests/compiler/dart2js/inference/data/initializer.dart b/pkg/compiler/test/inference/data/initializer.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/initializer.dart
rename to pkg/compiler/test/inference/data/initializer.dart
diff --git a/tests/compiler/dart2js/inference/data/instance.dart b/pkg/compiler/test/inference/data/instance.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/instance.dart
rename to pkg/compiler/test/inference/data/instance.dart
diff --git a/tests/compiler/dart2js/inference/data/issue13354.dart b/pkg/compiler/test/inference/data/issue13354.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/issue13354.dart
rename to pkg/compiler/test/inference/data/issue13354.dart
diff --git a/tests/compiler/dart2js/inference/data/js_interop.dart b/pkg/compiler/test/inference/data/js_interop.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/js_interop.dart
rename to pkg/compiler/test/inference/data/js_interop.dart
diff --git a/tests/compiler/dart2js/inference/data/list.dart b/pkg/compiler/test/inference/data/list.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/list.dart
rename to pkg/compiler/test/inference/data/list.dart
diff --git a/tests/compiler/dart2js/inference/data/list_huge.dart b/pkg/compiler/test/inference/data/list_huge.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/list_huge.dart
rename to pkg/compiler/test/inference/data/list_huge.dart
diff --git a/tests/compiler/dart2js/inference/data/list_tracer2.dart b/pkg/compiler/test/inference/data/list_tracer2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/list_tracer2.dart
rename to pkg/compiler/test/inference/data/list_tracer2.dart
diff --git a/tests/compiler/dart2js/inference/data/list_tracer3.dart b/pkg/compiler/test/inference/data/list_tracer3.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/list_tracer3.dart
rename to pkg/compiler/test/inference/data/list_tracer3.dart
diff --git a/tests/compiler/dart2js/inference/data/list_tracer_typed_data_length.dart b/pkg/compiler/test/inference/data/list_tracer_typed_data_length.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/list_tracer_typed_data_length.dart
rename to pkg/compiler/test/inference/data/list_tracer_typed_data_length.dart
diff --git a/tests/compiler/dart2js/inference/data/local_functions.dart b/pkg/compiler/test/inference/data/local_functions.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/local_functions.dart
rename to pkg/compiler/test/inference/data/local_functions.dart
diff --git a/tests/compiler/dart2js/inference/data/local_functions_call.dart b/pkg/compiler/test/inference/data/local_functions_call.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/local_functions_call.dart
rename to pkg/compiler/test/inference/data/local_functions_call.dart
diff --git a/tests/compiler/dart2js/inference/data/locals.dart b/pkg/compiler/test/inference/data/locals.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/locals.dart
rename to pkg/compiler/test/inference/data/locals.dart
diff --git a/tests/compiler/dart2js/inference/data/locals_trust.dart b/pkg/compiler/test/inference/data/locals_trust.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/locals_trust.dart
rename to pkg/compiler/test/inference/data/locals_trust.dart
diff --git a/tests/compiler/dart2js/inference/data/logical.dart b/pkg/compiler/test/inference/data/logical.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/logical.dart
rename to pkg/compiler/test/inference/data/logical.dart
diff --git a/tests/compiler/dart2js/inference/data/logical_if.dart b/pkg/compiler/test/inference/data/logical_if.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/logical_if.dart
rename to pkg/compiler/test/inference/data/logical_if.dart
diff --git a/tests/compiler/dart2js/inference/data/map.dart b/pkg/compiler/test/inference/data/map.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/map.dart
rename to pkg/compiler/test/inference/data/map.dart
diff --git a/tests/compiler/dart2js/inference/data/map_tracer_const.dart b/pkg/compiler/test/inference/data/map_tracer_const.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/map_tracer_const.dart
rename to pkg/compiler/test/inference/data/map_tracer_const.dart
diff --git a/tests/compiler/dart2js/inference/data/map_tracer_keys.dart b/pkg/compiler/test/inference/data/map_tracer_keys.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/map_tracer_keys.dart
rename to pkg/compiler/test/inference/data/map_tracer_keys.dart
diff --git a/pkg/compiler/test/inference/data/marker.options b/pkg/compiler/test/inference/data/marker.options
new file mode 100644
index 0000000..ff9c9e6
--- /dev/null
+++ b/pkg/compiler/test/inference/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/inference/inference_test_helper.dart
+prod:nnbd-off=pkg/compiler/test/inference/inference_test_helper.dart
+spec:nnbd-sdk=pkg/compiler/test/inference/inference_test_helper.dart
+prod:nnbd-sdk=pkg/compiler/test/inference/inference_test_helper.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/data/mixin_constructor_default_parameter_values/lib.dart b/pkg/compiler/test/inference/data/mixin_constructor_default_parameter_values/lib.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/mixin_constructor_default_parameter_values/lib.dart
rename to pkg/compiler/test/inference/data/mixin_constructor_default_parameter_values/lib.dart
diff --git a/tests/compiler/dart2js/inference/data/mixin_constructor_default_parameter_values/main.dart b/pkg/compiler/test/inference/data/mixin_constructor_default_parameter_values/main.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/mixin_constructor_default_parameter_values/main.dart
rename to pkg/compiler/test/inference/data/mixin_constructor_default_parameter_values/main.dart
diff --git a/tests/compiler/dart2js/inference/data/narrowing.dart b/pkg/compiler/test/inference/data/narrowing.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/narrowing.dart
rename to pkg/compiler/test/inference/data/narrowing.dart
diff --git a/tests/compiler/dart2js/inference/data/native.dart b/pkg/compiler/test/inference/data/native.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/native.dart
rename to pkg/compiler/test/inference/data/native.dart
diff --git a/tests/compiler/dart2js/inference/data/native2.dart b/pkg/compiler/test/inference/data/native2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/native2.dart
rename to pkg/compiler/test/inference/data/native2.dart
diff --git a/tests/compiler/dart2js/inference/data/native3.dart b/pkg/compiler/test/inference/data/native3.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/native3.dart
rename to pkg/compiler/test/inference/data/native3.dart
diff --git a/tests/compiler/dart2js/inference/data/new.dart b/pkg/compiler/test/inference/data/new.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/new.dart
rename to pkg/compiler/test/inference/data/new.dart
diff --git a/tests/compiler/dart2js/inference/data/no_such_method.dart b/pkg/compiler/test/inference/data/no_such_method.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/no_such_method.dart
rename to pkg/compiler/test/inference/data/no_such_method.dart
diff --git a/tests/compiler/dart2js/inference/data/no_such_method1.dart b/pkg/compiler/test/inference/data/no_such_method1.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/no_such_method1.dart
rename to pkg/compiler/test/inference/data/no_such_method1.dart
diff --git a/tests/compiler/dart2js/inference/data/no_such_method2.dart b/pkg/compiler/test/inference/data/no_such_method2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/no_such_method2.dart
rename to pkg/compiler/test/inference/data/no_such_method2.dart
diff --git a/tests/compiler/dart2js/inference/data/no_such_method3.dart b/pkg/compiler/test/inference/data/no_such_method3.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/no_such_method3.dart
rename to pkg/compiler/test/inference/data/no_such_method3.dart
diff --git a/tests/compiler/dart2js/inference/data/no_such_method4.dart b/pkg/compiler/test/inference/data/no_such_method4.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/no_such_method4.dart
rename to pkg/compiler/test/inference/data/no_such_method4.dart
diff --git a/tests/compiler/dart2js/inference/data/non_null.dart b/pkg/compiler/test/inference/data/non_null.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/non_null.dart
rename to pkg/compiler/test/inference/data/non_null.dart
diff --git a/tests/compiler/dart2js/inference/data/null.dart b/pkg/compiler/test/inference/data/null.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/null.dart
rename to pkg/compiler/test/inference/data/null.dart
diff --git a/tests/compiler/dart2js/inference/data/optimizer_hints.dart b/pkg/compiler/test/inference/data/optimizer_hints.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/optimizer_hints.dart
rename to pkg/compiler/test/inference/data/optimizer_hints.dart
diff --git a/tests/compiler/dart2js/inference/data/parameters_trust.dart b/pkg/compiler/test/inference/data/parameters_trust.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/parameters_trust.dart
rename to pkg/compiler/test/inference/data/parameters_trust.dart
diff --git a/tests/compiler/dart2js/inference/data/postfix.dart b/pkg/compiler/test/inference/data/postfix.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/postfix.dart
rename to pkg/compiler/test/inference/data/postfix.dart
diff --git a/tests/compiler/dart2js/inference/data/postfix_prefix.dart b/pkg/compiler/test/inference/data/postfix_prefix.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/postfix_prefix.dart
rename to pkg/compiler/test/inference/data/postfix_prefix.dart
diff --git a/tests/compiler/dart2js/inference/data/prefix.dart b/pkg/compiler/test/inference/data/prefix.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/prefix.dart
rename to pkg/compiler/test/inference/data/prefix.dart
diff --git a/tests/compiler/dart2js/inference/data/refine_captured_locals.dart b/pkg/compiler/test/inference/data/refine_captured_locals.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/refine_captured_locals.dart
rename to pkg/compiler/test/inference/data/refine_captured_locals.dart
diff --git a/tests/compiler/dart2js/inference/data/refine_locals.dart b/pkg/compiler/test/inference/data/refine_locals.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/refine_locals.dart
rename to pkg/compiler/test/inference/data/refine_locals.dart
diff --git a/tests/compiler/dart2js/inference/data/refine_order.dart b/pkg/compiler/test/inference/data/refine_order.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/refine_order.dart
rename to pkg/compiler/test/inference/data/refine_order.dart
diff --git a/tests/compiler/dart2js/inference/data/return.dart b/pkg/compiler/test/inference/data/return.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/return.dart
rename to pkg/compiler/test/inference/data/return.dart
diff --git a/tests/compiler/dart2js/inference/data/simple.dart b/pkg/compiler/test/inference/data/simple.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/simple.dart
rename to pkg/compiler/test/inference/data/simple.dart
diff --git a/tests/compiler/dart2js/inference/data/static.dart b/pkg/compiler/test/inference/data/static.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/static.dart
rename to pkg/compiler/test/inference/data/static.dart
diff --git a/tests/compiler/dart2js/inference/data/static_get.dart b/pkg/compiler/test/inference/data/static_get.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/static_get.dart
rename to pkg/compiler/test/inference/data/static_get.dart
diff --git a/tests/compiler/dart2js/inference/data/static_set.dart b/pkg/compiler/test/inference/data/static_set.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/static_set.dart
rename to pkg/compiler/test/inference/data/static_set.dart
diff --git a/tests/compiler/dart2js/inference/data/static_type.dart b/pkg/compiler/test/inference/data/static_type.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/static_type.dart
rename to pkg/compiler/test/inference/data/static_type.dart
diff --git a/tests/compiler/dart2js/inference/data/super_get.dart b/pkg/compiler/test/inference/data/super_get.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/super_get.dart
rename to pkg/compiler/test/inference/data/super_get.dart
diff --git a/tests/compiler/dart2js/inference/data/super_invoke.dart b/pkg/compiler/test/inference/data/super_invoke.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/super_invoke.dart
rename to pkg/compiler/test/inference/data/super_invoke.dart
diff --git a/tests/compiler/dart2js/inference/data/super_set.dart b/pkg/compiler/test/inference/data/super_set.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/super_set.dart
rename to pkg/compiler/test/inference/data/super_set.dart
diff --git a/tests/compiler/dart2js/inference/data/switch.dart b/pkg/compiler/test/inference/data/switch.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/switch.dart
rename to pkg/compiler/test/inference/data/switch.dart
diff --git a/tests/compiler/dart2js/inference/data/switch1.dart b/pkg/compiler/test/inference/data/switch1.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/switch1.dart
rename to pkg/compiler/test/inference/data/switch1.dart
diff --git a/tests/compiler/dart2js/inference/data/switch2.dart b/pkg/compiler/test/inference/data/switch2.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/switch2.dart
rename to pkg/compiler/test/inference/data/switch2.dart
diff --git a/tests/compiler/dart2js/inference/data/switch5.dart b/pkg/compiler/test/inference/data/switch5.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/switch5.dart
rename to pkg/compiler/test/inference/data/switch5.dart
diff --git a/tests/compiler/dart2js/inference/data/switch6.dart b/pkg/compiler/test/inference/data/switch6.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/switch6.dart
rename to pkg/compiler/test/inference/data/switch6.dart
diff --git a/tests/compiler/dart2js/inference/data/throw.dart b/pkg/compiler/test/inference/data/throw.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/throw.dart
rename to pkg/compiler/test/inference/data/throw.dart
diff --git a/tests/compiler/dart2js/inference/data/try.dart b/pkg/compiler/test/inference/data/try.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/try.dart
rename to pkg/compiler/test/inference/data/try.dart
diff --git a/tests/compiler/dart2js/inference/data/try_catch.dart b/pkg/compiler/test/inference/data/try_catch.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/try_catch.dart
rename to pkg/compiler/test/inference/data/try_catch.dart
diff --git a/tests/compiler/dart2js/inference/data/type_literal.dart b/pkg/compiler/test/inference/data/type_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/type_literal.dart
rename to pkg/compiler/test/inference/data/type_literal.dart
diff --git a/tests/compiler/dart2js/inference/data/unregister_call.dart b/pkg/compiler/test/inference/data/unregister_call.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/unregister_call.dart
rename to pkg/compiler/test/inference/data/unregister_call.dart
diff --git a/tests/compiler/dart2js/inference/data/use_static_types.dart b/pkg/compiler/test/inference/data/use_static_types.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/use_static_types.dart
rename to pkg/compiler/test/inference/data/use_static_types.dart
diff --git a/tests/compiler/dart2js/inference/data/while.dart b/pkg/compiler/test/inference/data/while.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/while.dart
rename to pkg/compiler/test/inference/data/while.dart
diff --git a/tests/compiler/dart2js/inference/data/yield.dart b/pkg/compiler/test/inference/data/yield.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/data/yield.dart
rename to pkg/compiler/test/inference/data/yield.dart
diff --git a/tests/compiler/dart2js/inference/inference0_test.dart b/pkg/compiler/test/inference/inference0_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference0_test.dart
rename to pkg/compiler/test/inference/inference0_test.dart
diff --git a/tests/compiler/dart2js/inference/inference1_test.dart b/pkg/compiler/test/inference/inference1_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference1_test.dart
rename to pkg/compiler/test/inference/inference1_test.dart
diff --git a/tests/compiler/dart2js/inference/inference2_test.dart b/pkg/compiler/test/inference/inference2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference2_test.dart
rename to pkg/compiler/test/inference/inference2_test.dart
diff --git a/tests/compiler/dart2js/inference/inference3_test.dart b/pkg/compiler/test/inference/inference3_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference3_test.dart
rename to pkg/compiler/test/inference/inference3_test.dart
diff --git a/tests/compiler/dart2js/inference/inference_data/called_in_loop.dart b/pkg/compiler/test/inference/inference_data/called_in_loop.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference_data/called_in_loop.dart
rename to pkg/compiler/test/inference/inference_data/called_in_loop.dart
diff --git a/tests/compiler/dart2js/inference/inference_data/cannot_throw.dart b/pkg/compiler/test/inference/inference_data/cannot_throw.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference_data/cannot_throw.dart
rename to pkg/compiler/test/inference/inference_data/cannot_throw.dart
diff --git a/tests/compiler/dart2js/inference/inference_data/function_apply.dart b/pkg/compiler/test/inference/inference_data/function_apply.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference_data/function_apply.dart
rename to pkg/compiler/test/inference/inference_data/function_apply.dart
diff --git a/pkg/compiler/test/inference/inference_data/marker.options b/pkg/compiler/test/inference/inference_data/marker.options
new file mode 100644
index 0000000..ef66b97
--- /dev/null
+++ b/pkg/compiler/test/inference/inference_data/marker.options
@@ -0,0 +1,2 @@
+spec:nnbd-off=pkg/compiler/test/inference/inference_data_test.dart
+spec:nnbd-sdk=pkg/compiler/test/inference/inference_data_test.dart
diff --git a/tests/compiler/dart2js/inference/inference_data_test.dart b/pkg/compiler/test/inference/inference_data_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference_data_test.dart
rename to pkg/compiler/test/inference/inference_data_test.dart
diff --git a/tests/compiler/dart2js/inference/inference_test_helper.dart b/pkg/compiler/test/inference/inference_test_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/inference_test_helper.dart
rename to pkg/compiler/test/inference/inference_test_helper.dart
diff --git a/tests/compiler/dart2js/inference/list_tracer_test.dart b/pkg/compiler/test/inference/list_tracer_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/list_tracer_test.dart
rename to pkg/compiler/test/inference/list_tracer_test.dart
diff --git a/tests/compiler/dart2js/inference/load_deferred_library_test.dart b/pkg/compiler/test/inference/load_deferred_library_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/load_deferred_library_test.dart
rename to pkg/compiler/test/inference/load_deferred_library_test.dart
diff --git a/tests/compiler/dart2js/inference/map_tracer_test.dart b/pkg/compiler/test/inference/map_tracer_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/map_tracer_test.dart
rename to pkg/compiler/test/inference/map_tracer_test.dart
diff --git a/tests/compiler/dart2js/inference/null_flat_type_mask_test.dart b/pkg/compiler/test/inference/null_flat_type_mask_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/null_flat_type_mask_test.dart
rename to pkg/compiler/test/inference/null_flat_type_mask_test.dart
diff --git a/tests/compiler/dart2js/inference/show.dart b/pkg/compiler/test/inference/show.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/show.dart
rename to pkg/compiler/test/inference/show.dart
diff --git a/tests/compiler/dart2js/inference/side_effects/annotations.dart b/pkg/compiler/test/inference/side_effects/annotations.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/side_effects/annotations.dart
rename to pkg/compiler/test/inference/side_effects/annotations.dart
diff --git a/tests/compiler/dart2js/inference/side_effects/foreign.dart b/pkg/compiler/test/inference/side_effects/foreign.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/side_effects/foreign.dart
rename to pkg/compiler/test/inference/side_effects/foreign.dart
diff --git a/tests/compiler/dart2js/inference/side_effects/local_functions.dart b/pkg/compiler/test/inference/side_effects/local_functions.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/side_effects/local_functions.dart
rename to pkg/compiler/test/inference/side_effects/local_functions.dart
diff --git a/pkg/compiler/test/inference/side_effects/marker.options b/pkg/compiler/test/inference/side_effects/marker.options
new file mode 100644
index 0000000..13c6bf7
--- /dev/null
+++ b/pkg/compiler/test/inference/side_effects/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/inference/side_effects_test.dart
+prod:nnbd-off=pkg/compiler/test/inference/side_effects_test.dart
+spec:nnbd-sdk=pkg/compiler/test/inference/side_effects_test.dart
+prod:nnbd-sdk=pkg/compiler/test/inference/side_effects_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/side_effects/methods.dart b/pkg/compiler/test/inference/side_effects/methods.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/side_effects/methods.dart
rename to pkg/compiler/test/inference/side_effects/methods.dart
diff --git a/tests/compiler/dart2js/inference/side_effects/out_of_order.dart b/pkg/compiler/test/inference/side_effects/out_of_order.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/side_effects/out_of_order.dart
rename to pkg/compiler/test/inference/side_effects/out_of_order.dart
diff --git a/tests/compiler/dart2js/inference/side_effects/string_interpolation.dart b/pkg/compiler/test/inference/side_effects/string_interpolation.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/side_effects/string_interpolation.dart
rename to pkg/compiler/test/inference/side_effects/string_interpolation.dart
diff --git a/tests/compiler/dart2js/inference/side_effects_test.dart b/pkg/compiler/test/inference/side_effects_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/side_effects_test.dart
rename to pkg/compiler/test/inference/side_effects_test.dart
diff --git a/tests/compiler/dart2js/inference/trivial_abstract_value_domain_test.dart b/pkg/compiler/test/inference/trivial_abstract_value_domain_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/trivial_abstract_value_domain_test.dart
rename to pkg/compiler/test/inference/trivial_abstract_value_domain_test.dart
diff --git a/tests/compiler/dart2js/inference/type_combination_test.dart b/pkg/compiler/test/inference/type_combination_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/type_combination_test.dart
rename to pkg/compiler/test/inference/type_combination_test.dart
diff --git a/tests/compiler/dart2js/inference/type_mask2_test.dart b/pkg/compiler/test/inference/type_mask2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/type_mask2_test.dart
rename to pkg/compiler/test/inference/type_mask2_test.dart
diff --git a/tests/compiler/dart2js/inference/type_mask_disjoint_test.dart b/pkg/compiler/test/inference/type_mask_disjoint_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/type_mask_disjoint_test.dart
rename to pkg/compiler/test/inference/type_mask_disjoint_test.dart
diff --git a/tests/compiler/dart2js/inference/type_mask_test.dart b/pkg/compiler/test/inference/type_mask_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/type_mask_test.dart
rename to pkg/compiler/test/inference/type_mask_test.dart
diff --git a/tests/compiler/dart2js/inference/type_mask_test_helper.dart b/pkg/compiler/test/inference/type_mask_test_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/type_mask_test_helper.dart
rename to pkg/compiler/test/inference/type_mask_test_helper.dart
diff --git a/tests/compiler/dart2js/inference/union_type_test.dart b/pkg/compiler/test/inference/union_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inference/union_type_test.dart
rename to pkg/compiler/test/inference/union_type_test.dart
diff --git a/tests/compiler/dart2js/inlining/data/conditional.dart b/pkg/compiler/test/inlining/data/conditional.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/conditional.dart
rename to pkg/compiler/test/inlining/data/conditional.dart
diff --git a/tests/compiler/dart2js/inlining/data/constructor.dart b/pkg/compiler/test/inlining/data/constructor.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/constructor.dart
rename to pkg/compiler/test/inlining/data/constructor.dart
diff --git a/tests/compiler/dart2js/inlining/data/dynamic.dart b/pkg/compiler/test/inlining/data/dynamic.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/dynamic.dart
rename to pkg/compiler/test/inlining/data/dynamic.dart
diff --git a/tests/compiler/dart2js/inlining/data/external.dart b/pkg/compiler/test/inlining/data/external.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/external.dart
rename to pkg/compiler/test/inlining/data/external.dart
diff --git a/tests/compiler/dart2js/inlining/data/force_inline.dart b/pkg/compiler/test/inlining/data/force_inline.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/force_inline.dart
rename to pkg/compiler/test/inlining/data/force_inline.dart
diff --git a/tests/compiler/dart2js/inlining/data/force_inline_loops.dart b/pkg/compiler/test/inlining/data/force_inline_loops.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/force_inline_loops.dart
rename to pkg/compiler/test/inlining/data/force_inline_loops.dart
diff --git a/tests/compiler/dart2js/inlining/data/heuristics.dart b/pkg/compiler/test/inlining/data/heuristics.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/heuristics.dart
rename to pkg/compiler/test/inlining/data/heuristics.dart
diff --git a/tests/compiler/dart2js/inlining/data/map.dart b/pkg/compiler/test/inlining/data/map.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/map.dart
rename to pkg/compiler/test/inlining/data/map.dart
diff --git a/pkg/compiler/test/inlining/data/marker.options b/pkg/compiler/test/inlining/data/marker.options
new file mode 100644
index 0000000..3c4814a
--- /dev/null
+++ b/pkg/compiler/test/inlining/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/inlining/inlining_test.dart
+prod:nnbd-off=pkg/compiler/test/inlining/inlining_test.dart
+spec:nnbd-sdk=pkg/compiler/test/inlining/inlining_test.dart
+prod:nnbd-sdk=pkg/compiler/test/inlining/inlining_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inlining/data/meta.dart b/pkg/compiler/test/inlining/data/meta.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/meta.dart
rename to pkg/compiler/test/inlining/data/meta.dart
diff --git a/tests/compiler/dart2js/inlining/data/native.dart b/pkg/compiler/test/inlining/data/native.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/native.dart
rename to pkg/compiler/test/inlining/data/native.dart
diff --git a/tests/compiler/dart2js/inlining/data/nested.dart b/pkg/compiler/test/inlining/data/nested.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/nested.dart
rename to pkg/compiler/test/inlining/data/nested.dart
diff --git a/tests/compiler/dart2js/inlining/data/setter.dart b/pkg/compiler/test/inlining/data/setter.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/setter.dart
rename to pkg/compiler/test/inlining/data/setter.dart
diff --git a/tests/compiler/dart2js/inlining/data/static_initializer.dart b/pkg/compiler/test/inlining/data/static_initializer.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/static_initializer.dart
rename to pkg/compiler/test/inlining/data/static_initializer.dart
diff --git a/tests/compiler/dart2js/inlining/data/switch.dart b/pkg/compiler/test/inlining/data/switch.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/switch.dart
rename to pkg/compiler/test/inlining/data/switch.dart
diff --git a/tests/compiler/dart2js/inlining/data/too_difficult.dart b/pkg/compiler/test/inlining/data/too_difficult.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/too_difficult.dart
rename to pkg/compiler/test/inlining/data/too_difficult.dart
diff --git a/tests/compiler/dart2js/inlining/data/type_variables.dart b/pkg/compiler/test/inlining/data/type_variables.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/data/type_variables.dart
rename to pkg/compiler/test/inlining/data/type_variables.dart
diff --git a/tests/compiler/dart2js/inlining/inlining_test.dart b/pkg/compiler/test/inlining/inlining_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/inlining_test.dart
rename to pkg/compiler/test/inlining/inlining_test.dart
diff --git a/tests/compiler/dart2js/inlining/inlining_viewer.dart b/pkg/compiler/test/inlining/inlining_viewer.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/inlining_viewer.dart
rename to pkg/compiler/test/inlining/inlining_viewer.dart
diff --git a/tests/compiler/dart2js/inlining/meta_annotations2_test.dart b/pkg/compiler/test/inlining/meta_annotations2_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/meta_annotations2_test.dart
rename to pkg/compiler/test/inlining/meta_annotations2_test.dart
diff --git a/tests/compiler/dart2js/inlining/meta_annotations3_test.dart b/pkg/compiler/test/inlining/meta_annotations3_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/meta_annotations3_test.dart
rename to pkg/compiler/test/inlining/meta_annotations3_test.dart
diff --git a/tests/compiler/dart2js/inlining/meta_annotations_test.dart b/pkg/compiler/test/inlining/meta_annotations_test.dart
similarity index 100%
rename from tests/compiler/dart2js/inlining/meta_annotations_test.dart
rename to pkg/compiler/test/inlining/meta_annotations_test.dart
diff --git a/tests/compiler/dart2js/js/js_constant_test.dart b/pkg/compiler/test/js/js_constant_test.dart
similarity index 100%
rename from tests/compiler/dart2js/js/js_constant_test.dart
rename to pkg/compiler/test/js/js_constant_test.dart
diff --git a/tests/compiler/dart2js/js/js_parser_statements_test.dart b/pkg/compiler/test/js/js_parser_statements_test.dart
similarity index 100%
rename from tests/compiler/dart2js/js/js_parser_statements_test.dart
rename to pkg/compiler/test/js/js_parser_statements_test.dart
diff --git a/tests/compiler/dart2js/js/js_parser_test.dart b/pkg/compiler/test/js/js_parser_test.dart
similarity index 100%
rename from tests/compiler/dart2js/js/js_parser_test.dart
rename to pkg/compiler/test/js/js_parser_test.dart
diff --git a/tests/compiler/dart2js/js/js_safety_test.dart b/pkg/compiler/test/js/js_safety_test.dart
similarity index 100%
rename from tests/compiler/dart2js/js/js_safety_test.dart
rename to pkg/compiler/test/js/js_safety_test.dart
diff --git a/tests/compiler/dart2js/js/js_spec_optimization_test.dart b/pkg/compiler/test/js/js_spec_optimization_test.dart
similarity index 100%
rename from tests/compiler/dart2js/js/js_spec_optimization_test.dart
rename to pkg/compiler/test/js/js_spec_optimization_test.dart
diff --git a/tests/compiler/dart2js/js/js_spec_string_test.dart b/pkg/compiler/test/js/js_spec_string_test.dart
similarity index 100%
rename from tests/compiler/dart2js/js/js_spec_string_test.dart
rename to pkg/compiler/test/js/js_spec_string_test.dart
diff --git a/tests/compiler/dart2js/js/js_throw_behavior_test.dart b/pkg/compiler/test/js/js_throw_behavior_test.dart
similarity index 100%
rename from tests/compiler/dart2js/js/js_throw_behavior_test.dart
rename to pkg/compiler/test/js/js_throw_behavior_test.dart
diff --git a/tests/compiler/dart2js/jsinterop/declaration_test.dart b/pkg/compiler/test/jsinterop/declaration_test.dart
similarity index 100%
rename from tests/compiler/dart2js/jsinterop/declaration_test.dart
rename to pkg/compiler/test/jsinterop/declaration_test.dart
diff --git a/tests/compiler/dart2js/jsinterop/interop_anonymous_unreachable_test.dart b/pkg/compiler/test/jsinterop/interop_anonymous_unreachable_test.dart
similarity index 100%
rename from tests/compiler/dart2js/jsinterop/interop_anonymous_unreachable_test.dart
rename to pkg/compiler/test/jsinterop/interop_anonymous_unreachable_test.dart
diff --git a/tests/compiler/dart2js/jsinterop/world_test.dart b/pkg/compiler/test/jsinterop/world_test.dart
similarity index 100%
rename from tests/compiler/dart2js/jsinterop/world_test.dart
rename to pkg/compiler/test/jsinterop/world_test.dart
diff --git a/tests/compiler/dart2js/jumps/data/complex_loops.dart b/pkg/compiler/test/jumps/data/complex_loops.dart
similarity index 100%
rename from tests/compiler/dart2js/jumps/data/complex_loops.dart
rename to pkg/compiler/test/jumps/data/complex_loops.dart
diff --git a/tests/compiler/dart2js/jumps/data/labeled_statements.dart b/pkg/compiler/test/jumps/data/labeled_statements.dart
similarity index 100%
rename from tests/compiler/dart2js/jumps/data/labeled_statements.dart
rename to pkg/compiler/test/jumps/data/labeled_statements.dart
diff --git a/pkg/compiler/test/jumps/data/marker.options b/pkg/compiler/test/jumps/data/marker.options
new file mode 100644
index 0000000..d5cd398
--- /dev/null
+++ b/pkg/compiler/test/jumps/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/jumps/jump_test.dart
+prod:nnbd-off=pkg/compiler/test/jumps/jump_test.dart
+spec:nnbd-sdk=pkg/compiler/test/jumps/jump_test.dart
+prod:nnbd-sdk=pkg/compiler/test/jumps/jump_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/jumps/data/nested_loops.dart b/pkg/compiler/test/jumps/data/nested_loops.dart
similarity index 100%
rename from tests/compiler/dart2js/jumps/data/nested_loops.dart
rename to pkg/compiler/test/jumps/data/nested_loops.dart
diff --git a/tests/compiler/dart2js/jumps/data/simple_loops.dart b/pkg/compiler/test/jumps/data/simple_loops.dart
similarity index 100%
rename from tests/compiler/dart2js/jumps/data/simple_loops.dart
rename to pkg/compiler/test/jumps/data/simple_loops.dart
diff --git a/tests/compiler/dart2js/jumps/data/switch.dart b/pkg/compiler/test/jumps/data/switch.dart
similarity index 100%
rename from tests/compiler/dart2js/jumps/data/switch.dart
rename to pkg/compiler/test/jumps/data/switch.dart
diff --git a/tests/compiler/dart2js/jumps/jump_test.dart b/pkg/compiler/test/jumps/jump_test.dart
similarity index 100%
rename from tests/compiler/dart2js/jumps/jump_test.dart
rename to pkg/compiler/test/jumps/jump_test.dart
diff --git a/tests/compiler/dart2js/member_usage/data/constant_folding.dart b/pkg/compiler/test/member_usage/data/constant_folding.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/constant_folding.dart
rename to pkg/compiler/test/member_usage/data/constant_folding.dart
diff --git a/tests/compiler/dart2js/member_usage/data/constructors.dart b/pkg/compiler/test/member_usage/data/constructors.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/constructors.dart
rename to pkg/compiler/test/member_usage/data/constructors.dart
diff --git a/tests/compiler/dart2js/member_usage/data/fields.dart b/pkg/compiler/test/member_usage/data/fields.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/fields.dart
rename to pkg/compiler/test/member_usage/data/fields.dart
diff --git a/tests/compiler/dart2js/member_usage/data/general.dart b/pkg/compiler/test/member_usage/data/general.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/general.dart
rename to pkg/compiler/test/member_usage/data/general.dart
diff --git a/tests/compiler/dart2js/member_usage/data/generic.dart b/pkg/compiler/test/member_usage/data/generic.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/generic.dart
rename to pkg/compiler/test/member_usage/data/generic.dart
diff --git a/tests/compiler/dart2js/member_usage/data/instance_method_parameters.dart b/pkg/compiler/test/member_usage/data/instance_method_parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/instance_method_parameters.dart
rename to pkg/compiler/test/member_usage/data/instance_method_parameters.dart
diff --git a/pkg/compiler/test/member_usage/data/marker.options b/pkg/compiler/test/member_usage/data/marker.options
new file mode 100644
index 0000000..b2c1e08
--- /dev/null
+++ b/pkg/compiler/test/member_usage/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/member_usage/member_usage_test.dart
+prod:nnbd-off=pkg/compiler/test/member_usage/member_usage_test.dart
+spec:nnbd-sdk=pkg/compiler/test/member_usage/member_usage_test.dart
+prod:nnbd-sdk=pkg/compiler/test/member_usage/member_usage_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/member_usage/data/native.dart b/pkg/compiler/test/member_usage/data/native.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/native.dart
rename to pkg/compiler/test/member_usage/data/native.dart
diff --git a/tests/compiler/dart2js/member_usage/data/static_method_parameters.dart b/pkg/compiler/test/member_usage/data/static_method_parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/static_method_parameters.dart
rename to pkg/compiler/test/member_usage/data/static_method_parameters.dart
diff --git a/tests/compiler/dart2js/member_usage/data/super.dart b/pkg/compiler/test/member_usage/data/super.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/data/super.dart
rename to pkg/compiler/test/member_usage/data/super.dart
diff --git a/tests/compiler/dart2js/member_usage/member_usage_test.dart b/pkg/compiler/test/member_usage/member_usage_test.dart
similarity index 100%
rename from tests/compiler/dart2js/member_usage/member_usage_test.dart
rename to pkg/compiler/test/member_usage/member_usage_test.dart
diff --git a/tests/compiler/dart2js/model/call_structure_namer_test.dart b/pkg/compiler/test/model/call_structure_namer_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/call_structure_namer_test.dart
rename to pkg/compiler/test/model/call_structure_namer_test.dart
diff --git a/tests/compiler/dart2js/model/cfe_annotations_test.dart b/pkg/compiler/test/model/cfe_annotations_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/cfe_annotations_test.dart
rename to pkg/compiler/test/model/cfe_annotations_test.dart
diff --git a/tests/compiler/dart2js/model/cfe_constant_evaluation_test.dart b/pkg/compiler/test/model/cfe_constant_evaluation_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/cfe_constant_evaluation_test.dart
rename to pkg/compiler/test/model/cfe_constant_evaluation_test.dart
diff --git a/tests/compiler/dart2js/model/cfe_constant_swarm_test.dart b/pkg/compiler/test/model/cfe_constant_swarm_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/cfe_constant_swarm_test.dart
rename to pkg/compiler/test/model/cfe_constant_swarm_test.dart
diff --git a/tests/compiler/dart2js/model/cfe_constant_test.dart b/pkg/compiler/test/model/cfe_constant_test.dart
similarity index 97%
rename from tests/compiler/dart2js/model/cfe_constant_test.dart
rename to pkg/compiler/test/model/cfe_constant_test.dart
index ab872b3..160e6491 100644
--- a/tests/compiler/dart2js/model/cfe_constant_test.dart
+++ b/pkg/compiler/test/model/cfe_constant_test.dart
@@ -26,8 +26,7 @@
     Directory dataDir = new Directory.fromUri(Platform.script
         .resolve('../../../../pkg/_fe_analyzer_shared/test/constants/data'));
     await checkTests<String>(dataDir, new ConstantDataComputer(),
-        args: args,
-        testedConfigs: [sharedConfig]);
+        args: args, testedConfigs: [sharedConfig]);
   });
 }
 
diff --git a/tests/compiler/dart2js/model/class_set_test.dart b/pkg/compiler/test/model/class_set_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/class_set_test.dart
rename to pkg/compiler/test/model/class_set_test.dart
diff --git a/tests/compiler/dart2js/model/constant_value_test.dart b/pkg/compiler/test/model/constant_value_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/constant_value_test.dart
rename to pkg/compiler/test/model/constant_value_test.dart
diff --git a/tests/compiler/dart2js/model/enqueuer_test.dart b/pkg/compiler/test/model/enqueuer_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/enqueuer_test.dart
rename to pkg/compiler/test/model/enqueuer_test.dart
diff --git a/tests/compiler/dart2js/model/enumset_test.dart b/pkg/compiler/test/model/enumset_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/enumset_test.dart
rename to pkg/compiler/test/model/enumset_test.dart
diff --git a/tests/compiler/dart2js/model/forwarding_stub_test.dart b/pkg/compiler/test/model/forwarding_stub_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/forwarding_stub_test.dart
rename to pkg/compiler/test/model/forwarding_stub_test.dart
diff --git a/tests/compiler/dart2js/model/future_or_test.dart b/pkg/compiler/test/model/future_or_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/future_or_test.dart
rename to pkg/compiler/test/model/future_or_test.dart
diff --git a/tests/compiler/dart2js/model/in_user_code_test.dart b/pkg/compiler/test/model/in_user_code_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/in_user_code_test.dart
rename to pkg/compiler/test/model/in_user_code_test.dart
diff --git a/tests/compiler/dart2js/model/indentation_test.dart b/pkg/compiler/test/model/indentation_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/indentation_test.dart
rename to pkg/compiler/test/model/indentation_test.dart
diff --git a/tests/compiler/dart2js/model/instantiated_classes_test.dart b/pkg/compiler/test/model/instantiated_classes_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/instantiated_classes_test.dart
rename to pkg/compiler/test/model/instantiated_classes_test.dart
diff --git a/tests/compiler/dart2js/model/link_test.dart b/pkg/compiler/test/model/link_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/link_test.dart
rename to pkg/compiler/test/model/link_test.dart
diff --git a/tests/compiler/dart2js/model/maplet_test.dart b/pkg/compiler/test/model/maplet_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/maplet_test.dart
rename to pkg/compiler/test/model/maplet_test.dart
diff --git a/tests/compiler/dart2js/model/mixin_typevariable_test.dart b/pkg/compiler/test/model/mixin_typevariable_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/mixin_typevariable_test.dart
rename to pkg/compiler/test/model/mixin_typevariable_test.dart
diff --git a/tests/compiler/dart2js/model/native_test.dart b/pkg/compiler/test/model/native_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/native_test.dart
rename to pkg/compiler/test/model/native_test.dart
diff --git a/tests/compiler/dart2js/model/needs_no_such_method_test.dart b/pkg/compiler/test/model/needs_no_such_method_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/needs_no_such_method_test.dart
rename to pkg/compiler/test/model/needs_no_such_method_test.dart
diff --git a/tests/compiler/dart2js/model/no_such_method_enabled_test.dart b/pkg/compiler/test/model/no_such_method_enabled_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/no_such_method_enabled_test.dart
rename to pkg/compiler/test/model/no_such_method_enabled_test.dart
diff --git a/tests/compiler/dart2js/model/no_such_method_forwarders_test.dart b/pkg/compiler/test/model/no_such_method_forwarders_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/no_such_method_forwarders_test.dart
rename to pkg/compiler/test/model/no_such_method_forwarders_test.dart
diff --git a/tests/compiler/dart2js/model/open_world_test.dart b/pkg/compiler/test/model/open_world_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/open_world_test.dart
rename to pkg/compiler/test/model/open_world_test.dart
diff --git a/tests/compiler/dart2js/model/receiver_type_test.dart b/pkg/compiler/test/model/receiver_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/receiver_type_test.dart
rename to pkg/compiler/test/model/receiver_type_test.dart
diff --git a/tests/compiler/dart2js/model/setlet_test.dart b/pkg/compiler/test/model/setlet_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/setlet_test.dart
rename to pkg/compiler/test/model/setlet_test.dart
diff --git a/tests/compiler/dart2js/model/strong_mode_closed_world_test.dart b/pkg/compiler/test/model/strong_mode_closed_world_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/strong_mode_closed_world_test.dart
rename to pkg/compiler/test/model/strong_mode_closed_world_test.dart
diff --git a/tests/compiler/dart2js/model/strong_mode_impact_test.dart b/pkg/compiler/test/model/strong_mode_impact_test.dart
similarity index 94%
rename from tests/compiler/dart2js/model/strong_mode_impact_test.dart
rename to pkg/compiler/test/model/strong_mode_impact_test.dart
index 422f7ea..7eb46a2 100644
--- a/tests/compiler/dart2js/model/strong_mode_impact_test.dart
+++ b/pkg/compiler/test/model/strong_mode_impact_test.dart
@@ -8,6 +8,7 @@
 import 'package:async_helper/async_helper.dart';
 import 'package:compiler/src/common.dart';
 import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/commandline_options.dart';
 import 'package:compiler/src/common_elements.dart';
 import 'package:compiler/src/elements/entities.dart';
 import 'package:compiler/src/elements/types.dart';
@@ -94,20 +95,21 @@
   Map<String, Impact> expectedImpactMap =
       isDart2jsNnbd ? expectedImpactMapNnbdOn : expectedImpactMapNnbdOff;
   retainDataForTesting = true;
-  CompilationResult result =
-      await runCompiler(memorySourceFiles: {'main.dart': source});
+  CompilationResult result = await runCompiler(
+      memorySourceFiles: {'main.dart': source},
+      options: [Flags.printLegacyStars]);
   Expect.isTrue(result.isSuccess);
   Compiler compiler = result.compiler;
   var options = compiler.options;
 
-  String printType(DartType type) {
-    return type.toStructuredText(
-        printLegacyStars: true, useLegacySubtyping: options.useLegacySubtyping);
-  }
-
   KClosedWorld closedWorld = compiler.frontendClosedWorldForTesting;
+  DartTypes types = closedWorld.dartTypes;
   ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
 
+  String printType(DartType type) {
+    return type.toStructuredText(types, options);
+  }
+
   elementEnvironment.forEachLibraryMember(elementEnvironment.mainLibrary,
       (MemberEntity member) {
     if (member == elementEnvironment.mainFunction) return;
diff --git a/tests/compiler/dart2js/model/subtype_test.dart b/pkg/compiler/test/model/subtype_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/subtype_test.dart
rename to pkg/compiler/test/model/subtype_test.dart
diff --git a/tests/compiler/dart2js/model/subtypeset_test.dart b/pkg/compiler/test/model/subtypeset_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/subtypeset_test.dart
rename to pkg/compiler/test/model/subtypeset_test.dart
diff --git a/tests/compiler/dart2js/model/supermixin_test.dart b/pkg/compiler/test/model/supermixin_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/supermixin_test.dart
rename to pkg/compiler/test/model/supermixin_test.dart
diff --git a/tests/compiler/dart2js/model/token_naming_test.dart b/pkg/compiler/test/model/token_naming_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/token_naming_test.dart
rename to pkg/compiler/test/model/token_naming_test.dart
diff --git a/tests/compiler/dart2js/model/type_substitution_test.dart b/pkg/compiler/test/model/type_substitution_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/type_substitution_test.dart
rename to pkg/compiler/test/model/type_substitution_test.dart
diff --git a/tests/compiler/dart2js/model/world_test.dart b/pkg/compiler/test/model/world_test.dart
similarity index 100%
rename from tests/compiler/dart2js/model/world_test.dart
rename to pkg/compiler/test/model/world_test.dart
diff --git a/tests/compiler/dart2js/optimization/data/arithmetic.dart b/pkg/compiler/test/optimization/data/arithmetic.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/arithmetic.dart
rename to pkg/compiler/test/optimization/data/arithmetic.dart
diff --git a/tests/compiler/dart2js/optimization/data/arithmetic_simplification.dart b/pkg/compiler/test/optimization/data/arithmetic_simplification.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/arithmetic_simplification.dart
rename to pkg/compiler/test/optimization/data/arithmetic_simplification.dart
diff --git a/tests/compiler/dart2js/optimization/data/bit.dart b/pkg/compiler/test/optimization/data/bit.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/bit.dart
rename to pkg/compiler/test/optimization/data/bit.dart
diff --git a/tests/compiler/dart2js/optimization/data/effectively_constant_fields.dart b/pkg/compiler/test/optimization/data/effectively_constant_fields.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/effectively_constant_fields.dart
rename to pkg/compiler/test/optimization/data/effectively_constant_fields.dart
diff --git a/tests/compiler/dart2js/optimization/data/field_get.dart b/pkg/compiler/test/optimization/data/field_get.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/field_get.dart
rename to pkg/compiler/test/optimization/data/field_get.dart
diff --git a/tests/compiler/dart2js/optimization/data/field_set.dart b/pkg/compiler/test/optimization/data/field_set.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/field_set.dart
rename to pkg/compiler/test/optimization/data/field_set.dart
diff --git a/tests/compiler/dart2js/optimization/data/finalized_type_variable.dart b/pkg/compiler/test/optimization/data/finalized_type_variable.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/finalized_type_variable.dart
rename to pkg/compiler/test/optimization/data/finalized_type_variable.dart
diff --git a/tests/compiler/dart2js/optimization/data/index.dart b/pkg/compiler/test/optimization/data/index.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/index.dart
rename to pkg/compiler/test/optimization/data/index.dart
diff --git a/tests/compiler/dart2js/optimization/data/index_assign.dart b/pkg/compiler/test/optimization/data/index_assign.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/index_assign.dart
rename to pkg/compiler/test/optimization/data/index_assign.dart
diff --git a/pkg/compiler/test/optimization/data/marker.options b/pkg/compiler/test/optimization/data/marker.options
new file mode 100644
index 0000000..09d70c1
--- /dev/null
+++ b/pkg/compiler/test/optimization/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/optimization/optimization_test.dart
+prod:nnbd-off=pkg/compiler/test/optimization/optimization_test.dart
+spec:nnbd-sdk=pkg/compiler/test/optimization/optimization_test.dart
+prod:nnbd-sdk=pkg/compiler/test/optimization/optimization_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/optimization/data/modulo_remainder.dart b/pkg/compiler/test/optimization/data/modulo_remainder.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/data/modulo_remainder.dart
rename to pkg/compiler/test/optimization/data/modulo_remainder.dart
diff --git a/tests/compiler/dart2js/optimization/optimization_test.dart b/pkg/compiler/test/optimization/optimization_test.dart
similarity index 100%
rename from tests/compiler/dart2js/optimization/optimization_test.dart
rename to pkg/compiler/test/optimization/optimization_test.dart
diff --git a/tests/compiler/dart2js/rti/backend_type_helper_test.dart b/pkg/compiler/test/rti/backend_type_helper_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/backend_type_helper_test.dart
rename to pkg/compiler/test/rti/backend_type_helper_test.dart
diff --git a/tests/compiler/dart2js/rti/bound_check_test.dart b/pkg/compiler/test/rti/bound_check_test.dart
similarity index 89%
rename from tests/compiler/dart2js/rti/bound_check_test.dart
rename to pkg/compiler/test/rti/bound_check_test.dart
index ce5f817..63fb2ee 100644
--- a/tests/compiler/dart2js/rti/bound_check_test.dart
+++ b/pkg/compiler/test/rti/bound_check_test.dart
@@ -6,6 +6,7 @@
 
 import 'package:async_helper/async_helper.dart';
 import '../helpers/d8_helper.dart';
+import '../helpers/memory_compiler.dart';
 
 const String SOURCE1 = r'''
 import 'package:expect/expect.dart';
@@ -51,6 +52,7 @@
     await runWithD8(
         memorySourceFiles: {'main.dart': SOURCE1},
         expectedOutput: OUTPUT1,
-        printJs: args.contains('-v'));
+        printJs: args.contains('-v'),
+        options: ['--libraries-spec=$sdkLibrariesSpecificationUri']);
   });
 }
diff --git a/tests/compiler/dart2js/rti/data/as.dart b/pkg/compiler/test/rti/data/as.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/as.dart
rename to pkg/compiler/test/rti/data/as.dart
diff --git a/tests/compiler/dart2js/rti/data/async_foreach.dart b/pkg/compiler/test/rti/data/async_foreach.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/async_foreach.dart
rename to pkg/compiler/test/rti/data/async_foreach.dart
diff --git a/tests/compiler/dart2js/rti/data/async_foreach_nonasync.dart b/pkg/compiler/test/rti/data/async_foreach_nonasync.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/async_foreach_nonasync.dart
rename to pkg/compiler/test/rti/data/async_foreach_nonasync.dart
diff --git a/tests/compiler/dart2js/rti/data/async_local.dart b/pkg/compiler/test/rti/data/async_local.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/async_local.dart
rename to pkg/compiler/test/rti/data/async_local.dart
diff --git a/tests/compiler/dart2js/rti/data/async_local_nonasync.dart b/pkg/compiler/test/rti/data/async_local_nonasync.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/async_local_nonasync.dart
rename to pkg/compiler/test/rti/data/async_local_nonasync.dart
diff --git a/tests/compiler/dart2js/rti/data/async_local_typed.dart b/pkg/compiler/test/rti/data/async_local_typed.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/async_local_typed.dart
rename to pkg/compiler/test/rti/data/async_local_typed.dart
diff --git a/tests/compiler/dart2js/rti/data/call_typed.dart b/pkg/compiler/test/rti/data/call_typed.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/call_typed.dart
rename to pkg/compiler/test/rti/data/call_typed.dart
diff --git a/tests/compiler/dart2js/rti/data/call_typed_generic.dart b/pkg/compiler/test/rti/data/call_typed_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/call_typed_generic.dart
rename to pkg/compiler/test/rti/data/call_typed_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/closure.dart b/pkg/compiler/test/rti/data/closure.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/closure.dart
rename to pkg/compiler/test/rti/data/closure.dart
diff --git a/tests/compiler/dart2js/rti/data/closure_generic_unneeded.dart b/pkg/compiler/test/rti/data/closure_generic_unneeded.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/closure_generic_unneeded.dart
rename to pkg/compiler/test/rti/data/closure_generic_unneeded.dart
diff --git a/tests/compiler/dart2js/rti/data/closure_unneeded.dart b/pkg/compiler/test/rti/data/closure_unneeded.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/closure_unneeded.dart
rename to pkg/compiler/test/rti/data/closure_unneeded.dart
diff --git a/tests/compiler/dart2js/rti/data/dependency.dart b/pkg/compiler/test/rti/data/dependency.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dependency.dart
rename to pkg/compiler/test/rti/data/dependency.dart
diff --git a/tests/compiler/dart2js/rti/data/direct.dart b/pkg/compiler/test/rti/data/direct.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/direct.dart
rename to pkg/compiler/test/rti/data/direct.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_is.dart b/pkg/compiler/test/rti/data/dynamic_is.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_is.dart
rename to pkg/compiler/test/rti/data/dynamic_is.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_is2.dart b/pkg/compiler/test/rti/data/dynamic_is2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_is2.dart
rename to pkg/compiler/test/rti/data/dynamic_is2.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_is_closure.dart b/pkg/compiler/test/rti/data/dynamic_is_closure.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_is_closure.dart
rename to pkg/compiler/test/rti/data/dynamic_is_closure.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_is_closure2.dart b/pkg/compiler/test/rti/data/dynamic_is_closure2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_is_closure2.dart
rename to pkg/compiler/test/rti/data/dynamic_is_closure2.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not.dart b/pkg/compiler/test/rti/data/dynamic_not.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_not.dart
rename to pkg/compiler/test/rti/data/dynamic_not.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not2.dart b/pkg/compiler/test/rti/data/dynamic_not2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_not2.dart
rename to pkg/compiler/test/rti/data/dynamic_not2.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not_closure.dart b/pkg/compiler/test/rti/data/dynamic_not_closure.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_not_closure.dart
rename to pkg/compiler/test/rti/data/dynamic_not_closure.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_not_closure2.dart b/pkg/compiler/test/rti/data/dynamic_not_closure2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_not_closure2.dart
rename to pkg/compiler/test/rti/data/dynamic_not_closure2.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_tear_off.dart b/pkg/compiler/test/rti/data/dynamic_tear_off.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_tear_off.dart
rename to pkg/compiler/test/rti/data/dynamic_tear_off.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_tear_off2.dart b/pkg/compiler/test/rti/data/dynamic_tear_off2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_tear_off2.dart
rename to pkg/compiler/test/rti/data/dynamic_tear_off2.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_tear_off3.dart b/pkg/compiler/test/rti/data/dynamic_tear_off3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_tear_off3.dart
rename to pkg/compiler/test/rti/data/dynamic_tear_off3.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_tear_off4.dart b/pkg/compiler/test/rti/data/dynamic_tear_off4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_tear_off4.dart
rename to pkg/compiler/test/rti/data/dynamic_tear_off4.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_type_literal.dart b/pkg/compiler/test/rti/data/dynamic_type_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_type_literal.dart
rename to pkg/compiler/test/rti/data/dynamic_type_literal.dart
diff --git a/tests/compiler/dart2js/rti/data/dynamic_type_literal2.dart b/pkg/compiler/test/rti/data/dynamic_type_literal2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/dynamic_type_literal2.dart
rename to pkg/compiler/test/rti/data/dynamic_type_literal2.dart
diff --git a/tests/compiler/dart2js/rti/data/explicit_as.dart b/pkg/compiler/test/rti/data/explicit_as.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/explicit_as.dart
rename to pkg/compiler/test/rti/data/explicit_as.dart
diff --git a/tests/compiler/dart2js/rti/data/function_subtype_local5.dart b/pkg/compiler/test/rti/data/function_subtype_local5.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/function_subtype_local5.dart
rename to pkg/compiler/test/rti/data/function_subtype_local5.dart
diff --git a/tests/compiler/dart2js/rti/data/future_or.dart b/pkg/compiler/test/rti/data/future_or.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/future_or.dart
rename to pkg/compiler/test/rti/data/future_or.dart
diff --git a/tests/compiler/dart2js/rti/data/future_or_future_or.dart b/pkg/compiler/test/rti/data/future_or_future_or.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/future_or_future_or.dart
rename to pkg/compiler/test/rti/data/future_or_future_or.dart
diff --git a/tests/compiler/dart2js/rti/data/future_or_future_or_generic.dart b/pkg/compiler/test/rti/data/future_or_future_or_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/future_or_future_or_generic.dart
rename to pkg/compiler/test/rti/data/future_or_future_or_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/future_or_generic.dart b/pkg/compiler/test/rti/data/future_or_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/future_or_generic.dart
rename to pkg/compiler/test/rti/data/future_or_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/future_or_generic2.dart b/pkg/compiler/test/rti/data/future_or_generic2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/future_or_generic2.dart
rename to pkg/compiler/test/rti/data/future_or_generic2.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_bounds.dart b/pkg/compiler/test/rti/data/generic_bounds.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_bounds.dart
rename to pkg/compiler/test/rti/data/generic_bounds.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_class_instantiate.dart b/pkg/compiler/test/rti/data/generic_class_instantiate.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_class_instantiate.dart
rename to pkg/compiler/test/rti/data/generic_class_instantiate.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_class_is.dart b/pkg/compiler/test/rti/data/generic_class_is.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_class_is.dart
rename to pkg/compiler/test/rti/data/generic_class_is.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_class_is2.dart b/pkg/compiler/test/rti/data/generic_class_is2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_class_is2.dart
rename to pkg/compiler/test/rti/data/generic_class_is2.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_closure_instantiate.dart b/pkg/compiler/test/rti/data/generic_closure_instantiate.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_closure_instantiate.dart
rename to pkg/compiler/test/rti/data/generic_closure_instantiate.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_creation.dart b/pkg/compiler/test/rti/data/generic_creation.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_creation.dart
rename to pkg/compiler/test/rti/data/generic_creation.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_instanceof4.dart b/pkg/compiler/test/rti/data/generic_instanceof4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_instanceof4.dart
rename to pkg/compiler/test/rti/data/generic_instanceof4.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_instanceof4_unused.dart b/pkg/compiler/test/rti/data/generic_instanceof4_unused.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_instanceof4_unused.dart
rename to pkg/compiler/test/rti/data/generic_instanceof4_unused.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method1.dart b/pkg/compiler/test/rti/data/generic_method1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method1.dart
rename to pkg/compiler/test/rti/data/generic_method1.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method2.dart b/pkg/compiler/test/rti/data/generic_method2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method2.dart
rename to pkg/compiler/test/rti/data/generic_method2.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method3.dart b/pkg/compiler/test/rti/data/generic_method3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method3.dart
rename to pkg/compiler/test/rti/data/generic_method3.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method4.dart b/pkg/compiler/test/rti/data/generic_method4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method4.dart
rename to pkg/compiler/test/rti/data/generic_method4.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart b/pkg/compiler/test/rti/data/generic_method_instantiate.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
rename to pkg/compiler/test/rti/data/generic_method_instantiate.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method_is.dart b/pkg/compiler/test/rti/data/generic_method_is.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method_is.dart
rename to pkg/compiler/test/rti/data/generic_method_is.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method_is2.dart b/pkg/compiler/test/rti/data/generic_method_is2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method_is2.dart
rename to pkg/compiler/test/rti/data/generic_method_is2.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_method_tearoff.dart b/pkg/compiler/test/rti/data/generic_method_tearoff.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_method_tearoff.dart
rename to pkg/compiler/test/rti/data/generic_method_tearoff.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05.dart b/pkg/compiler/test/rti/data/generic_methods_dynamic_05.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_methods_dynamic_05.dart
rename to pkg/compiler/test/rti/data/generic_methods_dynamic_05.dart
diff --git a/tests/compiler/dart2js/rti/data/generic_methods_dynamic_05a.dart b/pkg/compiler/test/rti/data/generic_methods_dynamic_05a.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/generic_methods_dynamic_05a.dart
rename to pkg/compiler/test/rti/data/generic_methods_dynamic_05a.dart
diff --git a/tests/compiler/dart2js/rti/data/implicit_as.dart b/pkg/compiler/test/rti/data/implicit_as.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/implicit_as.dart
rename to pkg/compiler/test/rti/data/implicit_as.dart
diff --git a/tests/compiler/dart2js/rti/data/indirect_through_static.dart b/pkg/compiler/test/rti/data/indirect_through_static.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/indirect_through_static.dart
rename to pkg/compiler/test/rti/data/indirect_through_static.dart
diff --git a/tests/compiler/dart2js/rti/data/indirect_type_literal.dart b/pkg/compiler/test/rti/data/indirect_type_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/indirect_type_literal.dart
rename to pkg/compiler/test/rti/data/indirect_type_literal.dart
diff --git a/tests/compiler/dart2js/rti/data/instantiation1.dart b/pkg/compiler/test/rti/data/instantiation1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/instantiation1.dart
rename to pkg/compiler/test/rti/data/instantiation1.dart
diff --git a/tests/compiler/dart2js/rti/data/instantiation2.dart b/pkg/compiler/test/rti/data/instantiation2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/instantiation2.dart
rename to pkg/compiler/test/rti/data/instantiation2.dart
diff --git a/tests/compiler/dart2js/rti/data/instantiation3.dart b/pkg/compiler/test/rti/data/instantiation3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/instantiation3.dart
rename to pkg/compiler/test/rti/data/instantiation3.dart
diff --git a/tests/compiler/dart2js/rti/data/instantiation4.dart b/pkg/compiler/test/rti/data/instantiation4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/instantiation4.dart
rename to pkg/compiler/test/rti/data/instantiation4.dart
diff --git a/tests/compiler/dart2js/rti/data/instantiation5.dart b/pkg/compiler/test/rti/data/instantiation5.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/instantiation5.dart
rename to pkg/compiler/test/rti/data/instantiation5.dart
diff --git a/tests/compiler/dart2js/rti/data/instantiation6.dart b/pkg/compiler/test/rti/data/instantiation6.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/instantiation6.dart
rename to pkg/compiler/test/rti/data/instantiation6.dart
diff --git a/tests/compiler/dart2js/rti/data/instantiation7.dart b/pkg/compiler/test/rti/data/instantiation7.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/instantiation7.dart
rename to pkg/compiler/test/rti/data/instantiation7.dart
diff --git a/tests/compiler/dart2js/rti/data/is_type_variable.dart b/pkg/compiler/test/rti/data/is_type_variable.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/is_type_variable.dart
rename to pkg/compiler/test/rti/data/is_type_variable.dart
diff --git a/tests/compiler/dart2js/rti/data/is_type_variable_super.dart b/pkg/compiler/test/rti/data/is_type_variable_super.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/is_type_variable_super.dart
rename to pkg/compiler/test/rti/data/is_type_variable_super.dart
diff --git a/tests/compiler/dart2js/rti/data/is_type_variable_super_complex.dart b/pkg/compiler/test/rti/data/is_type_variable_super_complex.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/is_type_variable_super_complex.dart
rename to pkg/compiler/test/rti/data/is_type_variable_super_complex.dart
diff --git a/tests/compiler/dart2js/rti/data/list_literal.dart b/pkg/compiler/test/rti/data/list_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/list_literal.dart
rename to pkg/compiler/test/rti/data/list_literal.dart
diff --git a/tests/compiler/dart2js/rti/data/list_to_set.dart b/pkg/compiler/test/rti/data/list_to_set.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/list_to_set.dart
rename to pkg/compiler/test/rti/data/list_to_set.dart
diff --git a/tests/compiler/dart2js/rti/data/local_function_generic.dart b/pkg/compiler/test/rti/data/local_function_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/local_function_generic.dart
rename to pkg/compiler/test/rti/data/local_function_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/local_function_list_literal.dart b/pkg/compiler/test/rti/data/local_function_list_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/local_function_list_literal.dart
rename to pkg/compiler/test/rti/data/local_function_list_literal.dart
diff --git a/tests/compiler/dart2js/rti/data/local_function_map_literal.dart b/pkg/compiler/test/rti/data/local_function_map_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/local_function_map_literal.dart
rename to pkg/compiler/test/rti/data/local_function_map_literal.dart
diff --git a/tests/compiler/dart2js/rti/data/local_function_signature2.dart b/pkg/compiler/test/rti/data/local_function_signature2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/local_function_signature2.dart
rename to pkg/compiler/test/rti/data/local_function_signature2.dart
diff --git a/tests/compiler/dart2js/rti/data/local_function_signatures.dart b/pkg/compiler/test/rti/data/local_function_signatures.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/local_function_signatures.dart
rename to pkg/compiler/test/rti/data/local_function_signatures.dart
diff --git a/tests/compiler/dart2js/rti/data/local_function_signatures_generic.dart b/pkg/compiler/test/rti/data/local_function_signatures_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/local_function_signatures_generic.dart
rename to pkg/compiler/test/rti/data/local_function_signatures_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/map_literal.dart b/pkg/compiler/test/rti/data/map_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/map_literal.dart
rename to pkg/compiler/test/rti/data/map_literal.dart
diff --git a/tests/compiler/dart2js/rti/data/map_to_set.dart b/pkg/compiler/test/rti/data/map_to_set.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/map_to_set.dart
rename to pkg/compiler/test/rti/data/map_to_set.dart
diff --git a/pkg/compiler/test/rti/data/marker.options b/pkg/compiler/test/rti/data/marker.options
new file mode 100644
index 0000000..f903be0
--- /dev/null
+++ b/pkg/compiler/test/rti/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/rti/rti_need_test_helper.dart
+prod:nnbd-off=pkg/compiler/test/rti/rti_need_test_helper.dart
+spec:nnbd-sdk=pkg/compiler/test/rti/rti_need_test_helper.dart
+prod:nnbd-sdk=pkg/compiler/test/rti/rti_need_test_helper.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/rti/data/method_signatures.dart b/pkg/compiler/test/rti/data/method_signatures.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/method_signatures.dart
rename to pkg/compiler/test/rti/data/method_signatures.dart
diff --git a/tests/compiler/dart2js/rti/data/method_signatures_generic.dart b/pkg/compiler/test/rti/data/method_signatures_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/method_signatures_generic.dart
rename to pkg/compiler/test/rti/data/method_signatures_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/no_such_method1.dart b/pkg/compiler/test/rti/data/no_such_method1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/no_such_method1.dart
rename to pkg/compiler/test/rti/data/no_such_method1.dart
diff --git a/tests/compiler/dart2js/rti/data/no_such_method2.dart b/pkg/compiler/test/rti/data/no_such_method2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/no_such_method2.dart
rename to pkg/compiler/test/rti/data/no_such_method2.dart
diff --git a/tests/compiler/dart2js/rti/data/no_such_method3.dart b/pkg/compiler/test/rti/data/no_such_method3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/no_such_method3.dart
rename to pkg/compiler/test/rti/data/no_such_method3.dart
diff --git a/tests/compiler/dart2js/rti/data/pragma_directives_instance.dart b/pkg/compiler/test/rti/data/pragma_directives_instance.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/pragma_directives_instance.dart
rename to pkg/compiler/test/rti/data/pragma_directives_instance.dart
diff --git a/tests/compiler/dart2js/rti/data/pragma_directives_static.dart b/pkg/compiler/test/rti/data/pragma_directives_static.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/pragma_directives_static.dart
rename to pkg/compiler/test/rti/data/pragma_directives_static.dart
diff --git a/tests/compiler/dart2js/rti/data/private_dynamic.dart b/pkg/compiler/test/rti/data/private_dynamic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/private_dynamic.dart
rename to pkg/compiler/test/rti/data/private_dynamic.dart
diff --git a/tests/compiler/dart2js/rti/data/private_dynamic2.dart b/pkg/compiler/test/rti/data/private_dynamic2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/private_dynamic2.dart
rename to pkg/compiler/test/rti/data/private_dynamic2.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals1.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals1.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals1.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals2.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals2.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals2.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals3.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals3.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals3.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals4.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals4.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals4.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals5.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals5.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals5.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals5.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals6.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals6.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals6.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals6.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals7.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals7.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals7.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals7.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_equals8.dart b/pkg/compiler/test/rti/data/runtime_type_closure_equals8.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_equals8.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_equals8.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_to_string1.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_to_string1.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_to_string1.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_to_string2.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_to_string2.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_to_string2.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_to_string3.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_to_string3.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_to_string3.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_to_string4.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_to_string4.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_to_string4.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_to_string5.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string5.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_to_string5.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_to_string5.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_closure_to_string6.dart b/pkg/compiler/test/rti/data/runtime_type_closure_to_string6.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_closure_to_string6.dart
rename to pkg/compiler/test/rti/data/runtime_type_closure_to_string6.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_equals1.dart b/pkg/compiler/test/rti/data/runtime_type_equals1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_equals1.dart
rename to pkg/compiler/test/rti/data/runtime_type_equals1.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_equals2.dart b/pkg/compiler/test/rti/data/runtime_type_equals2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_equals2.dart
rename to pkg/compiler/test/rti/data/runtime_type_equals2.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_equals3.dart b/pkg/compiler/test/rti/data/runtime_type_equals3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_equals3.dart
rename to pkg/compiler/test/rti/data/runtime_type_equals3.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_equals4.dart b/pkg/compiler/test/rti/data/runtime_type_equals4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_equals4.dart
rename to pkg/compiler/test/rti/data/runtime_type_equals4.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_equals5.dart b/pkg/compiler/test/rti/data/runtime_type_equals5.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_equals5.dart
rename to pkg/compiler/test/rti/data/runtime_type_equals5.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_equals6.dart b/pkg/compiler/test/rti/data/runtime_type_equals6.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_equals6.dart
rename to pkg/compiler/test/rti/data/runtime_type_equals6.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_equals7.dart b/pkg/compiler/test/rti/data/runtime_type_equals7.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_equals7.dart
rename to pkg/compiler/test/rti/data/runtime_type_equals7.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_instantiate_to_string1.dart b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_instantiate_to_string1.dart
rename to pkg/compiler/test/rti/data/runtime_type_instantiate_to_string1.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_instantiate_to_string2.dart b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_instantiate_to_string2.dart
rename to pkg/compiler/test/rti/data/runtime_type_instantiate_to_string2.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_instantiate_to_string3.dart b/pkg/compiler/test/rti/data/runtime_type_instantiate_to_string3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_instantiate_to_string3.dart
rename to pkg/compiler/test/rti/data/runtime_type_instantiate_to_string3.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_to_string1.dart b/pkg/compiler/test/rti/data/runtime_type_to_string1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_to_string1.dart
rename to pkg/compiler/test/rti/data/runtime_type_to_string1.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_to_string2.dart b/pkg/compiler/test/rti/data/runtime_type_to_string2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_to_string2.dart
rename to pkg/compiler/test/rti/data/runtime_type_to_string2.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_to_string3.dart b/pkg/compiler/test/rti/data/runtime_type_to_string3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_to_string3.dart
rename to pkg/compiler/test/rti/data/runtime_type_to_string3.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_to_string4.dart b/pkg/compiler/test/rti/data/runtime_type_to_string4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_to_string4.dart
rename to pkg/compiler/test/rti/data/runtime_type_to_string4.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_to_string5.dart b/pkg/compiler/test/rti/data/runtime_type_to_string5.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_to_string5.dart
rename to pkg/compiler/test/rti/data/runtime_type_to_string5.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_to_string6.dart b/pkg/compiler/test/rti/data/runtime_type_to_string6.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_to_string6.dart
rename to pkg/compiler/test/rti/data/runtime_type_to_string6.dart
diff --git a/tests/compiler/dart2js/rti/data/runtime_type_to_string7.dart b/pkg/compiler/test/rti/data/runtime_type_to_string7.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/runtime_type_to_string7.dart
rename to pkg/compiler/test/rti/data/runtime_type_to_string7.dart
diff --git a/tests/compiler/dart2js/rti/data/subclass.dart b/pkg/compiler/test/rti/data/subclass.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/subclass.dart
rename to pkg/compiler/test/rti/data/subclass.dart
diff --git a/tests/compiler/dart2js/rti/data/subclass_fixed.dart b/pkg/compiler/test/rti/data/subclass_fixed.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/subclass_fixed.dart
rename to pkg/compiler/test/rti/data/subclass_fixed.dart
diff --git a/tests/compiler/dart2js/rti/data/subtype_named_args.dart b/pkg/compiler/test/rti/data/subtype_named_args.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/subtype_named_args.dart
rename to pkg/compiler/test/rti/data/subtype_named_args.dart
diff --git a/tests/compiler/dart2js/rti/data/subtype_named_args1.dart b/pkg/compiler/test/rti/data/subtype_named_args1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/subtype_named_args1.dart
rename to pkg/compiler/test/rti/data/subtype_named_args1.dart
diff --git a/tests/compiler/dart2js/rti/data/superclass.dart b/pkg/compiler/test/rti/data/superclass.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/superclass.dart
rename to pkg/compiler/test/rti/data/superclass.dart
diff --git a/tests/compiler/dart2js/rti/data/tear_off.dart b/pkg/compiler/test/rti/data/tear_off.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/tear_off.dart
rename to pkg/compiler/test/rti/data/tear_off.dart
diff --git a/tests/compiler/dart2js/rti/data/tear_off_generic.dart b/pkg/compiler/test/rti/data/tear_off_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/tear_off_generic.dart
rename to pkg/compiler/test/rti/data/tear_off_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/type_argument_substitution.dart b/pkg/compiler/test/rti/data/type_argument_substitution.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/type_argument_substitution.dart
rename to pkg/compiler/test/rti/data/type_argument_substitution.dart
diff --git a/tests/compiler/dart2js/rti/data/type_literal.dart b/pkg/compiler/test/rti/data/type_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/type_literal.dart
rename to pkg/compiler/test/rti/data/type_literal.dart
diff --git a/tests/compiler/dart2js/rti/data/type_literal2.dart b/pkg/compiler/test/rti/data/type_literal2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/type_literal2.dart
rename to pkg/compiler/test/rti/data/type_literal2.dart
diff --git a/tests/compiler/dart2js/rti/data/type_literal_generic.dart b/pkg/compiler/test/rti/data/type_literal_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/type_literal_generic.dart
rename to pkg/compiler/test/rti/data/type_literal_generic.dart
diff --git a/tests/compiler/dart2js/rti/data/type_variable_function_type.dart b/pkg/compiler/test/rti/data/type_variable_function_type.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/data/type_variable_function_type.dart
rename to pkg/compiler/test/rti/data/type_variable_function_type.dart
diff --git a/tests/compiler/dart2js/rti/disable_rti_test.dart b/pkg/compiler/test/rti/disable_rti_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/disable_rti_test.dart
rename to pkg/compiler/test/rti/disable_rti_test.dart
diff --git a/tests/compiler/dart2js/rti/emission/arguments.dart b/pkg/compiler/test/rti/emission/arguments.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/arguments.dart
rename to pkg/compiler/test/rti/emission/arguments.dart
diff --git a/tests/compiler/dart2js/rti/emission/call.dart b/pkg/compiler/test/rti/emission/call.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/call.dart
rename to pkg/compiler/test/rti/emission/call.dart
diff --git a/tests/compiler/dart2js/rti/emission/call_typed.dart b/pkg/compiler/test/rti/emission/call_typed.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/call_typed.dart
rename to pkg/compiler/test/rti/emission/call_typed.dart
diff --git a/tests/compiler/dart2js/rti/emission/call_typed_generic.dart b/pkg/compiler/test/rti/emission/call_typed_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/call_typed_generic.dart
rename to pkg/compiler/test/rti/emission/call_typed_generic.dart
diff --git a/tests/compiler/dart2js/rti/emission/closure_function.dart b/pkg/compiler/test/rti/emission/closure_function.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/closure_function.dart
rename to pkg/compiler/test/rti/emission/closure_function.dart
diff --git a/tests/compiler/dart2js/rti/emission/closure_function_type.dart b/pkg/compiler/test/rti/emission/closure_function_type.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/closure_function_type.dart
rename to pkg/compiler/test/rti/emission/closure_function_type.dart
diff --git a/tests/compiler/dart2js/rti/emission/closure_signature.dart b/pkg/compiler/test/rti/emission/closure_signature.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/closure_signature.dart
rename to pkg/compiler/test/rti/emission/closure_signature.dart
diff --git a/tests/compiler/dart2js/rti/emission/closure_signature_unneeded.dart b/pkg/compiler/test/rti/emission/closure_signature_unneeded.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/closure_signature_unneeded.dart
rename to pkg/compiler/test/rti/emission/closure_signature_unneeded.dart
diff --git a/tests/compiler/dart2js/rti/emission/constructor_argument_static.dart b/pkg/compiler/test/rti/emission/constructor_argument_static.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/constructor_argument_static.dart
rename to pkg/compiler/test/rti/emission/constructor_argument_static.dart
diff --git a/tests/compiler/dart2js/rti/emission/dynamic_instance.dart b/pkg/compiler/test/rti/emission/dynamic_instance.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/dynamic_instance.dart
rename to pkg/compiler/test/rti/emission/dynamic_instance.dart
diff --git a/tests/compiler/dart2js/rti/emission/dynamic_type_argument.dart b/pkg/compiler/test/rti/emission/dynamic_type_argument.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/dynamic_type_argument.dart
rename to pkg/compiler/test/rti/emission/dynamic_type_argument.dart
diff --git a/tests/compiler/dart2js/rti/emission/dynamic_type_literal.dart b/pkg/compiler/test/rti/emission/dynamic_type_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/dynamic_type_literal.dart
rename to pkg/compiler/test/rti/emission/dynamic_type_literal.dart
diff --git a/tests/compiler/dart2js/rti/emission/event_callback.dart b/pkg/compiler/test/rti/emission/event_callback.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/event_callback.dart
rename to pkg/compiler/test/rti/emission/event_callback.dart
diff --git a/tests/compiler/dart2js/rti/emission/fixed_type_argument.dart b/pkg/compiler/test/rti/emission/fixed_type_argument.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/fixed_type_argument.dart
rename to pkg/compiler/test/rti/emission/fixed_type_argument.dart
diff --git a/tests/compiler/dart2js/rti/emission/fixed_type_argument_implements.dart b/pkg/compiler/test/rti/emission/fixed_type_argument_implements.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/fixed_type_argument_implements.dart
rename to pkg/compiler/test/rti/emission/fixed_type_argument_implements.dart
diff --git a/tests/compiler/dart2js/rti/emission/function_type_argument.dart b/pkg/compiler/test/rti/emission/function_type_argument.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/function_type_argument.dart
rename to pkg/compiler/test/rti/emission/function_type_argument.dart
diff --git a/tests/compiler/dart2js/rti/emission/function_typed_arguments.dart b/pkg/compiler/test/rti/emission/function_typed_arguments.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/function_typed_arguments.dart
rename to pkg/compiler/test/rti/emission/function_typed_arguments.dart
diff --git a/tests/compiler/dart2js/rti/emission/future_or.dart b/pkg/compiler/test/rti/emission/future_or.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/future_or.dart
rename to pkg/compiler/test/rti/emission/future_or.dart
diff --git a/tests/compiler/dart2js/rti/emission/future_or_as_type_argument.dart b/pkg/compiler/test/rti/emission/future_or_as_type_argument.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/future_or_as_type_argument.dart
rename to pkg/compiler/test/rti/emission/future_or_as_type_argument.dart
diff --git a/tests/compiler/dart2js/rti/emission/future_or_future_or.dart b/pkg/compiler/test/rti/emission/future_or_future_or.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/future_or_future_or.dart
rename to pkg/compiler/test/rti/emission/future_or_future_or.dart
diff --git a/tests/compiler/dart2js/rti/emission/future_or_future_or_generic.dart b/pkg/compiler/test/rti/emission/future_or_future_or_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/future_or_future_or_generic.dart
rename to pkg/compiler/test/rti/emission/future_or_future_or_generic.dart
diff --git a/tests/compiler/dart2js/rti/emission/future_or_generic.dart b/pkg/compiler/test/rti/emission/future_or_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/future_or_generic.dart
rename to pkg/compiler/test/rti/emission/future_or_generic.dart
diff --git a/tests/compiler/dart2js/rti/emission/future_or_generic2.dart b/pkg/compiler/test/rti/emission/future_or_generic2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/future_or_generic2.dart
rename to pkg/compiler/test/rti/emission/future_or_generic2.dart
diff --git a/tests/compiler/dart2js/rti/emission/future_or_type_argument.dart b/pkg/compiler/test/rti/emission/future_or_type_argument.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/future_or_type_argument.dart
rename to pkg/compiler/test/rti/emission/future_or_type_argument.dart
diff --git a/tests/compiler/dart2js/rti/emission/generic_instanceof4.dart b/pkg/compiler/test/rti/emission/generic_instanceof4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/generic_instanceof4.dart
rename to pkg/compiler/test/rti/emission/generic_instanceof4.dart
diff --git a/tests/compiler/dart2js/rti/emission/generic_methods_dynamic_02.dart b/pkg/compiler/test/rti/emission/generic_methods_dynamic_02.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/generic_methods_dynamic_02.dart
rename to pkg/compiler/test/rti/emission/generic_methods_dynamic_02.dart
diff --git a/tests/compiler/dart2js/rti/emission/indirect_through_static.dart b/pkg/compiler/test/rti/emission/indirect_through_static.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/indirect_through_static.dart
rename to pkg/compiler/test/rti/emission/indirect_through_static.dart
diff --git a/tests/compiler/dart2js/rti/emission/inherited_is.dart b/pkg/compiler/test/rti/emission/inherited_is.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/inherited_is.dart
rename to pkg/compiler/test/rti/emission/inherited_is.dart
diff --git a/tests/compiler/dart2js/rti/emission/inherited_is2.dart b/pkg/compiler/test/rti/emission/inherited_is2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/inherited_is2.dart
rename to pkg/compiler/test/rti/emission/inherited_is2.dart
diff --git a/tests/compiler/dart2js/rti/emission/jsinterop.dart b/pkg/compiler/test/rti/emission/jsinterop.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/jsinterop.dart
rename to pkg/compiler/test/rti/emission/jsinterop.dart
diff --git a/tests/compiler/dart2js/rti/emission/jsinterop_generic.dart b/pkg/compiler/test/rti/emission/jsinterop_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/jsinterop_generic.dart
rename to pkg/compiler/test/rti/emission/jsinterop_generic.dart
diff --git a/tests/compiler/dart2js/rti/emission/jsinterop_generic_factory_args.dart b/pkg/compiler/test/rti/emission/jsinterop_generic_factory_args.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/jsinterop_generic_factory_args.dart
rename to pkg/compiler/test/rti/emission/jsinterop_generic_factory_args.dart
diff --git a/tests/compiler/dart2js/rti/emission/list.dart b/pkg/compiler/test/rti/emission/list.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/list.dart
rename to pkg/compiler/test/rti/emission/list.dart
diff --git a/tests/compiler/dart2js/rti/emission/local_function_list_literal.dart b/pkg/compiler/test/rti/emission/local_function_list_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/local_function_list_literal.dart
rename to pkg/compiler/test/rti/emission/local_function_list_literal.dart
diff --git a/tests/compiler/dart2js/rti/emission/local_function_map_literal.dart b/pkg/compiler/test/rti/emission/local_function_map_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/local_function_map_literal.dart
rename to pkg/compiler/test/rti/emission/local_function_map_literal.dart
diff --git a/tests/compiler/dart2js/rti/emission/map_literal.dart b/pkg/compiler/test/rti/emission/map_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/map_literal.dart
rename to pkg/compiler/test/rti/emission/map_literal.dart
diff --git a/pkg/compiler/test/rti/emission/marker.options b/pkg/compiler/test/rti/emission/marker.options
new file mode 100644
index 0000000..bf1a85d
--- /dev/null
+++ b/pkg/compiler/test/rti/emission/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/rti/rti_emission_test.dart
+prod:nnbd-off=pkg/compiler/test/rti/rti_emission_test.dart
+spec:nnbd-sdk=pkg/compiler/test/rti/rti_emission_test.dart
+prod:nnbd-sdk=pkg/compiler/test/rti/rti_emission_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/rti/emission/mixin_mixin2.dart b/pkg/compiler/test/rti/emission/mixin_mixin2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/mixin_mixin2.dart
rename to pkg/compiler/test/rti/emission/mixin_mixin2.dart
diff --git a/tests/compiler/dart2js/rti/emission/mixin_mixin4.dart b/pkg/compiler/test/rti/emission/mixin_mixin4.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/mixin_mixin4.dart
rename to pkg/compiler/test/rti/emission/mixin_mixin4.dart
diff --git a/tests/compiler/dart2js/rti/emission/mixin_subtype.dart b/pkg/compiler/test/rti/emission/mixin_subtype.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/mixin_subtype.dart
rename to pkg/compiler/test/rti/emission/mixin_subtype.dart
diff --git a/tests/compiler/dart2js/rti/emission/mixin_type_arguments.dart b/pkg/compiler/test/rti/emission/mixin_type_arguments.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/mixin_type_arguments.dart
rename to pkg/compiler/test/rti/emission/mixin_type_arguments.dart
diff --git a/tests/compiler/dart2js/rti/emission/native.dart b/pkg/compiler/test/rti/emission/native.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/native.dart
rename to pkg/compiler/test/rti/emission/native.dart
diff --git a/tests/compiler/dart2js/rti/emission/pragma_directives_instance.dart b/pkg/compiler/test/rti/emission/pragma_directives_instance.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/pragma_directives_instance.dart
rename to pkg/compiler/test/rti/emission/pragma_directives_instance.dart
diff --git a/tests/compiler/dart2js/rti/emission/pragma_directives_static.dart b/pkg/compiler/test/rti/emission/pragma_directives_static.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/pragma_directives_static.dart
rename to pkg/compiler/test/rti/emission/pragma_directives_static.dart
diff --git a/tests/compiler/dart2js/rti/emission/regress_18713.dart b/pkg/compiler/test/rti/emission/regress_18713.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/regress_18713.dart
rename to pkg/compiler/test/rti/emission/regress_18713.dart
diff --git a/tests/compiler/dart2js/rti/emission/replaced_type_variable.dart b/pkg/compiler/test/rti/emission/replaced_type_variable.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/replaced_type_variable.dart
rename to pkg/compiler/test/rti/emission/replaced_type_variable.dart
diff --git a/tests/compiler/dart2js/rti/emission/runtime_type.dart b/pkg/compiler/test/rti/emission/runtime_type.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/runtime_type.dart
rename to pkg/compiler/test/rti/emission/runtime_type.dart
diff --git a/tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string1.dart b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string1.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string1.dart
rename to pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string1.dart
diff --git a/tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string2.dart b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string2.dart
rename to pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string2.dart
diff --git a/tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string3.dart b/pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/runtime_type_instantiate_to_string3.dart
rename to pkg/compiler/test/rti/emission/runtime_type_instantiate_to_string3.dart
diff --git a/tests/compiler/dart2js/rti/emission/self.dart b/pkg/compiler/test/rti/emission/self.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/self.dart
rename to pkg/compiler/test/rti/emission/self.dart
diff --git a/tests/compiler/dart2js/rti/emission/self_generic.dart b/pkg/compiler/test/rti/emission/self_generic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/self_generic.dart
rename to pkg/compiler/test/rti/emission/self_generic.dart
diff --git a/tests/compiler/dart2js/rti/emission/static_argument.dart b/pkg/compiler/test/rti/emission/static_argument.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/static_argument.dart
rename to pkg/compiler/test/rti/emission/static_argument.dart
diff --git a/tests/compiler/dart2js/rti/emission/subtype_named_args.dart b/pkg/compiler/test/rti/emission/subtype_named_args.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/subtype_named_args.dart
rename to pkg/compiler/test/rti/emission/subtype_named_args.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass.dart b/pkg/compiler/test/rti/emission/superclass.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass.dart
rename to pkg/compiler/test/rti/emission/superclass.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_as.dart b/pkg/compiler/test/rti/emission/superclass_as.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_as.dart
rename to pkg/compiler/test/rti/emission/superclass_as.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_complex.dart b/pkg/compiler/test/rti/emission/superclass_complex.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_complex.dart
rename to pkg/compiler/test/rti/emission/superclass_complex.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_fixed.dart b/pkg/compiler/test/rti/emission/superclass_fixed.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_fixed.dart
rename to pkg/compiler/test/rti/emission/superclass_fixed.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype.dart b/pkg/compiler/test/rti/emission/superclass_supertype.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_supertype.dart
rename to pkg/compiler/test/rti/emission/superclass_supertype.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype_complex.dart b/pkg/compiler/test/rti/emission/superclass_supertype_complex.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_supertype_complex.dart
rename to pkg/compiler/test/rti/emission/superclass_supertype_complex.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype_fixed.dart b/pkg/compiler/test/rti/emission/superclass_supertype_fixed.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_supertype_fixed.dart
rename to pkg/compiler/test/rti/emission/superclass_supertype_fixed.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_supertype_trivial.dart b/pkg/compiler/test/rti/emission/superclass_supertype_trivial.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_supertype_trivial.dart
rename to pkg/compiler/test/rti/emission/superclass_supertype_trivial.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclass_trivial.dart b/pkg/compiler/test/rti/emission/superclass_trivial.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclass_trivial.dart
rename to pkg/compiler/test/rti/emission/superclass_trivial.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclasses_non_trivial.dart b/pkg/compiler/test/rti/emission/superclasses_non_trivial.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclasses_non_trivial.dart
rename to pkg/compiler/test/rti/emission/superclasses_non_trivial.dart
diff --git a/tests/compiler/dart2js/rti/emission/superclasses_trivial.dart b/pkg/compiler/test/rti/emission/superclasses_trivial.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/superclasses_trivial.dart
rename to pkg/compiler/test/rti/emission/superclasses_trivial.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertype.dart b/pkg/compiler/test/rti/emission/supertype.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertype.dart
rename to pkg/compiler/test/rti/emission/supertype.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertype_complex.dart b/pkg/compiler/test/rti/emission/supertype_complex.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertype_complex.dart
rename to pkg/compiler/test/rti/emission/supertype_complex.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertype_fixed.dart b/pkg/compiler/test/rti/emission/supertype_fixed.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertype_fixed.dart
rename to pkg/compiler/test/rti/emission/supertype_fixed.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertype_trivial.dart b/pkg/compiler/test/rti/emission/supertype_trivial.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertype_trivial.dart
rename to pkg/compiler/test/rti/emission/supertype_trivial.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_extends.dart b/pkg/compiler/test/rti/emission/supertypes_extends.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertypes_extends.dart
rename to pkg/compiler/test/rti/emission/supertypes_extends.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_extends2.dart b/pkg/compiler/test/rti/emission/supertypes_extends2.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertypes_extends2.dart
rename to pkg/compiler/test/rti/emission/supertypes_extends2.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_extends3.dart b/pkg/compiler/test/rti/emission/supertypes_extends3.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertypes_extends3.dart
rename to pkg/compiler/test/rti/emission/supertypes_extends3.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_implements.dart b/pkg/compiler/test/rti/emission/supertypes_implements.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertypes_implements.dart
rename to pkg/compiler/test/rti/emission/supertypes_implements.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_non_trivial.dart b/pkg/compiler/test/rti/emission/supertypes_non_trivial.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertypes_non_trivial.dart
rename to pkg/compiler/test/rti/emission/supertypes_non_trivial.dart
diff --git a/tests/compiler/dart2js/rti/emission/supertypes_trivial.dart b/pkg/compiler/test/rti/emission/supertypes_trivial.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/supertypes_trivial.dart
rename to pkg/compiler/test/rti/emission/supertypes_trivial.dart
diff --git a/tests/compiler/dart2js/rti/emission/tear_off_types.dart b/pkg/compiler/test/rti/emission/tear_off_types.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/tear_off_types.dart
rename to pkg/compiler/test/rti/emission/tear_off_types.dart
diff --git a/tests/compiler/dart2js/rti/emission/type_argument_dynamic.dart b/pkg/compiler/test/rti/emission/type_argument_dynamic.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/type_argument_dynamic.dart
rename to pkg/compiler/test/rti/emission/type_argument_dynamic.dart
diff --git a/tests/compiler/dart2js/rti/emission/type_argument_static.dart b/pkg/compiler/test/rti/emission/type_argument_static.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/type_argument_static.dart
rename to pkg/compiler/test/rti/emission/type_argument_static.dart
diff --git a/tests/compiler/dart2js/rti/emission/type_literal.dart b/pkg/compiler/test/rti/emission/type_literal.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/type_literal.dart
rename to pkg/compiler/test/rti/emission/type_literal.dart
diff --git a/tests/compiler/dart2js/rti/emission/type_variable_function_type.dart b/pkg/compiler/test/rti/emission/type_variable_function_type.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/emission/type_variable_function_type.dart
rename to pkg/compiler/test/rti/emission/type_variable_function_type.dart
diff --git a/tests/compiler/dart2js/rti/factory_call_test.dart b/pkg/compiler/test/rti/factory_call_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/factory_call_test.dart
rename to pkg/compiler/test/rti/factory_call_test.dart
diff --git a/tests/compiler/dart2js/rti/instance_call_test.dart b/pkg/compiler/test/rti/instance_call_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/instance_call_test.dart
rename to pkg/compiler/test/rti/instance_call_test.dart
diff --git a/tests/compiler/dart2js/rti/is_test_with_type_parameters_test.dart b/pkg/compiler/test/rti/is_test_with_type_parameters_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/is_test_with_type_parameters_test.dart
rename to pkg/compiler/test/rti/is_test_with_type_parameters_test.dart
diff --git a/tests/compiler/dart2js/rti/rti_emission_test.dart b/pkg/compiler/test/rti/rti_emission_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/rti_emission_test.dart
rename to pkg/compiler/test/rti/rti_emission_test.dart
diff --git a/tests/compiler/dart2js/rti/rti_need0_test.dart b/pkg/compiler/test/rti/rti_need0_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/rti_need0_test.dart
rename to pkg/compiler/test/rti/rti_need0_test.dart
diff --git a/tests/compiler/dart2js/rti/rti_need1_test.dart b/pkg/compiler/test/rti/rti_need1_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/rti_need1_test.dart
rename to pkg/compiler/test/rti/rti_need1_test.dart
diff --git a/tests/compiler/dart2js/rti/rti_need_test_helper.dart b/pkg/compiler/test/rti/rti_need_test_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/rti_need_test_helper.dart
rename to pkg/compiler/test/rti/rti_need_test_helper.dart
diff --git a/tests/compiler/dart2js/rti/runtime_type_hint_test.dart b/pkg/compiler/test/rti/runtime_type_hint_test.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/runtime_type_hint_test.dart
rename to pkg/compiler/test/rti/runtime_type_hint_test.dart
diff --git a/tests/compiler/dart2js/rti/show.dart b/pkg/compiler/test/rti/show.dart
similarity index 100%
rename from tests/compiler/dart2js/rti/show.dart
rename to pkg/compiler/test/rti/show.dart
diff --git a/tests/compiler/dart2js/serialization/data/const_literals.dart b/pkg/compiler/test/serialization/data/const_literals.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/const_literals.dart
rename to pkg/compiler/test/serialization/data/const_literals.dart
diff --git a/tests/compiler/dart2js/serialization/data/constructor_name.dart b/pkg/compiler/test/serialization/data/constructor_name.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/constructor_name.dart
rename to pkg/compiler/test/serialization/data/constructor_name.dart
diff --git a/tests/compiler/dart2js/serialization/data/continue.dart b/pkg/compiler/test/serialization/data/continue.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/continue.dart
rename to pkg/compiler/test/serialization/data/continue.dart
diff --git a/tests/compiler/dart2js/serialization/data/custom_types.dart b/pkg/compiler/test/serialization/data/custom_types.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/custom_types.dart
rename to pkg/compiler/test/serialization/data/custom_types.dart
diff --git a/tests/compiler/dart2js/serialization/data/deferred.dart b/pkg/compiler/test/serialization/data/deferred.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/deferred.dart
rename to pkg/compiler/test/serialization/data/deferred.dart
diff --git a/tests/compiler/dart2js/serialization/data/jsinterop.dart b/pkg/compiler/test/serialization/data/jsinterop.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/jsinterop.dart
rename to pkg/compiler/test/serialization/data/jsinterop.dart
diff --git a/tests/compiler/dart2js/serialization/data/labels.dart b/pkg/compiler/test/serialization/data/labels.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/labels.dart
rename to pkg/compiler/test/serialization/data/labels.dart
diff --git a/tests/compiler/dart2js/serialization/data/maps.dart b/pkg/compiler/test/serialization/data/maps.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/maps.dart
rename to pkg/compiler/test/serialization/data/maps.dart
diff --git a/tests/compiler/dart2js/serialization/data/switch.dart b/pkg/compiler/test/serialization/data/switch.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/switch.dart
rename to pkg/compiler/test/serialization/data/switch.dart
diff --git a/tests/compiler/dart2js/serialization/data/typedef.dart b/pkg/compiler/test/serialization/data/typedef.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/data/typedef.dart
rename to pkg/compiler/test/serialization/data/typedef.dart
diff --git a/tests/compiler/dart2js/serialization/in_memory_split_test.dart b/pkg/compiler/test/serialization/in_memory_split_test.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/in_memory_split_test.dart
rename to pkg/compiler/test/serialization/in_memory_split_test.dart
diff --git a/tests/compiler/dart2js/serialization/libs/deferred_lib1.dart b/pkg/compiler/test/serialization/libs/deferred_lib1.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/libs/deferred_lib1.dart
rename to pkg/compiler/test/serialization/libs/deferred_lib1.dart
diff --git a/tests/compiler/dart2js/serialization/libs/deferred_lib2.dart b/pkg/compiler/test/serialization/libs/deferred_lib2.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/libs/deferred_lib2.dart
rename to pkg/compiler/test/serialization/libs/deferred_lib2.dart
diff --git a/tests/compiler/dart2js/serialization/libs/deferred_lib3.dart b/pkg/compiler/test/serialization/libs/deferred_lib3.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/libs/deferred_lib3.dart
rename to pkg/compiler/test/serialization/libs/deferred_lib3.dart
diff --git a/tests/compiler/dart2js/serialization/on_disk_split_test.dart b/pkg/compiler/test/serialization/on_disk_split_test.dart
similarity index 70%
rename from tests/compiler/dart2js/serialization/on_disk_split_test.dart
rename to pkg/compiler/test/serialization/on_disk_split_test.dart
index 618eeb9..00ce798 100644
--- a/tests/compiler/dart2js/serialization/on_disk_split_test.dart
+++ b/pkg/compiler/test/serialization/on_disk_split_test.dart
@@ -9,23 +9,28 @@
 import 'package:compiler/src/commandline_options.dart';
 import 'package:compiler/src/dart2js.dart';
 
+import '../helpers/memory_compiler.dart';
+
 main(List<String> args) {
   asyncTest(() async {
     Directory dir = await Directory.systemTemp.createTemp('on_disk');
     Uri dillUri = dir.uri.resolve('out.dill');
     Uri outUri = dir.uri.resolve('out.js');
-    await internalMain([
-      'samples-dev/swarm/swarm.dart',
-      '--out=${dillUri}',
+    var commonArgs = [
       Flags.writeData,
       Flags.verbose,
-    ]);
+      '--libraries-spec=$sdkLibrariesSpecificationUri',
+    ];
     await internalMain([
-      '${dillUri}',
-      '--out=${outUri}',
-      Flags.readData,
-      Flags.verbose,
-    ]);
+          'samples-dev/swarm/swarm.dart',
+          '--out=${dillUri}',
+        ] +
+        commonArgs);
+    await internalMain([
+          '${dillUri}',
+          '--out=${outUri}',
+        ] +
+        commonArgs);
     await dir.delete(recursive: true);
   });
 }
diff --git a/tests/compiler/dart2js/serialization/serialization_test.dart b/pkg/compiler/test/serialization/serialization_test.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/serialization_test.dart
rename to pkg/compiler/test/serialization/serialization_test.dart
diff --git a/tests/compiler/dart2js/serialization/serialization_test_helper.dart b/pkg/compiler/test/serialization/serialization_test_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/serialization/serialization_test_helper.dart
rename to pkg/compiler/test/serialization/serialization_test_helper.dart
diff --git a/tests/compiler/dart2js/sourcemaps/data/async.dart b/pkg/compiler/test/sourcemaps/data/async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/data/async.dart
rename to pkg/compiler/test/sourcemaps/data/async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/data/invokes.dart b/pkg/compiler/test/sourcemaps/data/invokes.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/data/invokes.dart
rename to pkg/compiler/test/sourcemaps/data/invokes.dart
diff --git a/tests/compiler/dart2js/sourcemaps/data/operators.dart b/pkg/compiler/test/sourcemaps/data/operators.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/data/operators.dart
rename to pkg/compiler/test/sourcemaps/data/operators.dart
diff --git a/tests/compiler/dart2js/sourcemaps/data/others.dart b/pkg/compiler/test/sourcemaps/data/others.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/data/others.dart
rename to pkg/compiler/test/sourcemaps/data/others.dart
diff --git a/tests/compiler/dart2js/sourcemaps/data/super.dart b/pkg/compiler/test/sourcemaps/data/super.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/data/super.dart
rename to pkg/compiler/test/sourcemaps/data/super.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/colors.dart b/pkg/compiler/test/sourcemaps/helpers/colors.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/colors.dart
rename to pkg/compiler/test/sourcemaps/helpers/colors.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/diff.dart b/pkg/compiler/test/sourcemaps/helpers/diff.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/diff.dart
rename to pkg/compiler/test/sourcemaps/helpers/diff.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/html_parts.dart b/pkg/compiler/test/sourcemaps/helpers/html_parts.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/html_parts.dart
rename to pkg/compiler/test/sourcemaps/helpers/html_parts.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/js_tracer.dart b/pkg/compiler/test/sourcemaps/helpers/js_tracer.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/js_tracer.dart
rename to pkg/compiler/test/sourcemaps/helpers/js_tracer.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/lax_json.dart b/pkg/compiler/test/sourcemaps/helpers/lax_json.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/lax_json.dart
rename to pkg/compiler/test/sourcemaps/helpers/lax_json.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/output_structure.dart b/pkg/compiler/test/sourcemaps/helpers/output_structure.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/output_structure.dart
rename to pkg/compiler/test/sourcemaps/helpers/output_structure.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/sourcemap_helper.dart b/pkg/compiler/test/sourcemaps/helpers/sourcemap_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/sourcemap_helper.dart
rename to pkg/compiler/test/sourcemaps/helpers/sourcemap_helper.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/sourcemap_html_helper.dart b/pkg/compiler/test/sourcemaps/helpers/sourcemap_html_helper.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/sourcemap_html_helper.dart
rename to pkg/compiler/test/sourcemaps/helpers/sourcemap_html_helper.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/sourcemap_html_templates.dart b/pkg/compiler/test/sourcemaps/helpers/sourcemap_html_templates.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/sourcemap_html_templates.dart
rename to pkg/compiler/test/sourcemaps/helpers/sourcemap_html_templates.dart
diff --git a/tests/compiler/dart2js/sourcemaps/helpers/trace_graph.dart b/pkg/compiler/test/sourcemaps/helpers/trace_graph.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/helpers/trace_graph.dart
rename to pkg/compiler/test/sourcemaps/helpers/trace_graph.dart
diff --git a/tests/compiler/dart2js/sourcemaps/lax_json_test.dart b/pkg/compiler/test/sourcemaps/lax_json_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/lax_json_test.dart
rename to pkg/compiler/test/sourcemaps/lax_json_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/load_save_test.dart b/pkg/compiler/test/sourcemaps/load_save_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/load_save_test.dart
rename to pkg/compiler/test/sourcemaps/load_save_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/location_collector_test.dart b/pkg/compiler/test/sourcemaps/location_collector_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/location_collector_test.dart
rename to pkg/compiler/test/sourcemaps/location_collector_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/mapping_test.dart b/pkg/compiler/test/sourcemaps/mapping_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/mapping_test.dart
rename to pkg/compiler/test/sourcemaps/mapping_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/cannot_read_property.dart b/pkg/compiler/test/sourcemaps/minified/cannot_read_property.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/cannot_read_property.dart
rename to pkg/compiler/test/sourcemaps/minified/cannot_read_property.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/cannot_read_property2.dart b/pkg/compiler/test/sourcemaps/minified/cannot_read_property2.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/cannot_read_property2.dart
rename to pkg/compiler/test/sourcemaps/minified/cannot_read_property2.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/instance.dart b/pkg/compiler/test/sourcemaps/minified/instance.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/instance.dart
rename to pkg/compiler/test/sourcemaps/minified/instance.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/is_not_a_function.dart b/pkg/compiler/test/sourcemaps/minified/is_not_a_function.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/is_not_a_function.dart
rename to pkg/compiler/test/sourcemaps/minified/is_not_a_function.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/no_such_method.dart b/pkg/compiler/test/sourcemaps/minified/no_such_method.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/no_such_method.dart
rename to pkg/compiler/test/sourcemaps/minified/no_such_method.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/no_such_method2.dart b/pkg/compiler/test/sourcemaps/minified/no_such_method2.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/no_such_method2.dart
rename to pkg/compiler/test/sourcemaps/minified/no_such_method2.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/no_such_method3.dart b/pkg/compiler/test/sourcemaps/minified/no_such_method3.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/no_such_method3.dart
rename to pkg/compiler/test/sourcemaps/minified/no_such_method3.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified/no_such_method4.dart b/pkg/compiler/test/sourcemaps/minified/no_such_method4.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/minified/no_such_method4.dart
rename to pkg/compiler/test/sourcemaps/minified/no_such_method4.dart
diff --git a/tests/compiler/dart2js/sourcemaps/minified_names_test.dart b/pkg/compiler/test/sourcemaps/minified_names_test.dart
similarity index 95%
rename from tests/compiler/dart2js/sourcemaps/minified_names_test.dart
rename to pkg/compiler/test/sourcemaps/minified_names_test.dart
index 674f151..0a02e8a 100644
--- a/tests/compiler/dart2js/sourcemaps/minified_names_test.dart
+++ b/pkg/compiler/test/sourcemaps/minified_names_test.dart
@@ -14,6 +14,7 @@
 import 'package:dart2js_tools/src/dart2js_mapping.dart';
 
 import '../helpers/d8_helper.dart';
+import '../helpers/memory_compiler.dart';
 import 'package:expect/expect.dart';
 
 void main(List<String> args) {
@@ -94,9 +95,13 @@
 
 checkExpectation(MinifiedNameTest test, bool minified) async {
   print('-- ${minified ? 'minified' : 'not-minified'}:');
+  var options = [
+    Flags.testMode,
+    '--libraries-spec=$sdkLibrariesSpecificationUri',
+    if (minified) Flags.minify,
+  ];
   D8Result result = await runWithD8(
-      memorySourceFiles: {'main.dart': test.code},
-      options: minified ? [Flags.minify, Flags.testMode] : [Flags.testMode]);
+      memorySourceFiles: {'main.dart': test.code}, options: options);
   String stdout = result.runResult.stdout;
   String error = _extractError(stdout);
   print('   error: $error');
diff --git a/tests/compiler/dart2js/sourcemaps/name_test.dart b/pkg/compiler/test/sourcemaps/name_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/name_test.dart
rename to pkg/compiler/test/sourcemaps/name_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/nomapping_test.dart b/pkg/compiler/test/sourcemaps/nomapping_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/nomapping_test.dart
rename to pkg/compiler/test/sourcemaps/nomapping_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/source_map_test.dart b/pkg/compiler/test/sourcemaps/source_map_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/source_map_test.dart
rename to pkg/compiler/test/sourcemaps/source_map_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/source_mapping_invokes_test.dart b/pkg/compiler/test/sourcemaps/source_mapping_invokes_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/source_mapping_invokes_test.dart
rename to pkg/compiler/test/sourcemaps/source_mapping_invokes_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/source_mapping_operators_test.dart b/pkg/compiler/test/sourcemaps/source_mapping_operators_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/source_mapping_operators_test.dart
rename to pkg/compiler/test/sourcemaps/source_mapping_operators_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/source_mapping_test.dart b/pkg/compiler/test/sourcemaps/source_mapping_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/source_mapping_test.dart
rename to pkg/compiler/test/sourcemaps/source_mapping_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/deep_inlining.dart b/pkg/compiler/test/sourcemaps/stacktrace/deep_inlining.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/deep_inlining.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/deep_inlining.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/extension_method.dart b/pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart
similarity index 72%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/extension_method.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart
index 1da9d2f..0f6432d 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/extension_method.dart
+++ b/pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart
@@ -1,7 +1,6 @@
 class MyClass {
   MyClass();
 
-
 // @dart = 2.7
   @pragma('dart2js:noInline')
   set internalSetter(int v) {
@@ -14,7 +13,7 @@
 extension Ext on MyClass {
   @pragma('dart2js:noInline')
   int method() {
-    this./*6:Ext.method*/ internalSetter = 1;
+    this. /*6:Ext.method*/ internalSetter = 1;
     return 0;
   }
 
@@ -27,18 +26,18 @@
   }
 
   @pragma('dart2js:noInline')
-  int operator+(int v) {
-    this./*3:Ext.+*/ propertyA = 2;
+  int operator +(int v) {
+    this. /*3:Ext.+*/ propertyA = 2;
     return 1;
   }
 
   @pragma('dart2js:noInline')
-  int operator[](int v) => this /*2:Ext.[]*/ + 2;
+  int operator [](int v) => this /*2:Ext.[]*/ + 2;
 }
 
 extension on MyClass {
   @pragma('dart2js:noInline')
-  int method2() => this/*1:MyClass.<anonymous extension>.method2*/[0];
+  int method2() => this /*1:MyClass.<anonymous extension>.method2*/ [0];
 }
 
 @pragma('dart2js:noInline')
@@ -48,5 +47,5 @@
   q++;
   confuse(null);
   MyClass x = confuse(new MyClass());
-  x. /*0:main*/method2();
+  x. /*0:main*/ method2();
 }
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining.dart b/pkg/compiler/test/sourcemaps/stacktrace/getter_inlining.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/getter_inlining.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_1.dart b/pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_1.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_1.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_1.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_2.dart b/pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_2.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_2.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_2.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_3.dart b/pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_3.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_3.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_3.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_baseline_1.dart b/pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_baseline_1.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_baseline_1.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_baseline_1.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_baseline_2.dart b/pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_baseline_2.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/getter_inlining_baseline_2.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/getter_inlining_baseline_2.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart b/pkg/compiler/test/sourcemaps/stacktrace/null_instance_field.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/null_instance_field.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field_elided.dart b/pkg/compiler/test/sourcemaps/stacktrace/null_instance_field_elided.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field_elided.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/null_instance_field_elided.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart b/pkg/compiler/test/sourcemaps/stacktrace/null_interceptor_field.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/null_interceptor_field.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_receiver_inlining.dart b/pkg/compiler/test/sourcemaps/stacktrace/null_receiver_inlining.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/null_receiver_inlining.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/null_receiver_inlining.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/parameters.dart b/pkg/compiler/test/sourcemaps/stacktrace/parameters.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/parameters.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/parameters.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/parameters_elided.dart b/pkg/compiler/test/sourcemaps/stacktrace/parameters_elided.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/parameters_elided.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/parameters_elided.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/rethrow.dart b/pkg/compiler/test/sourcemaps/stacktrace/rethrow.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/rethrow.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/rethrow.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/setter_inlining.dart b/pkg/compiler/test/sourcemaps/stacktrace/setter_inlining.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/setter_inlining.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/setter_inlining.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_awaited_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_awaited_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_awaited_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_awaited_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_constructor.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_constructor.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_constructor.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_constructor.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_constructor_from_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_constructor_from_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_constructor_from_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_constructor_from_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_instance_method.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_instance_method.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_instance_method.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_instance_method.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_main.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_main.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_main.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_main.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_static_method.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_static_method.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_static_method.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_static_method.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_top_level_method.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_top_level_method.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_top_level_method.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_top_level_method.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_top_level_method_from_async.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_top_level_method_from_async.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_top_level_method_from_async.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_top_level_method_from_async.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_try_catch.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_try_catch.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_try_catch.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_try_catch.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_try_finally.dart b/pkg/compiler/test/sourcemaps/stacktrace/throw_in_try_finally.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_try_finally.dart
rename to pkg/compiler/test/sourcemaps/stacktrace/throw_in_try_finally.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart b/pkg/compiler/test/sourcemaps/stacktrace_test.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
rename to pkg/compiler/test/sourcemaps/stacktrace_test.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stepping/print.dart b/pkg/compiler/test/sourcemaps/stepping/print.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stepping/print.dart
rename to pkg/compiler/test/sourcemaps/stepping/print.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stepping/print_class_fields.dart b/pkg/compiler/test/sourcemaps/stepping/print_class_fields.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stepping/print_class_fields.dart
rename to pkg/compiler/test/sourcemaps/stepping/print_class_fields.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stepping/print_top_level_invoke.dart b/pkg/compiler/test/sourcemaps/stepping/print_top_level_invoke.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stepping/print_top_level_invoke.dart
rename to pkg/compiler/test/sourcemaps/stepping/print_top_level_invoke.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stepping/top_level_invoke.dart b/pkg/compiler/test/sourcemaps/stepping/top_level_invoke.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/stepping/top_level_invoke.dart
rename to pkg/compiler/test/sourcemaps/stepping/top_level_invoke.dart
diff --git a/tests/compiler/dart2js/sourcemaps/stepping_test.dart b/pkg/compiler/test/sourcemaps/stepping_test.dart
similarity index 98%
rename from tests/compiler/dart2js/sourcemaps/stepping_test.dart
rename to pkg/compiler/test/sourcemaps/stepping_test.dart
index 763c1bd..28712e6 100644
--- a/tests/compiler/dart2js/sourcemaps/stepping_test.dart
+++ b/pkg/compiler/test/sourcemaps/stepping_test.dart
@@ -76,6 +76,7 @@
     '--out=$outputFile',
     inputFile,
     Flags.disableInlining,
+    '--libraries-spec=$sdkLibrariesSpecificationUri',
   ];
   CompilationResult compilationResult = await entry.internalMain(arguments);
   Expect.isTrue(compilationResult.isSuccess);
diff --git a/tests/compiler/dart2js/sourcemaps/test_files/deferred_validator_test_file.dart b/pkg/compiler/test/sourcemaps/test_files/deferred_validator_test_file.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/test_files/deferred_validator_test_file.dart
rename to pkg/compiler/test/sourcemaps/test_files/deferred_validator_test_file.dart
diff --git a/tests/compiler/dart2js/sourcemaps/test_files/deferred_validator_test_lib.dart b/pkg/compiler/test/sourcemaps/test_files/deferred_validator_test_lib.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/test_files/deferred_validator_test_lib.dart
rename to pkg/compiler/test/sourcemaps/test_files/deferred_validator_test_lib.dart
diff --git a/tests/compiler/dart2js/sourcemaps/test_files/validator_test_file.dart b/pkg/compiler/test/sourcemaps/test_files/validator_test_file.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/test_files/validator_test_file.dart
rename to pkg/compiler/test/sourcemaps/test_files/validator_test_file.dart
diff --git a/tests/compiler/dart2js/sourcemaps/tools/diff_view.dart b/pkg/compiler/test/sourcemaps/tools/diff_view.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/tools/diff_view.dart
rename to pkg/compiler/test/sourcemaps/tools/diff_view.dart
diff --git a/tests/compiler/dart2js/sourcemaps/tools/load.dart b/pkg/compiler/test/sourcemaps/tools/load.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/tools/load.dart
rename to pkg/compiler/test/sourcemaps/tools/load.dart
diff --git a/tests/compiler/dart2js/sourcemaps/tools/save.dart b/pkg/compiler/test/sourcemaps/tools/save.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/tools/save.dart
rename to pkg/compiler/test/sourcemaps/tools/save.dart
diff --git a/tests/compiler/dart2js/sourcemaps/tools/source_mapping_test_viewer.dart b/pkg/compiler/test/sourcemaps/tools/source_mapping_test_viewer.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/tools/source_mapping_test_viewer.dart
rename to pkg/compiler/test/sourcemaps/tools/source_mapping_test_viewer.dart
diff --git a/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart b/pkg/compiler/test/sourcemaps/tools/source_mapping_tester.dart
similarity index 98%
rename from tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
rename to pkg/compiler/test/sourcemaps/tools/source_mapping_tester.dart
index 7041370..1b28a57 100644
--- a/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
+++ b/pkg/compiler/test/sourcemaps/tools/source_mapping_tester.dart
@@ -142,7 +142,7 @@
 Map<String, Uri> _computeTestFiles() {
   Map<String, Uri> map = <String, Uri>{};
   Directory dataDir = new Directory.fromUri(
-      Uri.base.resolve('tests/compiler/dart2js/sourcemaps/data/'));
+      Uri.base.resolve('pkg/compiler/test/sourcemaps/data/'));
   for (File file in dataDir.listSync()) {
     Uri uri = file.uri;
     map[uri.pathSegments.last] = uri;
diff --git a/tests/compiler/dart2js/sourcemaps/tools/sourcemap_visualizer.dart b/pkg/compiler/test/sourcemaps/tools/sourcemap_visualizer.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/tools/sourcemap_visualizer.dart
rename to pkg/compiler/test/sourcemaps/tools/sourcemap_visualizer.dart
diff --git a/tests/compiler/dart2js/sourcemaps/tools/translate_dart2js_stacktrace.dart b/pkg/compiler/test/sourcemaps/tools/translate_dart2js_stacktrace.dart
similarity index 100%
rename from tests/compiler/dart2js/sourcemaps/tools/translate_dart2js_stacktrace.dart
rename to pkg/compiler/test/sourcemaps/tools/translate_dart2js_stacktrace.dart
diff --git a/tests/compiler/dart2js/static_type/data/assert.dart b/pkg/compiler/test/static_type/data/assert.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/assert.dart
rename to pkg/compiler/test/static_type/data/assert.dart
diff --git a/tests/compiler/dart2js/static_type/data/assert_ea.dart b/pkg/compiler/test/static_type/data/assert_ea.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/assert_ea.dart
rename to pkg/compiler/test/static_type/data/assert_ea.dart
diff --git a/tests/compiler/dart2js/static_type/data/cascade.dart b/pkg/compiler/test/static_type/data/cascade.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/cascade.dart
rename to pkg/compiler/test/static_type/data/cascade.dart
diff --git a/tests/compiler/dart2js/static_type/data/closure.dart b/pkg/compiler/test/static_type/data/closure.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/closure.dart
rename to pkg/compiler/test/static_type/data/closure.dart
diff --git a/tests/compiler/dart2js/static_type/data/do.dart b/pkg/compiler/test/static_type/data/do.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/do.dart
rename to pkg/compiler/test/static_type/data/do.dart
diff --git a/tests/compiler/dart2js/static_type/data/effectively_final.dart b/pkg/compiler/test/static_type/data/effectively_final.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/effectively_final.dart
rename to pkg/compiler/test/static_type/data/effectively_final.dart
diff --git a/tests/compiler/dart2js/static_type/data/for.dart b/pkg/compiler/test/static_type/data/for.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/for.dart
rename to pkg/compiler/test/static_type/data/for.dart
diff --git a/tests/compiler/dart2js/static_type/data/for_in.dart b/pkg/compiler/test/static_type/data/for_in.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/for_in.dart
rename to pkg/compiler/test/static_type/data/for_in.dart
diff --git a/tests/compiler/dart2js/static_type/data/generic_method.dart b/pkg/compiler/test/static_type/data/generic_method.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/generic_method.dart
rename to pkg/compiler/test/static_type/data/generic_method.dart
diff --git a/tests/compiler/dart2js/static_type/data/if.dart b/pkg/compiler/test/static_type/data/if.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/if.dart
rename to pkg/compiler/test/static_type/data/if.dart
diff --git a/pkg/compiler/test/static_type/data/marker.options b/pkg/compiler/test/static_type/data/marker.options
new file mode 100644
index 0000000..d301940
--- /dev/null
+++ b/pkg/compiler/test/static_type/data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/static_type/static_type_test.dart
+prod:nnbd-off=pkg/compiler/test/static_type/static_type_test.dart
+spec:nnbd-sdk=pkg/compiler/test/static_type/static_type_test.dart
+prod:nnbd-sdk=pkg/compiler/test/static_type/static_type_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/static_type/data/null.dart b/pkg/compiler/test/static_type/data/null.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/null.dart
rename to pkg/compiler/test/static_type/data/null.dart
diff --git a/tests/compiler/dart2js/static_type/data/null_access.dart b/pkg/compiler/test/static_type/data/null_access.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/null_access.dart
rename to pkg/compiler/test/static_type/data/null_access.dart
diff --git a/tests/compiler/dart2js/static_type/data/switch.dart b/pkg/compiler/test/static_type/data/switch.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/switch.dart
rename to pkg/compiler/test/static_type/data/switch.dart
diff --git a/tests/compiler/dart2js/static_type/data/try_catch.dart b/pkg/compiler/test/static_type/data/try_catch.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/try_catch.dart
rename to pkg/compiler/test/static_type/data/try_catch.dart
diff --git a/tests/compiler/dart2js/static_type/data/try_finally.dart b/pkg/compiler/test/static_type/data/try_finally.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/try_finally.dart
rename to pkg/compiler/test/static_type/data/try_finally.dart
diff --git a/tests/compiler/dart2js/static_type/data/while.dart b/pkg/compiler/test/static_type/data/while.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/data/while.dart
rename to pkg/compiler/test/static_type/data/while.dart
diff --git a/tests/compiler/dart2js/static_type/show.dart b/pkg/compiler/test/static_type/show.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/show.dart
rename to pkg/compiler/test/static_type/show.dart
diff --git a/tests/compiler/dart2js/static_type/static_type_test.dart b/pkg/compiler/test/static_type/static_type_test.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/static_type_test.dart
rename to pkg/compiler/test/static_type/static_type_test.dart
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/bottom.dart b/pkg/compiler/test/static_type/type_promotion_data/bottom.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/type_promotion_data/bottom.dart
rename to pkg/compiler/test/static_type/type_promotion_data/bottom.dart
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/closure.dart b/pkg/compiler/test/static_type/type_promotion_data/closure.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/type_promotion_data/closure.dart
rename to pkg/compiler/test/static_type/type_promotion_data/closure.dart
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/equals.dart b/pkg/compiler/test/static_type/type_promotion_data/equals.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/type_promotion_data/equals.dart
rename to pkg/compiler/test/static_type/type_promotion_data/equals.dart
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/if.dart b/pkg/compiler/test/static_type/type_promotion_data/if.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/type_promotion_data/if.dart
rename to pkg/compiler/test/static_type/type_promotion_data/if.dart
diff --git a/pkg/compiler/test/static_type/type_promotion_data/marker.options b/pkg/compiler/test/static_type/type_promotion_data/marker.options
new file mode 100644
index 0000000..2d99ad9
--- /dev/null
+++ b/pkg/compiler/test/static_type/type_promotion_data/marker.options
@@ -0,0 +1,4 @@
+spec:nnbd-off=pkg/compiler/test/static_type/type_promotion_test.dart
+prod:nnbd-off=pkg/compiler/test/static_type/type_promotion_test.dart
+spec:nnbd-sdk=pkg/compiler/test/static_type/type_promotion_test.dart
+prod:nnbd-sdk=pkg/compiler/test/static_type/type_promotion_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/null.dart b/pkg/compiler/test/static_type/type_promotion_data/null.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/type_promotion_data/null.dart
rename to pkg/compiler/test/static_type/type_promotion_data/null.dart
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/sequence.dart b/pkg/compiler/test/static_type/type_promotion_data/sequence.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/type_promotion_data/sequence.dart
rename to pkg/compiler/test/static_type/type_promotion_data/sequence.dart
diff --git a/tests/compiler/dart2js/static_type/type_promotion_test.dart b/pkg/compiler/test/static_type/type_promotion_test.dart
similarity index 100%
rename from tests/compiler/dart2js/static_type/type_promotion_test.dart
rename to pkg/compiler/test/static_type/type_promotion_test.dart
diff --git a/pkg/compiler/testing.json b/pkg/compiler/testing.json
index dcac855..71e5988 100644
--- a/pkg/compiler/testing.json
+++ b/pkg/compiler/testing.json
@@ -9,15 +9,14 @@
     "options": "analysis_options.yaml",
 
     "uris": [
-      ".",
-      "../../tests/compiler/dart2js/"
+      "."
     ],
 
     "exclude": [
-      "^tests/compiler/dart2js/.*/data/.*",
-      "^tests/compiler/dart2js/.*/model_data/.*",
-      "^tests/compiler/dart2js/deferred_loading/libs/.*",
-      "^tests/compiler/dart2js/sourcemaps/stacktrace/extension_method.dart"
+      "^pkg/compiler/test/.*/data/.*",
+      "^pkg/compiler/test/.*/model_data/.*",
+      "^pkg/compiler/test/deferred_loading/libs/.*",
+      "^pkg/compiler/test/sourcemaps/stacktrace/extension_method.dart"
     ]
   }
 }
diff --git a/pkg/compiler/tool/modular_test_suite.dart b/pkg/compiler/tool/modular_test_suite.dart
index 5f5fa89..9f75ae8 100644
--- a/pkg/compiler/tool/modular_test_suite.dart
+++ b/pkg/compiler/tool/modular_test_suite.dart
@@ -132,13 +132,18 @@
         return;
       }
       sources = ['dart:core'];
-      extraArgs = ['--libraries-file', '$rootScheme:///sdk/lib/libraries.json'];
+      extraArgs = [
+        '--libraries-file',
+        '$rootScheme:///sdk_nnbd/lib/libraries.json'
+      ];
       assert(transitiveDependencies.isEmpty);
     } else {
       sources = module.sources.map(sourceToImportUri).toList();
       extraArgs = ['--packages-file', '$rootScheme:/.packages'];
     }
 
+    // TODO(joshualitt): Ensure the kernel worker has some way to specify
+    // --no-sound-null-safety
     List<String> args = [
       _kernelWorkerScript,
       '--no-summary-only',
@@ -155,6 +160,7 @@
           .expand((m) => ['--input-linked', '${toUri(m, dillId)}'])),
       ...(sources.expand((String uri) => ['--source', uri])),
       ...(flags.expand((String flag) => ['--enable-experiment', flag])),
+      '--enable-experiment=non-nullable',
     ];
 
     var result =
@@ -197,8 +203,7 @@
       '--packages=${sdkRoot.toFilePath()}/.packages',
       _dart2jsScript,
       // TODO(sigmund): remove this dependency on libraries.json
-      if (_options.useSdk)
-        '--libraries-spec=$_librarySpecForSnapshot',
+      if (_options.useSdk) '--libraries-spec=$_librarySpecForSnapshot',
       '${toUri(module, dillId)}',
       for (String flag in flags) '--enable-experiment=$flag',
       '${Flags.dillDependencies}=${dillDependencies.join(',')}',
@@ -337,7 +342,7 @@
     if (_options.verbose) print("\nstep: d8 on $module");
     List<String> d8Args = [
       sdkRoot
-          .resolve('sdk/lib/_internal/js_runtime/lib/preambles/d8.js')
+          .resolve('sdk_nnbd/lib/_internal/js_runtime/lib/preambles/d8.js')
           .toFilePath(),
       root.resolveUri(toUri(module, jsId)).toFilePath(),
     ];
diff --git a/pkg/compiler/tool/update_id_tests.dart b/pkg/compiler/tool/update_id_tests.dart
index db62688..445a7a8 100644
--- a/pkg/compiler/tool/update_id_tests.dart
+++ b/pkg/compiler/tool/update_id_tests.dart
@@ -5,27 +5,27 @@
 import 'package:_fe_analyzer_shared/src/testing/id_testing.dart' as id;
 
 const List<String> idTests = <String>[
-  'tests/compiler/dart2js/model/cfe_constant_test.dart',
-  'tests/compiler/dart2js/annotations/annotations_test.dart',
-  'tests/compiler/dart2js/closure/closure_test.dart',
-  'tests/compiler/dart2js/codegen/model_test.dart',
-  'tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart',
-  'tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart',
-  'tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart',
-  'tests/compiler/dart2js/impact/impact_test.dart',
-  'tests/compiler/dart2js/inference/callers_test.dart',
-  'tests/compiler/dart2js/inference/inference_test_helper.dart',
-  'tests/compiler/dart2js/inference/inference_data_test.dart',
-  'tests/compiler/dart2js/inference/side_effects_test.dart',
-  'tests/compiler/dart2js/inlining/inlining_test.dart',
-  'tests/compiler/dart2js/jumps/jump_test.dart',
-  'tests/compiler/dart2js/member_usage/member_usage_test.dart',
-  'tests/compiler/dart2js/optimization/optimization_test.dart',
-  'tests/compiler/dart2js/rti/rti_need_test_helper.dart',
-  'tests/compiler/dart2js/rti/rti_emission_test.dart',
-  'tests/compiler/dart2js/static_type/static_type_test.dart',
-  'tests/compiler/dart2js/static_type/type_promotion_test.dart',
-  'tests/compiler/dart2js/equivalence/id_testing_test.dart',
+  'pkg/compiler/test/model/cfe_constant_test.dart',
+  'pkg/compiler/test/annotations/annotations_test.dart',
+  'pkg/compiler/test/closure/closure_test.dart',
+  'pkg/compiler/test/codegen/model_test.dart',
+  'pkg/compiler/test/deferred_loading/deferred_loading_test.dart',
+  'pkg/compiler/test/field_analysis/jfield_analysis_test.dart',
+  'pkg/compiler/test/field_analysis/kfield_analysis_test.dart',
+  'pkg/compiler/test/impact/impact_test.dart',
+  'pkg/compiler/test/inference/callers_test.dart',
+  'pkg/compiler/test/inference/inference_test_helper.dart',
+  'pkg/compiler/test/inference/inference_data_test.dart',
+  'pkg/compiler/test/inference/side_effects_test.dart',
+  'pkg/compiler/test/inlining/inlining_test.dart',
+  'pkg/compiler/test/jumps/jump_test.dart',
+  'pkg/compiler/test/member_usage/member_usage_test.dart',
+  'pkg/compiler/test/optimization/optimization_test.dart',
+  'pkg/compiler/test/rti/rti_need_test_helper.dart',
+  'pkg/compiler/test/rti/rti_emission_test.dart',
+  'pkg/compiler/test/static_type/static_type_test.dart',
+  'pkg/compiler/test/static_type/type_promotion_test.dart',
+  'pkg/compiler/test/equivalence/id_testing_test.dart',
 ];
 
 main() async {
diff --git a/pkg/dartdev/lib/src/sdk.dart b/pkg/dartdev/lib/src/sdk.dart
index 583a030..9c039f9 100644
--- a/pkg/dartdev/lib/src/sdk.dart
+++ b/pkg/dartdev/lib/src/sdk.dart
@@ -40,7 +40,10 @@
 
   Sdk() : sdkPath = _computeSdkPath;
 
-  String get dart => path.absolute(sdkPath, 'bin', _exeName('dart'));
+  // Assume that we want to use the same Dart executable that we used to spawn
+  // DartDev. We should be able to run programs with out/ReleaseX64/dart even
+  // if the SDK isn't completely built.
+  String get dart => Platform.resolvedExecutable;
 
   String get analysis_server_snapshot => path.absolute(
       sdkPath, 'bin', 'snapshots', 'analysis_server.dart.snapshot');
diff --git a/pkg/dartdev/test/utils.dart b/pkg/dartdev/test/utils.dart
index 9dc7b41..7e978ba 100644
--- a/pkg/dartdev/test/utils.dart
+++ b/pkg/dartdev/test/utils.dart
@@ -58,12 +58,12 @@
     var arguments = [
       absolutePathToDartdevFile,
       command,
+      if (command == 'migrate')
+        // TODO(srawlins): Enable `pub outdated` in tests.
+        '--skip-pub-outdated',
+      ...?args,
     ];
 
-    if (args != null && args.isNotEmpty) {
-      arguments.addAll(args);
-    }
-
     return Process.runSync(
       Platform.resolvedExecutable,
       arguments,
diff --git a/pkg/dev_compiler/lib/src/compiler/module_builder.dart b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
index da8765a..ce17c8c 100644
--- a/pkg/dev_compiler/lib/src/compiler/module_builder.dart
+++ b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
@@ -190,10 +190,8 @@
       }
     }
 
-    var functionName =
-        'load__' + pathToJSIdentifier(module.name.replaceAll('.', '_'));
     var resultModule = NamedFunction(
-        Identifier(functionName),
+        loadFunctionName(module.name),
         js.fun("function(#) { 'use strict'; #; }", [parameters, statements]),
         true);
 
@@ -300,11 +298,12 @@
       statements.add(js.comment('Exports:'));
       statements.add(Return(ObjectInitializer(exportedProps, multiline: true)));
     }
-
-    // TODO(vsm): Consider using an immediately invoked named function pattern
-    // (see ddc module code above).
-    var block = js.statement("define(#, function(#) { 'use strict'; #; });",
-        [ArrayInitializer(dependencies), fnParams, statements]);
+    var resultModule = NamedFunction(
+        loadFunctionName(module.name),
+        js.fun("function(#) { 'use strict'; #; }", [fnParams, statements]),
+        true);
+    var block = js.statement(
+        'define(#, #);', [ArrayInitializer(dependencies), resultModule]);
 
     return Program([block]);
   }
@@ -328,5 +327,9 @@
       .replaceAll('-', '_'));
 }
 
+/// Creates function name identifier given [moduleName].
+Identifier loadFunctionName(String moduleName) =>
+    Identifier('load__' + pathToJSIdentifier(moduleName.replaceAll('.', '_')));
+
 // Replacement string for path separators (i.e., '/', '\', '..').
 final encodedSeparator = '__';
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_command.dart b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
index cc4011d..2c6e470 100644
--- a/pkg/dev_compiler/lib/src/compiler/shared_command.dart
+++ b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
@@ -84,6 +84,8 @@
   /// for more details.
   final Map<String, bool> experiments;
 
+  final bool soundNullSafety;
+
   /// The name of the module.
   ///
   /// This used when to support file concatenation. The JS module will contain
@@ -100,7 +102,8 @@
       this.summaryModules = const {},
       this.moduleFormats = const [],
       this.experiments = const {},
-      this.moduleName});
+      this.moduleName,
+      this.soundNullSafety = false});
 
   SharedCompilerOptions.fromArguments(ArgResults args,
       [String moduleRoot, String summaryExtension])
@@ -115,7 +118,8 @@
                 args['summary'] as List<String>, moduleRoot, summaryExtension),
             moduleFormats: parseModuleFormatOption(args),
             moduleName: _getModuleName(args, moduleRoot),
-            replCompile: args['repl-compile'] as bool);
+            replCompile: args['repl-compile'] as bool,
+            soundNullSafety: args['sound-null-safety'] as bool);
 
   static void addArguments(ArgParser parser, {bool hide = true}) {
     addModuleFormatOptions(parser, hide: hide);
@@ -144,7 +148,11 @@
               ' to private members across library boundaries. This should'
               ' only be used by debugging tools.',
           defaultsTo: false,
-          hide: hide);
+          hide: hide)
+      ..addFlag('sound-null-safety',
+          help: 'Compile for sound null safety at runtime.',
+          negatable: true,
+          defaultsTo: false);
   }
 
   static String _getModuleName(ArgResults args, String moduleRoot) {
diff --git a/pkg/dev_compiler/lib/src/kernel/command.dart b/pkg/dev_compiler/lib/src/kernel/command.dart
index af299b8..c968376 100644
--- a/pkg/dev_compiler/lib/src/kernel/command.dart
+++ b/pkg/dev_compiler/lib/src/kernel/command.dart
@@ -204,7 +204,8 @@
   var sdkSummaryPath = argResults['dart-sdk-summary'] as String;
   var librarySpecPath = argResults['libraries-file'] as String;
   if (sdkSummaryPath == null) {
-    sdkSummaryPath = defaultSdkSummaryPath;
+    sdkSummaryPath =
+        defaultSdkSummaryPath(soundNullSafety: options.soundNullSafety);
     librarySpecPath ??= defaultLibrarySpecPath;
   }
   var invalidSummary = summaryPaths.any((s) => !s.endsWith('.dill')) ||
@@ -281,7 +282,9 @@
             enableNullSafety: options.enableNullSafety)),
         fileSystem: fileSystem,
         experiments: experiments,
-        environmentDefines: declaredVariables);
+        environmentDefines: declaredVariables,
+        nnbdMode:
+            options.soundNullSafety ? fe.NnbdMode.Strong : fe.NnbdMode.Weak);
   } else {
     // If digests weren't given and if not in worker mode, create fake data and
     // ensure we don't have a previous state (as that wouldn't be safe with
@@ -319,7 +322,9 @@
         fileSystem: fileSystem,
         experiments: experiments,
         environmentDefines: declaredVariables,
-        trackNeededDillLibraries: recordUsedInputs);
+        trackNeededDillLibraries: recordUsedInputs,
+        nnbdMode:
+            options.soundNullSafety ? fe.NnbdMode.Strong : fe.NnbdMode.Weak);
     incrementalCompiler = compilerState.incrementalCompiler;
     cachedSdkInput =
         compilerState.workerInputCache[sourcePathToUri(sdkSummaryPath)];
@@ -692,9 +697,12 @@
   return declaredVariables;
 }
 
-/// The default path of the kernel summary for the Dart SDK.
-final defaultSdkSummaryPath =
-    p.join(getSdkPath(), 'lib', '_internal', 'ddc_sdk.dill');
+/// The default path of the kernel summary for the Dart SDK given the
+/// [soundNullSafety] mode.
+String defaultSdkSummaryPath({bool soundNullSafety}) {
+  var outlineDill = soundNullSafety ? 'ddc_outline_sound.dill' : 'ddc_sdk.dill';
+  return p.join(getSdkPath(), 'lib', '_internal', outlineDill);
+}
 
 final defaultLibrarySpecPath = p.join(getSdkPath(), 'lib', 'libraries.json');
 
diff --git a/pkg/dev_compiler/test/nullable_inference_test.dart b/pkg/dev_compiler/test/nullable_inference_test.dart
index 7c11494..f1cadb9 100644
--- a/pkg/dev_compiler/test/nullable_inference_test.dart
+++ b/pkg/dev_compiler/test/nullable_inference_test.dart
@@ -644,7 +644,8 @@
   var sdkUri = Uri.file('/memory/dart_sdk.dill');
   var sdkFile = _fileSystem.entityForUri(sdkUri);
   if (!await sdkFile.exists()) {
-    sdkFile.writeAsBytesSync(File(defaultSdkSummaryPath).readAsBytesSync());
+    sdkFile.writeAsBytesSync(
+        File(defaultSdkSummaryPath(soundNullSafety: false)).readAsBytesSync());
   }
   var packagesUri = Uri.file('/memory/.packages');
   var packagesFile = _fileSystem.entityForUri(packagesUri);
diff --git a/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart b/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart
index e2c3059..9a07e32 100644
--- a/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart
+++ b/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart
@@ -56,7 +56,7 @@
     var sdkJsFile = findInOutDir('gen/utils/dartdevc/kernel/es6/dart_sdk.js');
     var jsSdkPath = sdkJsFile.uri;
 
-    var ddcSdkSummary = findInOutDir('ddc_sdk.dill');
+    var ddcSdkSummary = findInOutDir('ddc_outline.dill');
 
     var args = <String>[
       "--packages=${sdkRoot.uri.resolve(".packages").toFilePath()}",
diff --git a/pkg/dev_compiler/tool/ddb b/pkg/dev_compiler/tool/ddb
index c44ed3f..71de3eb 100755
--- a/pkg/dev_compiler/tool/ddb
+++ b/pkg/dev_compiler/tool/ddb
@@ -207,18 +207,19 @@
       break;
   }
 
-  String sdkJsPath;
-  String requirePath;
   String ddcSdk;
   if (debug) {
     var sdkRoot = p.dirname(p.dirname(ddcPath));
     var buildDir = p.join(sdkRoot, Platform.isMacOS ? 'xcodebuild' : 'out');
     dartSdk = p.join(buildDir, 'ReleaseX64', 'dart-sdk');
+    ddcSdk = p.join(buildDir, 'ReleaseX64',
+        isNnbdStrong ? 'ddc_outline_sound.dill' : 'ddc_outline.dill');
+  } else {
+    ddcSdk = p.join(dartSdk, 'lib', '_internal', 'ddc_sdk.dill');
   }
   var suffix = p.join('kernel', mod);
-  sdkJsPath = p.join(dartSdk, 'lib', 'dev_compiler', suffix);
-  requirePath = sdkJsPath;
-  ddcSdk = p.join(dartSdk, 'lib', '_internal', 'ddc_sdk.dill');
+  var sdkJsPath = p.join(dartSdk, 'lib', 'dev_compiler', suffix);
+  var requirePath = sdkJsPath;
 
   // Print an initial empty line to separate the invocation from the output.
   print('');
@@ -231,6 +232,7 @@
       '--dart-sdk-summary=$ddcSdk',
       for (var summary in summaries) '--summary=$summary',
       for (var experiment in experiments) '--enable-experiment=$experiment',
+      if (isNnbdStrong) '--sound-null-safety',
       if (options['packages'] != null) '--packages=${options['packages']}',
       '-o',
       out,
diff --git a/pkg/front_end/lib/src/api_unstable/dart2js.dart b/pkg/front_end/lib/src/api_unstable/dart2js.dart
index 4a7ef9d..35d49c2 100644
--- a/pkg/front_end/lib/src/api_unstable/dart2js.dart
+++ b/pkg/front_end/lib/src/api_unstable/dart2js.dart
@@ -12,8 +12,7 @@
 
 import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity;
 
-import 'package:_fe_analyzer_shared/src/scanner/scanner.dart'
-    show ErrorToken, StringToken, Token;
+import 'package:_fe_analyzer_shared/src/scanner/scanner.dart' show StringToken;
 
 import 'package:kernel/kernel.dart' show Component, Statement;
 
@@ -208,19 +207,6 @@
   return compilerResult?.component;
 }
 
-Object tokenToString(Object value) {
-  // TODO(ahe): This method is most likely unnecessary. Dart2js doesn't see
-  // tokens anymore.
-  if (value is ErrorToken) {
-    // Shouldn't happen.
-    return value.assertionMessage.message;
-  } else if (value is Token) {
-    return value.lexeme;
-  } else {
-    return value;
-  }
-}
-
 /// Retrieve the name of the libraries that are supported by [target] according
 /// to the libraries specification [json] file.
 ///
diff --git a/pkg/front_end/lib/src/api_unstable/ddc.dart b/pkg/front_end/lib/src/api_unstable/ddc.dart
index 68548a4..fcaa746 100644
--- a/pkg/front_end/lib/src/api_unstable/ddc.dart
+++ b/pkg/front_end/lib/src/api_unstable/ddc.dart
@@ -25,6 +25,8 @@
 
 import '../base/processed_options.dart' show ProcessedOptions;
 
+import '../base/nnbd_mode.dart' show NnbdMode;
+
 import '../kernel_generator_impl.dart' show generateKernel;
 
 import 'compiler_state.dart' show InitializedCompilerState;
@@ -58,6 +60,8 @@
 
 export '../base/processed_options.dart' show ProcessedOptions;
 
+export '../base/nnbd_mode.dart' show NnbdMode;
+
 export '../fasta/compiler_context.dart' show CompilerContext;
 
 export '../fasta/incremental_compiler.dart' show IncrementalCompiler;
@@ -110,7 +114,8 @@
     Target target,
     {FileSystem fileSystem,
     Map<ExperimentalFlag, bool> experiments,
-    Map<String, String> environmentDefines}) async {
+    Map<String, String> environmentDefines,
+    NnbdMode nnbdMode}) async {
   additionalDills.sort((a, b) => a.toString().compareTo(b.toString()));
 
   if (oldState != null &&
@@ -118,6 +123,7 @@
       oldState.options.sdkSummary == sdkSummary &&
       oldState.options.packagesFileUri == packagesFile &&
       oldState.options.librariesSpecificationUri == librariesSpecificationUri &&
+      oldState.options.nnbdMode == nnbdMode &&
       equalLists(oldState.options.additionalDills, additionalDills) &&
       equalMaps(oldState.options.experimentalFlags, experiments) &&
       equalMaps(oldState.options.environmentDefines, environmentDefines)) {
@@ -134,7 +140,8 @@
     ..librariesSpecificationUri = librariesSpecificationUri
     ..target = target
     ..fileSystem = fileSystem ?? StandardFileSystem.instance
-    ..environmentDefines = environmentDefines;
+    ..environmentDefines = environmentDefines
+    ..nnbdMode = nnbdMode;
   if (experiments != null) options.experimentalFlags = experiments;
 
   ProcessedOptions processedOpts = new ProcessedOptions(options: options);
@@ -161,7 +168,8 @@
     {FileSystem fileSystem,
     Map<ExperimentalFlag, bool> experiments,
     Map<String, String> environmentDefines,
-    bool trackNeededDillLibraries: false}) async {
+    bool trackNeededDillLibraries: false,
+    NnbdMode nnbdMode}) async {
   return modular.initializeIncrementalCompiler(
       oldState,
       tags,
@@ -180,7 +188,8 @@
           environmentDefines ?? const <ExperimentalFlag, bool>{},
       outlineOnly: false,
       omitPlatform: false,
-      trackNeededDillLibraries: trackNeededDillLibraries);
+      trackNeededDillLibraries: trackNeededDillLibraries,
+      nnbdMode: nnbdMode);
 }
 
 Future<DdcResult> compile(InitializedCompilerState compilerState,
diff --git a/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart b/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart
index 9668bc0..291a914 100644
--- a/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart
+++ b/pkg/front_end/lib/src/api_unstable/modular_incremental_compilation.dart
@@ -14,6 +14,8 @@
 
 import '../api_prototype/file_system.dart' show FileSystem;
 
+import '../base/nnbd_mode.dart' show NnbdMode;
+
 import '../base/processed_options.dart' show ProcessedOptions;
 
 import '../fasta/compiler_context.dart' show CompilerContext;
@@ -54,7 +56,8 @@
     bool outlineOnly,
     bool omitPlatform: false,
     bool trackNeededDillLibraries: false,
-    bool verbose: false}) async {
+    bool verbose: false,
+    NnbdMode nnbdMode: NnbdMode.Weak}) async {
   bool isRetry = false;
   while (true) {
     try {
@@ -78,6 +81,7 @@
           oldState.incrementalCompiler == null ||
           oldState.options.compileSdk != compileSdk ||
           oldState.incrementalCompiler.outlineOnly != outlineOnly ||
+          oldState.options.nnbdMode != nnbdMode ||
           !equalMaps(oldState.options.experimentalFlags, experimentalFlags) ||
           !equalMaps(oldState.options.environmentDefines, environmentDefines) ||
           !equalSets(oldState.tags, tags) ||
@@ -100,7 +104,8 @@
           ..omitPlatform = omitPlatform
           ..environmentDefines = environmentDefines
           ..experimentalFlags = experimentalFlags
-          ..verbose = verbose;
+          ..verbose = verbose
+          ..nnbdMode = nnbdMode;
 
         processedOpts = new ProcessedOptions(options: options);
         cachedSdkInput = new WorkerInputComponent(
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 22b5225..1cfef94 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -399,7 +399,6 @@
 
   static const List<String> optOutTestPaths = [
     'co19_2/',
-    'compiler/dart2js/',
     'compiler/dart2js_extra/',
     'compiler/dart2js_native/',
     'corelib_2/',
diff --git a/pkg/front_end/lib/src/kernel_generator_impl.dart b/pkg/front_end/lib/src/kernel_generator_impl.dart
index 4c59273..5cef59a 100644
--- a/pkg/front_end/lib/src/kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/kernel_generator_impl.dart
@@ -9,7 +9,10 @@
 
 import 'package:_fe_analyzer_shared/src/messages/severity.dart' show Severity;
 
-import 'package:kernel/kernel.dart' show CanonicalName, Component;
+import 'package:kernel/kernel.dart'
+    show CanonicalName, Component, NonNullableByDefaultCompiledMode;
+
+import 'base/nnbd_mode.dart';
 
 import 'base/processed_options.dart' show ProcessedOptions;
 
@@ -80,11 +83,28 @@
     // sdkSummary between multiple invocations.
     CanonicalName nameRoot = sdkSummary?.root ?? new CanonicalName.root();
     if (sdkSummary != null) {
+      if (options.nnbdMode == NnbdMode.Strong &&
+          !(sdkSummary.mode == NonNullableByDefaultCompiledMode.Strong ||
+              sdkSummary.mode == NonNullableByDefaultCompiledMode.Agnostic)) {
+        throw new FormatException(
+            'Provided SDK .dill does not support sound null safety.');
+      }
       dillTarget.loader.appendLibraries(sdkSummary);
     }
 
     for (Component additionalDill
         in await options.loadAdditionalDills(nameRoot)) {
+      if (options.nnbdMode == NnbdMode.Strong &&
+          !(additionalDill.mode == NonNullableByDefaultCompiledMode.Strong ||
+              // In some VM tests the SDK dill appears as an additionalDill so
+              // allow agnostic here as well.
+              additionalDill.mode ==
+                  NonNullableByDefaultCompiledMode.Agnostic)) {
+        throw new FormatException(
+            'Provided .dill file for the following libraries does not support '
+            'sound null safety:\n'
+            '${additionalDill.libraries.join('\n')}');
+      }
       loadedComponents.add(additionalDill);
       dillTarget.loader.appendLibraries(additionalDill);
     }
@@ -122,6 +142,23 @@
       trimmedSummaryComponent.metadata.addAll(summaryComponent.metadata);
       trimmedSummaryComponent.uriToSource.addAll(summaryComponent.uriToSource);
 
+      NonNullableByDefaultCompiledMode compiledMode =
+          NonNullableByDefaultCompiledMode.Disabled;
+      switch (options.nnbdMode) {
+        case NnbdMode.Weak:
+          compiledMode = NonNullableByDefaultCompiledMode.Weak;
+          break;
+        case NnbdMode.Strong:
+          compiledMode = NonNullableByDefaultCompiledMode.Strong;
+          break;
+        case NnbdMode.Agnostic:
+          compiledMode = NonNullableByDefaultCompiledMode.Agnostic;
+          break;
+      }
+
+      trimmedSummaryComponent.setMainMethodAndMode(
+          trimmedSummaryComponent.mainMethodName, false, compiledMode);
+
       // As documented, we only run outline transformations when we are building
       // summaries without building a full component (at this time, that's
       // the only need we have for these transformations).
diff --git a/pkg/front_end/test/fasta/analyze_test.dart b/pkg/front_end/test/fasta/analyze_test.dart
index 9c9a96e..cf52a50 100644
--- a/pkg/front_end/test/fasta/analyze_test.dart
+++ b/pkg/front_end/test/fasta/analyze_test.dart
@@ -8,7 +8,7 @@
   // This method is async, but keeps a port open to prevent the VM from exiting
   // prematurely.
   // Note: if you change this file, also change
-  // tests/compiler/dart2js/fasta_analyze_test.dart.
+  // pkg/compiler/test/analyses/analyze_test.dart
   return testing.main(
       <String>["--config=pkg/front_end/testing.json", "--verbose", "analyze"]);
 }
diff --git a/pkg/front_end/test/fasta/parser/parser.status b/pkg/front_end/test/fasta/parser/parser.status
index 741a8c4..821a4ba 100644
--- a/pkg/front_end/test/fasta/parser/parser.status
+++ b/pkg/front_end/test/fasta/parser/parser.status
@@ -5,6 +5,7 @@
 issue23520: Fail
 issue28367: Fail
 pkg/analyzer_cli/test/data/file_with_error: Fail
+pkg/compiler/test/data/one_line_dart_program: Fail
 pkg/front_end/test/fasta/function_type_recovery: Fail
 pkg/front_end/test/fasta/rasta/bad_interpolation: Fail
 pkg/front_end/test/fasta/rasta/issue_000032: Fail
@@ -1643,7 +1644,6 @@
 tests/compiler/dart2js_native/subclassing_type_test: Fail
 tests/compiler/dart2js_native/super_call_test: Fail
 tests/compiler/dart2js_native/super_property_test: Fail
-tests/compiler/dart2js/data/one_line_dart_program: Fail
 tests/corelib_strong/from_environment_const_type_test: Fail
 tests/corelib_strong/from_environment_const_type_undefined_test: Fail
 tests/corelib_strong/symbol_reserved_word_test: Fail
diff --git a/pkg/front_end/test/fasta/types/shared_type_tests.dart b/pkg/front_end/test/fasta/types/shared_type_tests.dart
index 55d81db..37a43e8 100644
--- a/pkg/front_end/test/fasta/types/shared_type_tests.dart
+++ b/pkg/front_end/test/fasta/types/shared_type_tests.dart
@@ -983,7 +983,7 @@
     isNotSubtype('void', 'Id<Null>*');
 
     // The following function type tests are derived from
-    // ../../../../../tests/compiler/dart2js/model/subtype_test.dart.
+    // ../../../../../pkg/compiler/test/model/subtype_test.dart.
     isSubtype("() ->* int*", 'Function*');
     isNotSubtype('Function*', "() ->* int*");
 
diff --git a/pkg/front_end/test/id_testing/data/marker.options b/pkg/front_end/test/id_testing/data/marker.options
index c846376b..3d73dc4 100644
--- a/pkg/front_end/test/id_testing/data/marker.options
+++ b/pkg/front_end/test/id_testing/data/marker.options
@@ -1,3 +1,3 @@
 cfe=pkg/front_end/test/id_testing/id_testing_test.dart
-dart2js=tests/compiler/dart2js/equivalence/id_testing_test.dart
-dart2js:nnbd-sdk=tests/compiler/dart2js/equivalence/id_testing_test.dart
+dart2js=pkg/compiler/test/equivalence/id_testing_test.dart
+dart2js:nnbd-sdk=pkg/compiler/test/equivalence/id_testing_test.dart
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index 7159767..7b80392 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -23,6 +23,7 @@
 allocations
 alt
 amortized
+analyses
 anon
 aoo
 approval
diff --git a/pkg/frontend_server/lib/frontend_server.dart b/pkg/frontend_server/lib/frontend_server.dart
index f5ccbf0..b60277f 100644
--- a/pkg/frontend_server/lib/frontend_server.dart
+++ b/pkg/frontend_server/lib/frontend_server.dart
@@ -60,7 +60,7 @@
       defaultsTo: false)
   ..addFlag('tree-shake-write-only-fields',
       help: 'Enable tree shaking of fields which are only written in AOT mode.',
-      defaultsTo: false)
+      defaultsTo: true)
   ..addFlag('protobuf-tree-shaker',
       help: 'Enable protobuf tree shaker transformation in AOT mode.',
       defaultsTo: false)
@@ -336,7 +336,6 @@
 
   IncrementalCompiler _generator;
   JavaScriptBundler _bundler;
-  Component _component;
 
   String _kernelBinaryFilename;
   String _kernelBinaryFilenameIncremental;
@@ -349,6 +348,30 @@
 
   final List<String> errors = List<String>();
 
+  _onDiagnostic(DiagnosticMessage message) {
+    bool printMessage;
+    switch (message.severity) {
+      case Severity.error:
+      case Severity.internalProblem:
+        printMessage = true;
+        errors.addAll(message.plainTextFormatted);
+        break;
+      case Severity.warning:
+        printMessage = true;
+        break;
+      case Severity.context:
+      case Severity.ignored:
+        throw 'Unexpected severity: ${message.severity}';
+    }
+    if (printMessage) {
+      printDiagnosticMessage(message, _outputStream.writeln);
+    }
+  }
+
+  void _installDartdevcTarget() {
+    targets['dartdevc'] = (TargetFlags flags) => DevCompilerTarget(flags);
+  }
+
   @override
   Future<bool> compile(
     String entryPoint,
@@ -387,25 +410,7 @@
           onError: (msg) => errors.add(msg))
       ..nnbdMode =
           (options['null-safety'] == true) ? NnbdMode.Strong : NnbdMode.Weak
-      ..onDiagnostic = (DiagnosticMessage message) {
-        bool printMessage;
-        switch (message.severity) {
-          case Severity.error:
-          case Severity.internalProblem:
-            printMessage = true;
-            errors.addAll(message.plainTextFormatted);
-            break;
-          case Severity.warning:
-            printMessage = true;
-            break;
-          case Severity.context:
-          case Severity.ignored:
-            throw 'Unexpected severity: ${message.severity}';
-        }
-        if (printMessage) {
-          printDiagnosticMessage(message, _outputStream.writeln);
-        }
-      };
+      ..onDiagnostic = _onDiagnostic;
 
     if (options.wasParsed('libraries-spec')) {
       compilerOptions.librariesSpecificationUri =
@@ -461,7 +466,7 @@
     )..parseCommandLineFlags(options['bytecode-options']);
 
     // Initialize additional supported kernel targets.
-    targets['dartdevc'] = (TargetFlags flags) => DevCompilerTarget(flags);
+    _installDartdevcTarget();
     compilerOptions.target = createFrontEndTarget(
       options['target'],
       trackWidgetCreation: options['track-widget-creation'],
@@ -510,8 +515,6 @@
           component.uriToSource.keys);
 
       incrementalSerializer = _generator.incrementalSerializer;
-      _component = component;
-      _component.computeCanonicalNames();
     } else {
       if (options['link-platform']) {
         // TODO(aam): Remove linkedDependencies once platform is directly embedded
@@ -554,8 +557,10 @@
       }
 
       _kernelBinaryFilename = _kernelBinaryFilenameIncremental;
-    } else
+    } else {
       _outputStream.writeln(boundaryKey);
+    }
+    results = null; // Fix leak: Probably variation of http://dartbug.com/36983.
     return errors.isEmpty;
   }
 
@@ -935,9 +940,10 @@
     _outputStream.writeln('result $boundaryKey');
 
     var kernel2jsCompiler = _bundler.compilers[moduleName];
-
+    Component component = _generator.lastKnownGoodComponent;
+    component.computeCanonicalNames();
     var evaluator = new ExpressionCompiler(
-        _generator.generator, kernel2jsCompiler, _component,
+        _generator.generator, kernel2jsCompiler, component,
         verbose: _compilerOptions.verbose,
         onDiagnostic: _compilerOptions.onDiagnostic);
 
diff --git a/pkg/frontend_server/test/src/javascript_bundle_test.dart b/pkg/frontend_server/test/src/javascript_bundle_test.dart
index c24aa9e..7c5a12d 100644
--- a/pkg/frontend_server/test/src/javascript_bundle_test.dart
+++ b/pkg/frontend_server/test/src/javascript_bundle_test.dart
@@ -241,10 +241,17 @@
     final manifest = json.decode(utf8.decode(manifestSink.buffer));
 
     // There should only be two modules since C and B should be combined.
-    const moduleHeader = r"define(['dart_sdk'], function(dart_sdk) {";
-
+    final moduleHeader = r"define(['dart_sdk'], (function load__";
     expect(moduleHeader.allMatches(code), hasLength(2));
 
+    // Expected module headers.
+    final aModuleHeader =
+        r"define(['dart_sdk'], (function load__a_dart(dart_sdk) {";
+    expect(code, contains(aModuleHeader));
+    final cModuleHeader =
+        r"define(['dart_sdk'], (function load__c_dart(dart_sdk) {";
+    expect(code, contains(cModuleHeader));
+
     // verify source map url is correct.
     expect(code, contains('sourceMappingURL=a.dart.lib.js.map'));
 
diff --git a/pkg/nnbd_migration/bin/steamroll_ecosystem.dart b/pkg/nnbd_migration/bin/steamroll_ecosystem.dart
deleted file mode 100644
index 341eca2..0000000
--- a/pkg/nnbd_migration/bin/steamroll_ecosystem.dart
+++ /dev/null
@@ -1,163 +0,0 @@
-// 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 'dart:io';
-
-import 'package:args/args.dart';
-
-/// This binary can generate and update an integrated workspace for upgrading
-/// individual packages and their dependencies simultaneously.
-
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace.dart';
-import 'package:path/path.dart' as path;
-
-final parser = ArgParser()
-  ..addMultiOption('extra-packages', abbr: 'e', splitCommas: true)
-  ..addOption('package-name', abbr: 'p')
-  ..addFlag('allow-update',
-      defaultsTo: false,
-      negatable: true,
-      help:
-          'Try to update an existing repository in place.  Does not work for unclean repositories.')
-  ..addFlag('analysis-options-hack', defaultsTo: true, negatable: true)
-  ..addFlag('strip-sdk-constraint-hack', defaultsTo: true, negatable: true)
-  ..addFlag('force-migrate-deps',
-      defaultsTo: false,
-      negatable: true,
-      help:
-          'Use dart migrate to force-update all dependencies (lib/ directory only).')
-  ..addFlag('force-migrate-package',
-      defaultsTo: false,
-      negatable: true,
-      help: 'Use dart migrate to force-update the base package (from root).')
-  ..addFlag('force-migrate-extras',
-      defaultsTo: false,
-      negatable: true,
-      help: 'Use dart migrate to force-update extra packages (from root).')
-  ..addOption('analyze-results',
-      defaultsTo: 'full',
-      allowed: ['full', 'none', 'all'],
-      allowedHelp: {
-        'full': 'Analyze only fully migrated packages',
-        'none': 'Do not analyze migrated packages',
-        'all': 'Analyze fully and partially migrated packages'
-      },
-      help: 'Use the command line analyzer to analyze migrated packages.')
-  ..addFlag('help', abbr: 'h');
-
-Future<void> main(List<String> args) async {
-  ArgResults results = parser.parse(args);
-
-  if (results['help'] as bool) {
-    _showHelp(null, useStdError: false);
-    exit(0);
-  }
-
-  if (results.rest.length != 1) {
-    _showHelp('error: only one argument allowed for workspace directory');
-    exit(1);
-  }
-
-  List<String> extraPackages = results['extra-packages'] as List<String>;
-  String packageName = results['package-name'] as String;
-
-  if (packageName == null) {
-    _showHelp('error: --package_name required');
-    exit(1);
-  }
-  assert(packageName != null);
-  assert(extraPackages != null);
-
-  FantasyWorkspace workspace = await buildFantasyLand(
-      packageName,
-      extraPackages,
-      path.canonicalize(results.rest.first),
-      results['allow-update'] as bool);
-  workspace.makeAllSymlinks();
-
-  if (results['analysis-options-hack'] as bool) {
-    await Future.wait([
-      for (FantasySubPackage p in workspace.subPackages.values)
-        p.enableExperimentHack()
-    ]);
-  }
-
-  Set<FantasySubPackage> upgradedSubPackages = {};
-  Set<FantasySubPackage> upgradedSubPackagesLibOnly = {};
-
-  if (results['force-migrate-deps'] as bool ||
-      results['force-migrate-package'] as bool ||
-      results['force-migrate-extras'] as bool) {
-    if (results['force-migrate-package'] as bool) {
-      upgradedSubPackages.addAll(
-          workspace.subPackages.values.where((s) => s.name == packageName));
-    }
-
-    if (results['force-migrate-extras'] as bool) {
-      upgradedSubPackages.addAll(workspace.subPackages.values
-          .where((s) => extraPackages.contains(s.name)));
-    }
-
-    if (results['force-migrate-deps'] as bool) {
-      upgradedSubPackagesLibOnly.addAll(workspace.subPackages.values.where(
-          (s) => s.name != packageName && !extraPackages.contains(s.name)));
-    }
-
-    if (!await workspace
-        .forceMigratePackages(upgradedSubPackages, upgradedSubPackagesLibOnly, [
-      Platform.resolvedExecutable,
-      path.normalize(path.join(Platform.script.toFilePath(), '..', '..', '..',
-          'dartdev', 'bin', 'dartdev.dart'))
-    ])) {
-      stderr.writeln('//// Everything already upgraded.');
-    }
-  }
-
-  if (results['strip-sdk-constraint-hack'] as bool) {
-    await Future.wait([
-      for (FantasySubPackage p
-          in upgradedSubPackages.followedBy(upgradedSubPackagesLibOnly))
-        () async {
-          await p.removeSdkConstraintHack();
-          await workspace.rewritePackageConfigWith(p);
-        }()
-    ]);
-  }
-
-  if (results['analyze-results'] != 'none') {
-    Iterable<FantasySubPackage> subPackages = upgradedSubPackages;
-    Iterable<FantasySubPackage> subPackagesLibOnly = [];
-    if (results['analyze-results'] == 'all') {
-      subPackagesLibOnly = upgradedSubPackagesLibOnly;
-    }
-    await workspace.analyzePackages(subPackages, subPackagesLibOnly, [
-      Platform.resolvedExecutable,
-      path.normalize(path.join(Platform.script.toFilePath(), '..', '..', '..',
-          'analyzer_cli', 'bin', 'analyzer.dart'))
-    ]);
-  }
-}
-
-// TODO(jcollins-g): add symbolic link support to analyzer filesystem.
-extension _Symlinks on FantasyWorkspace {
-  void makeAllSymlinks() {
-    for (var package in subPackages.values) {
-      Link l = Link(path.join(workspaceRootPath, package.name));
-      if (!l.existsSync()) {
-        l.createSync(
-            path.relative(package.packageRoot.path, from: workspaceRootPath));
-      }
-    }
-  }
-}
-
-void _showHelp(String message, {bool useStdError = true}) {
-  var writer = useStdError ? stderr : stdout;
-
-  writer.writeln(message ?? '');
-  writer.writeln(
-      'Usage: dart ${Platform.script.toFilePath()} [options] workspace_dir');
-  writer.writeln();
-  writer.writeln(parser.usage);
-}
diff --git a/pkg/nnbd_migration/lib/instrumentation.dart b/pkg/nnbd_migration/lib/instrumentation.dart
index 7c7c68e..187ffff 100644
--- a/pkg/nnbd_migration/lib/instrumentation.dart
+++ b/pkg/nnbd_migration/lib/instrumentation.dart
@@ -33,6 +33,15 @@
         location.columnNumber, _computeEnclosingName(node));
   }
 
+  factory CodeReference.fromElement(
+      Element element, LineInfo Function(String) getLineInfo) {
+    var path = element.source.fullName;
+    var offset = element.nameOffset;
+    var location = getLineInfo(path).getLocation(offset);
+    return CodeReference(path, offset, location.lineNumber,
+        location.columnNumber, _computeElementFullName(element));
+  }
+
   CodeReference.fromJson(dynamic json)
       : path = json['path'] as String,
         offset = json['offset'] as int,
@@ -66,6 +75,26 @@
     return '${function ?? 'unknown'} ($pathAsUri:$line:$column)';
   }
 
+  static String _computeElementFullName(Element element) {
+    List<String> parts = [];
+    while (element != null) {
+      var elementName = _computeElementName(element);
+      if (elementName != null) {
+        parts.add(elementName);
+      }
+      element = element.enclosingElement;
+    }
+    if (parts.isEmpty) return null;
+    return parts.reversed.join('.');
+  }
+
+  static String _computeElementName(Element element) {
+    if (element is CompilationUnitElement || element is LibraryElement) {
+      return null;
+    }
+    return element.name;
+  }
+
   static String _computeEnclosingName(AstNode node) {
     List<String> parts = [];
     while (node != null) {
diff --git a/pkg/nnbd_migration/lib/migration_cli.dart b/pkg/nnbd_migration/lib/migration_cli.dart
index a313f3c..d1883c0 100644
--- a/pkg/nnbd_migration/lib/migration_cli.dart
+++ b/pkg/nnbd_migration/lib/migration_cli.dart
@@ -81,22 +81,28 @@
 
 @visibleForTesting
 class DependencyChecker {
+  static final _pubName = Platform.isWindows ? 'pub.bat' : 'pub';
+
+  /// The directory which contains the package being migrated.
+  final String _directory;
   final Context _pathContext;
   final Logger _logger;
   final ProcessManager _processManager;
 
-  DependencyChecker(this._pathContext, this._logger, this._processManager);
+  DependencyChecker(
+      this._directory, this._pathContext, this._logger, this._processManager);
 
   bool check() {
-    var pubPath = _pathContext.join(getSdkPath(), 'bin', 'pub');
-    var result = _processManager
-        .runSync(pubPath, ['outdated', '--mode=null-safety', '--json']);
+    var pubPath = _pathContext.join(getSdkPath(), 'bin', _pubName);
+    var result = _processManager.runSync(
+        pubPath, ['outdated', '--mode=null-safety', '--json'],
+        workingDirectory: _directory);
 
     var preNullSafetyPackages = <String, String>{};
     try {
       if ((result.stderr as String).isNotEmpty) {
         throw FormatException(
-            '`pub outdated --mode=null-safety` exited with exit code '
+            '`$_pubName outdated --mode=null-safety` exited with exit code '
             '${result.exitCode} and stderr:\n\n${result.stderr}');
       }
       var outdatedOutput = jsonDecode(result.stdout as String);
@@ -141,8 +147,8 @@
       }
       _logger.stderr('');
       _logger.stderr('It is highly recommended to upgrade all dependencies to '
-          'versions which have migrated. Use `pub outdated --mode=null-safety` '
-          'to check the status of dependencies. Visit '
+          'versions which have migrated. Use `$_pubName outdated '
+          '--mode=null-safety` to check the status of dependencies. Visit '
           'https://dart.dev/tools/pub/cmd/pub-outdated for more information.');
       _logger.stderr('');
       _logger.stderr('Force migration with --skip-outdated-dependencies-check '
@@ -157,7 +163,7 @@
       return map[key];
     }
     throw FormatException(
-        'Unexpected `pub outdated` JSON output: missing key ($key)', map);
+        'Unexpected `$_pubName outdated` JSON output: missing key ($key)', map);
   }
 
   T _expectType<T>(Object object, String errorKey) {
@@ -165,7 +171,7 @@
       return object;
     }
     throw FormatException(
-        'Unexpected `pub outdated` JSON output: expected a '
+        'Unexpected `$_pubName outdated` JSON output: expected a '
         '$T at "$errorKey", but got a ${object.runtimeType}',
         object);
   }
@@ -373,7 +379,8 @@
       _fixCodeProcessor = _FixCodeProcessor(context, this);
       _dartFixListener =
           DartFixListener(DriverProviderImpl(resourceProvider, context));
-      nonNullableFix = NonNullableFix(_dartFixListener, resourceProvider,
+      nonNullableFix = NonNullableFix(
+          _dartFixListener, resourceProvider, _fixCodeProcessor.getLineInfo,
           included: [options.directory],
           preferredPort: options.previewPort,
           enablePreview: options.webPreview,
@@ -480,8 +487,9 @@
   }
 
   void _checkDependencies() {
-    var successful =
-        DependencyChecker(pathContext, logger, processManager).check();
+    var successful = DependencyChecker(
+            options.directory, pathContext, logger, processManager)
+        .check();
     if (!successful) {
       exitCode = 1;
     }
@@ -701,7 +709,8 @@
   const factory ProcessManager.system() = SystemProcessManager;
 
   /// Run a process synchronously, as in [Process.runSync].
-  ProcessResult runSync(String executable, List<String> arguments);
+  ProcessResult runSync(String executable, List<String> arguments,
+      {String workingDirectory});
 }
 
 /// A [ProcessManager] that directs all method calls to static methods of
@@ -709,8 +718,10 @@
 class SystemProcessManager implements ProcessManager {
   const SystemProcessManager();
 
-  ProcessResult runSync(String executable, List<String> arguments) =>
-      Process.runSync(executable, arguments);
+  ProcessResult runSync(String executable, List<String> arguments,
+          {String workingDirectory}) =>
+      Process.runSync(executable, arguments,
+          workingDirectory: workingDirectory ?? Directory.current.path);
 }
 
 class _BadArgException implements Exception {
@@ -736,6 +747,9 @@
   _FixCodeProcessor(this.context, this._migrationCli)
       : pathsToProcess = _computePathsToProcess(context);
 
+  LineInfo getLineInfo(String path) =>
+      context.currentSession.getFile(path).lineInfo;
+
   void prepareToRerun() {
     var driver = context.driver;
     pathsToProcess = _computePathsToProcess(context);
diff --git a/pkg/nnbd_migration/lib/nnbd_migration.dart b/pkg/nnbd_migration/lib/nnbd_migration.dart
index 613c600..5be23ba 100644
--- a/pkg/nnbd_migration/lib/nnbd_migration.dart
+++ b/pkg/nnbd_migration/lib/nnbd_migration.dart
@@ -285,6 +285,7 @@
   /// should be warned about or removed (in the way specified by
   /// [removeViaComments]).
   factory NullabilityMigration(NullabilityMigrationListener listener,
+      LineInfo Function(String) getLineInfo,
       {bool permissive,
       NullabilityMigrationInstrumentation instrumentation,
       bool removeViaComments,
diff --git a/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart b/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
index 2277fb3..f034fd8 100644
--- a/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
+++ b/pkg/nnbd_migration/lib/src/already_migrated_code_decorator.dart
@@ -6,6 +6,7 @@
 import 'package:analyzer/dart/element/nullability_suffix.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/dart/element/type_provider.dart';
+import 'package:analyzer/source/line_info.dart';
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:nnbd_migration/src/decorated_type.dart';
 import 'package:nnbd_migration/src/edge_origin.dart';
@@ -20,7 +21,10 @@
 
   final TypeProvider _typeProvider;
 
-  AlreadyMigratedCodeDecorator(this._graph, this._typeProvider);
+  final LineInfo Function(String) _getLineInfo;
+
+  AlreadyMigratedCodeDecorator(
+      this._graph, this._typeProvider, this._getLineInfo);
 
   /// Transforms [type], which should have come from code that has already been
   /// migrated to NNBD, into the corresponding [DecoratedType].
@@ -111,7 +115,7 @@
     }
     return [
       for (var t in allSupertypes)
-        decorate(t, class_, NullabilityNodeTarget.element(class_))
+        decorate(t, class_, NullabilityNodeTarget.element(class_, _getLineInfo))
     ];
   }
 }
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo.dart
deleted file mode 100644
index 7c1e43b..0000000
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo.dart
+++ /dev/null
@@ -1,123 +0,0 @@
-// 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/file_system/file_system.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo_impl.dart';
-
-const githubHost = 'git@github.com';
-
-final Map<String, FantasyRepoSettings> _repoTable = {
-  'archive':
-      FantasyRepoSettings('archive', '$githubHost:brendan-duncan/archive.git'),
-  'build_verify': FantasyRepoSettings(
-      'build_verify', '$githubHost:brendan-duncan/build_verify.git'),
-  'build_version': FantasyRepoSettings(
-      'build_version', '$githubHost:kevmoo/build_version.git'),
-  'csv': FantasyRepoSettings('csv', '$githubHost:close2/csv.git'),
-  'git': FantasyRepoSettings('git', '$githubHost:kevmoo/git.git'),
-  'node-interop': FantasyRepoSettings(
-      'node-interop', '$githubHost:pulyaevskiy/node-interop.git'),
-  'node_preamble': FantasyRepoSettings(
-      'node_preamble', '$githubHost:mbullington/node_preamble.dart.git'),
-  'package_config': FantasyRepoSettings(
-      'package_config',
-      '$githubHost:dart-lang/package_config',
-      'master',
-      '3401e2897b3cf46e64966e2ba19ed7032501cf41'),
-  'source_gen_test': FantasyRepoSettings(
-      'source_gen_test', '$githubHost:kevmoo/source_gen_test.git'),
-  'quiver-dart':
-      FantasyRepoSettings('quiver-dart', '$githubHost:google/quiver-dart.git'),
-  'uuid': FantasyRepoSettings('uuid', '$githubHost:Daegalus/dart-uuid.git'),
-};
-
-class FantasyRepoCloneException extends FantasyRepoException {
-  FantasyRepoCloneException(String message) : super(message);
-
-  String toString() {
-    if (message == null) return "FantasyRepoCloneException";
-    return "FantasyRepoCloneException: $message";
-  }
-}
-
-class FantasyRepoUpdateException extends FantasyRepoException {
-  FantasyRepoUpdateException(String message) : super(message);
-
-  String toString() {
-    if (message == null) return "FantasyRepoUpdateException";
-    return "FantasyRepoUpdateException: $message";
-  }
-}
-
-class FantasyRepoException implements Exception {
-  final message;
-
-  FantasyRepoException(this.message);
-
-  String toString() {
-    if (message == null) return "FantasyRepoException";
-    return "FantasyRepoException: $message";
-  }
-}
-
-/// Data class to contain settings for a given repository.
-///
-/// A repository can be referred to by one or more [FantasySubPackageSettings].
-class FantasyRepoSettings {
-  final String name;
-  final String clone;
-  final String branch;
-  final String revision;
-
-  FantasyRepoSettings(this.name, this.clone,
-      // TODO(jcollins-g): revision should follow master
-      [this.branch = 'master',
-      this.revision = 'master']);
-
-  static RegExp _dotDart = RegExp(r'[.]dart$');
-
-  /// Build repository settings from a hard-coded repository name.
-  factory FantasyRepoSettings.fromName(String repoName) {
-    if (_repoTable.containsKey(repoName)) {
-      return _repoTable[repoName];
-    }
-    if (_dotDart.hasMatch(repoName)) {
-      return FantasyRepoSettings(repoName, '$githubHost:google/$repoName.git');
-    }
-    return FantasyRepoSettings(
-        repoName, '$githubHost:dart-lang/$repoName.git', 'master', 'master');
-  }
-
-  @override
-  int get hashCode => toString().hashCode;
-
-  @override
-  bool operator ==(other) {
-    return other is FantasyRepoSettings &&
-        (other.name == name &&
-            other.clone == clone &&
-            other.branch == branch &&
-            other.revision == revision);
-  }
-
-  @override
-  String toString() =>
-      'FantasyRepoSettings("$name", "$clone", "$branch", "$revision")';
-}
-
-/// Base class for all repository types.
-abstract class FantasyRepo {
-  String get name;
-  FantasyRepoSettings get repoSettings;
-  Folder get repoRoot;
-
-  static Future<FantasyRepo> buildGitRepoFrom(
-      FantasyRepoSettings repoSettings, String repoRootPath, bool allowUpdate,
-      {FantasyRepoDependencies fantasyRepoDependencies}) async {
-    FantasyRepoGitImpl newRepo = FantasyRepoGitImpl(repoSettings, repoRootPath,
-        fantasyRepoDependencies: fantasyRepoDependencies);
-    await newRepo.init(allowUpdate);
-    return newRepo;
-  }
-}
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo_impl.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo_impl.dart
deleted file mode 100644
index 9f96d5e..0000000
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_repo_impl.dart
+++ /dev/null
@@ -1,140 +0,0 @@
-// 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 'dart:io' show ProcessException;
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace_impl.dart';
-import 'package:nnbd_migration/src/utilities/subprocess_launcher.dart';
-
-const _httpGithub = 'https://github.com';
-
-class FantasyRepoDependencies {
-  final ResourceProvider resourceProvider;
-  final SubprocessLauncher launcher;
-
-  FantasyRepoDependencies(
-      {ResourceProvider resourceProvider,
-      String name,
-      SubprocessLauncher launcher})
-      : resourceProvider =
-            resourceProvider ?? PhysicalResourceProvider.INSTANCE,
-        launcher = launcher ??
-            SubprocessLauncher(
-                'FantasyRepo.${name == null ? "buildFrom" : "buildFrom-$name"}');
-
-  factory FantasyRepoDependencies.fromWorkspaceDependencies(
-      FantasyWorkspaceDependencies workspaceDependencies) {
-    return FantasyRepoDependencies(
-        resourceProvider: workspaceDependencies.resourceProvider,
-        launcher: workspaceDependencies.launcher);
-  }
-}
-
-/// Represent a single git clone that may be referred to by one or more
-/// [FantasySubPackage]s.
-class FantasyRepoGitImpl extends FantasyRepo {
-  final String name;
-  final FantasyRepoSettings repoSettings;
-  final String _repoRootPath;
-  Folder get repoRoot => _external.resourceProvider.getFolder(_repoRootPath);
-  final FantasyRepoDependencies _external;
-
-  FantasyRepoGitImpl(this.repoSettings, this._repoRootPath,
-      {FantasyRepoDependencies fantasyRepoDependencies})
-      : name = repoSettings.name,
-        _external = fantasyRepoDependencies ??
-            FantasyRepoDependencies(name: repoSettings.name);
-
-  bool _isInitialized = false;
-
-  /// Call exactly once per [FantasyRepoGitImpl].
-  ///
-  /// May throw [FantasyRepoException] in the event of problems and does
-  /// not clean up filesystem state.
-  Future<void> init([bool allowUpdate = true]) async {
-    assert(_isInitialized == false);
-    if (repoRoot.exists && allowUpdate) {
-      await _update(_external.launcher);
-      // TODO(jcollins-g): handle "update" of pinned revision edge case
-    } else if (!repoRoot.exists) {
-      await _clone(_external.launcher);
-    }
-    _isInitialized = true;
-    return;
-  }
-
-  /// Configure a git repository locally and initialize it.
-  ///
-  /// Throws [FantasyRepoCloneException] in the event we can not finish
-  /// initializing.
-  Future<void> _clone(SubprocessLauncher launcher) async {
-    assert(_isInitialized == false);
-    repoRoot.parent.create();
-    String instance = repoSettings.name;
-    await launcher.runStreamed('git', ['init', repoRoot.path],
-        instance: instance);
-    await launcher.runStreamed(
-        'git',
-        [
-          'remote',
-          'add',
-          'origin',
-          '-t',
-          repoSettings.branch,
-          repoSettings.clone
-        ],
-        workingDirectory: repoRoot.path,
-        instance: instance);
-
-    String cloneHttp =
-        repoSettings.clone.replaceFirst('$githubHost:', '$_httpGithub/');
-    await launcher.runStreamed('git',
-        ['remote', 'add', 'originHTTP', '-t', repoSettings.branch, cloneHttp],
-        workingDirectory: repoRoot.path, instance: instance);
-
-    // Do not get the working directory wrong on this command or it could
-    // alter a user's repository config based on the CWD, which is bad.  Other
-    // commands in [FantasyRepo] will not fail silently with permanent,
-    // confusing results, but this one can.
-    await launcher.runStreamed('git', ['config', 'core.sparsecheckout', 'true'],
-        workingDirectory: repoRoot.path, instance: instance);
-
-    File sparseCheckout = _external.resourceProvider.getFile(_external
-        .resourceProvider.pathContext
-        .join(repoRoot.path, '.git', 'info', 'sparse-checkout'));
-    sparseCheckout.writeAsStringSync([
-      '**\n',
-      '!**/.packages\n',
-      '!**/pubspec.lock\n',
-      '!**/.dart_tool/package_config.json\n'
-    ].join());
-    List<String> args = ['pull'];
-    if (repoSettings.revision == 'master') {
-      args.add('--depth=1');
-    }
-    args.addAll(['--rebase', 'originHTTP', repoSettings.revision]);
-    await launcher.runStreamed('git', args,
-        workingDirectory: repoRoot.path, retries: 5, instance: instance);
-  }
-
-  Future<void> _update(SubprocessLauncher launcher) async {
-    assert(_isInitialized == false);
-    try {
-      await launcher.runStreamed(
-          'git', ['pull', '--rebase', 'originHTTP', repoSettings.revision],
-          workingDirectory: repoRoot.path,
-          retries: 5,
-          instance: repoSettings.name);
-    } catch (e) {
-      if (e is ProcessException) {
-        throw FantasyRepoUpdateException(
-            'Unable to update clone for: $repoSettings');
-      }
-      rethrow;
-    }
-  }
-}
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_sub_package.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_sub_package.dart
deleted file mode 100644
index 0d67e57..0000000
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_sub_package.dart
+++ /dev/null
@@ -1,426 +0,0 @@
-// 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_plugin/protocol/protocol_common.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:analyzer/src/dart/analysis/experiments.dart';
-import 'package:analyzer/src/hint/sdk_constraint_extractor.dart';
-import 'package:analyzer/src/lint/pub.dart';
-import 'package:analyzer/src/task/options.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace_impl.dart';
-import 'package:path/path.dart' as path;
-import 'package:pub/src/package_config.dart';
-import 'package:pub_semver/pub_semver.dart';
-import 'package:source_span/source_span.dart';
-import 'package:yaml/yaml.dart';
-
-final Map<String, FantasySubPackageSettings> _subPackageTable = {
-  '_fe_analyzer_shared': FantasySubPackageSettings(
-      '_fe_analyzer_shared', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', '_fe_analyzer_shared')),
-  'analysis_tool': FantasySubPackageSettings(
-      'analysis_tool', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'analysis_tool')),
-  'analyzer': FantasySubPackageSettings(
-      'analyzer', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'analyzer')),
-  'build': FantasySubPackageSettings(
-      'build', FantasyRepoSettings.fromName('build'),
-      subDir: 'build'),
-  'build_config': FantasySubPackageSettings(
-      'build_config', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_config'),
-  'build_daemon': FantasySubPackageSettings(
-      'build_daemon', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_daemon'),
-  'build_integration': FantasySubPackageSettings(
-      'build_integration', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'build_integration')),
-  'build_modules': FantasySubPackageSettings(
-      'build_modules', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_modules'),
-  'build_node_compilers': FantasySubPackageSettings(
-      'build_node_compilers', FantasyRepoSettings.fromName('node-interop'),
-      subDir: 'build_node_compilers'),
-  'build_resolvers': FantasySubPackageSettings(
-      'build_resolvers', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_resolvers'),
-  'build_runner': FantasySubPackageSettings(
-      'build_runner', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_runner'),
-  'build_runner_core': FantasySubPackageSettings(
-      'build_runner_core', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_runner_core'),
-  'build_test': FantasySubPackageSettings(
-      'build_test', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_test'),
-  'build_vm_compilers': FantasySubPackageSettings(
-      'build_vm_compilers', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_vm_compilers'),
-  'build_web_compilers': FantasySubPackageSettings(
-      'build_web_compilers', FantasyRepoSettings.fromName('build'),
-      subDir: 'build_web_compilers'),
-  'built_collection': FantasySubPackageSettings('built_collection',
-      FantasyRepoSettings.fromName('built_collection.dart')),
-  'built_value': FantasySubPackageSettings(
-      'built_value', FantasyRepoSettings.fromName('built_value.dart'),
-      subDir: 'built_value'),
-  'built_value_generator': FantasySubPackageSettings(
-      'built_value_generator', FantasyRepoSettings.fromName('built_value.dart'),
-      subDir: 'built_value_generator'),
-  'checked_yaml': FantasySubPackageSettings(
-      'checked_yaml', FantasyRepoSettings.fromName('json_serializable'),
-      subDir: 'checked_yaml'),
-  'expect': FantasySubPackageSettings(
-      'expect', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'expect')),
-  'front_end': FantasySubPackageSettings(
-      'front_end', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'front_end')),
-  'grinder': FantasySubPackageSettings(
-      'grinder', FantasyRepoSettings.fromName('grinder.dart')),
-  'kernel': FantasySubPackageSettings(
-      'kernel', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'kernel')),
-  'meta': FantasySubPackageSettings('meta', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'meta')),
-  'node_interop': FantasySubPackageSettings(
-      'node_interop', FantasyRepoSettings.fromName('node-interop'),
-      subDir: 'node_interop'),
-  'node_io': FantasySubPackageSettings(
-      'node_io', FantasyRepoSettings.fromName('node-interop'),
-      subDir: 'node_io'),
-  'js': FantasySubPackageSettings('js', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'js')),
-  'json_annotation': FantasySubPackageSettings(
-      'json_annotation', FantasyRepoSettings.fromName('json_serializable'),
-      subDir: 'json_annotation'),
-  'json_serializable': FantasySubPackageSettings(
-      'json_serializable', FantasyRepoSettings.fromName('json_serializable'),
-      subDir: 'json_serializable'),
-  'package_config': FantasySubPackageSettings(
-      'package_config', FantasyRepoSettings.fromName('package_config')),
-  'protobuf': FantasySubPackageSettings(
-      'protobuf', FantasyRepoSettings.fromName('protobuf'),
-      subDir: 'protobuf'),
-  'scratch_space': FantasySubPackageSettings(
-      'scratch_space', FantasyRepoSettings.fromName('build'),
-      subDir: 'scratch_space'),
-  'source_gen': FantasySubPackageSettings(
-      'source_gen', FantasyRepoSettings.fromName('source_gen'),
-      subDir: 'source_gen'),
-  'source_gen_test': FantasySubPackageSettings(
-      'source_gen_test', FantasyRepoSettings.fromName('source_gen_test')),
-  'test': FantasySubPackageSettings(
-      'test', FantasyRepoSettings.fromName('test'),
-      subDir: path.join('pkgs', 'test')),
-  'test_api': FantasySubPackageSettings(
-      'test_api', FantasyRepoSettings.fromName('test'),
-      subDir: path.join('pkgs', 'test_api')),
-  'test_core': FantasySubPackageSettings(
-      'test_core', FantasyRepoSettings.fromName('test'),
-      subDir: path.join('pkgs', 'test_core')),
-  'testing': FantasySubPackageSettings(
-      'testing', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'testing')),
-  'vm_service': FantasySubPackageSettings(
-      'vm_service', FantasyRepoSettings.fromName('sdk'),
-      subDir: path.join('pkg', 'vm_service')),
-  'quiver': FantasySubPackageSettings(
-      'quiver', FantasyRepoSettings.fromName('quiver-dart')),
-  'webkit_inspection_protocol': FantasySubPackageSettings(
-      'webkit_inspection_protocol',
-      FantasyRepoSettings.fromName('webkit_inspection_protocol.dart')),
-};
-
-/// Data class containing settings for a package within a [FantasyWorkspaceImpl].
-class FantasySubPackageSettings {
-  final String name;
-  final FantasyRepoSettings repoSettings;
-  final String subDir;
-
-  FantasySubPackageSettings(this.name, this.repoSettings, {this.subDir: '.'});
-
-  /// Build settings just from a name in a mostly-hardcoded table.
-  factory FantasySubPackageSettings.fromName(String name) {
-    if (_subPackageTable.containsKey(name)) {
-      return _subPackageTable[name];
-    }
-    return FantasySubPackageSettings(name, FantasyRepoSettings.fromName(name));
-  }
-
-  /// Build [FantasySubPackageSettings] from the dependency of a given subPackage.
-  factory FantasySubPackageSettings.fromDependency(
-      FantasySubPackage subPackage, PSDependency dependency) {
-    if (dependency.host != null)
-      throw UnimplementedError(
-          'fromDependency: contains a host field:  $dependency');
-    if (dependency.git != null)
-      throw UnimplementedError(
-          'fromDependency: contains a git field:  $dependency');
-    if (dependency.path != null) {
-      return FantasySubPackageSettings.fromNested(
-          dependency.name.text, subPackage, dependency.path.value.text);
-    }
-    // Hopefully, a version is declared at least... but if not proceed onward
-    // and hope building from name works if we aren't running with asserts.
-    assert(dependency.version != null);
-    return FantasySubPackageSettings.fromName(dependency.name.text);
-  }
-
-  /// Build settings for a nested package based on the repository settings
-  /// of an existing package.
-  ///
-  /// [subDir] is resolved relative to [parent.packageRoot].
-  factory FantasySubPackageSettings.fromNested(
-      String name, FantasySubPackage parent, String subDir) {
-    var pathContext = parent.resourceProvider.pathContext;
-    String nestedSubdir;
-    if (pathContext.isRelative(subDir)) {
-      nestedSubdir = pathContext
-          .normalize(pathContext.join(parent.packageRoot.path, subDir));
-    } else {
-      nestedSubdir = pathContext.normalize(subDir);
-    }
-    assert(pathContext.isWithin(parent.packageRoot.path, nestedSubdir));
-    return FantasySubPackageSettings(name, parent.containingRepo.repoSettings,
-        subDir: pathContext.relative(nestedSubdir,
-            from: parent.containingRepo.repoRoot.path));
-  }
-
-  @override
-  int get hashCode => toString().hashCode;
-
-  @override
-  bool operator ==(other) {
-    return other is FantasySubPackageSettings &&
-        (other.name == name &&
-            other.repoSettings == repoSettings &&
-            other.subDir == subDir);
-  }
-
-  @override
-  String toString() =>
-      'FantasySubPackageSettings("$name", ${repoSettings.toString()}, "$subDir")';
-}
-
-class _AccumulateDependenciesVisitor<T> extends PubspecVisitor {
-  final T Function(PSDependency) transformDependency;
-  final List<T> results = [];
-
-  _AccumulateDependenciesVisitor(this.transformDependency);
-
-  void visitPackageDependency(PSDependency dependency) =>
-      results.add(transformDependency(dependency));
-}
-
-class _AccumulateAllDependenciesVisitor<T>
-    extends _AccumulateDependenciesVisitor<T> {
-  _AccumulateAllDependenciesVisitor(
-      T Function(PSDependency) transformDependency)
-      : super(transformDependency);
-
-  void visitPackageDevDependency(PSDependency dependency) =>
-      results.add(transformDependency(dependency));
-}
-
-class FantasySubPackageDependencies {
-  final ResourceProvider resourceProvider;
-  File Function(String) get fileBuilder => resourceProvider.getFile;
-
-  FantasySubPackageDependencies({ResourceProvider resourceProvider})
-      : resourceProvider =
-            resourceProvider ?? PhysicalResourceProvider.INSTANCE;
-
-  factory FantasySubPackageDependencies.fromWorkspaceDependencies(
-      FantasyWorkspaceDependencies workspaceDependencies) {
-    return FantasySubPackageDependencies(
-        resourceProvider: workspaceDependencies.resourceProvider);
-  }
-}
-
-/// Represents one package within a [FantasyWorkspaceImpl].
-///
-/// A `FantasySubPackage` differs from a normal package in that Dart code within
-/// it depends on a global .packages file to resolve symbols.
-class FantasySubPackage {
-  final FantasyRepo containingRepo;
-  final String name;
-  final FantasySubPackageSettings packageSettings;
-  final ResourceProvider resourceProvider;
-
-  FantasySubPackage(this.packageSettings, this.containingRepo,
-      {ResourceProvider resourceProvider})
-      : name = packageSettings.name,
-        resourceProvider =
-            resourceProvider ?? PhysicalResourceProvider.INSTANCE;
-
-  Folder _packageRoot;
-  Folder get packageRoot => _packageRoot ??= resourceProvider.getFolder(
-      resourceProvider.pathContext.normalize(resourceProvider.pathContext
-          .join(containingRepo.repoRoot.path, packageSettings.subDir)));
-
-  String get languageVersion => extractLanguageVersion(versionConstraint);
-
-  VersionConstraint _versionConstraint;
-  VersionConstraint get versionConstraint =>
-      _versionConstraint ??= SdkConstraintExtractor(pubspecYaml).constraint();
-
-  File _pubspecYaml;
-  File get pubspecYaml => _pubspecYaml ??= resourceProvider.getFile(
-      resourceProvider.pathContext.join(packageRoot.path, 'pubspec.yaml'));
-
-  Future<void> _acceptPubspecVisitor<T>(
-      PubspecVisitor<T> pubspecVisitor) async {
-    if (!pubspecYaml.exists) return;
-    Pubspec pubspec = Pubspec.parse(pubspecYaml.readAsStringSync(),
-        sourceUrl: resourceProvider.pathContext.toUri(pubspecYaml.path));
-    pubspec.accept(pubspecVisitor);
-  }
-
-  Future<List<FantasySubPackageSettings>> getPackageDependencies() async {
-    var visitor = _AccumulateDependenciesVisitor(
-        (d) => FantasySubPackageSettings.fromDependency(this, d));
-    await _acceptPubspecVisitor(visitor);
-    return visitor.results;
-  }
-
-  Future<List<FantasySubPackageSettings>> getPackageAllDependencies() async {
-    var visitor = _AccumulateAllDependenciesVisitor(
-        (d) => FantasySubPackageSettings.fromDependency(this, d));
-    await _acceptPubspecVisitor(visitor);
-    return visitor.results;
-  }
-
-  /// Delete any `pub get` output that interferes with a workspace.
-  Future<void> cleanUp() async {
-    File pubspecLock = packageRoot.getChildAssumingFile('pubspec.lock');
-    File dotPackages = packageRoot.getChildAssumingFile('.packages');
-    Folder dartTool = packageRoot.getChildAssumingFolder('.dart_tool');
-    File packageConfigJson =
-        dartTool.getChildAssumingFile('package_config.json');
-    for (File f in [pubspecLock, dotPackages, packageConfigJson]) {
-      if (f.exists) f.delete();
-    }
-  }
-
-  void processYamlException(String operation, path, exception) {
-    // TODO(jcollins-g): implement
-  }
-
-  static final RegExp _sdkConstraint = RegExp(r'^\s+sdk:\s+.*');
-
-  Future<void> removeSdkConstraintHack() async {
-    if (pubspecYaml.exists) {
-      List<String> lines = pubspecYaml.readAsStringSync().split('\n');
-      lines = lines.where((l) => !_sdkConstraint.hasMatch(l)).toList();
-      pubspecYaml.writeAsStringSync(lines.join('\n'));
-    }
-    _pubspecYaml = null;
-    _versionConstraint = null;
-  }
-
-  /// Modify all analysis_options.yaml file to include the nullability
-  /// experiment.
-  Future<void> enableExperimentHack() async {
-    // This is completely bonkers, cut and paste from non_nullable_fix.dart.
-    // But it is temporary, right?
-    // TODO(jcollins-g): Remove this hack once no longer needed.
-    File optionsFile =
-        packageRoot.getChildAssumingFile('analysis_options.yaml');
-    SourceChange sourceChange =
-        SourceChange('fantasy_sub_package-experimenthack-$name');
-    String optionsContent;
-    YamlNode optionsMap;
-    if (optionsFile.exists) {
-      try {
-        optionsContent = optionsFile.readAsStringSync();
-      } on FileSystemException catch (e) {
-        processYamlException('read', optionsFile.path, e);
-        return;
-      }
-      try {
-        optionsMap = loadYaml(optionsContent) as YamlNode;
-      } on YamlException catch (e) {
-        processYamlException('parse', optionsFile.path, e);
-        return;
-      }
-    }
-
-    SourceSpan parentSpan;
-    String content;
-    YamlNode analyzerOptions;
-    if (optionsMap is YamlMap) {
-      analyzerOptions = optionsMap.nodes[AnalyzerOptions.analyzer];
-    }
-    if (analyzerOptions == null) {
-      var start = SourceLocation(0, line: 0, column: 0);
-      parentSpan = SourceSpan(start, start, '');
-      content = '''
-analyzer:
-  enable-experiment:
-    - non-nullable
-
-''';
-    } else if (analyzerOptions is YamlMap) {
-      YamlNode experiments =
-          analyzerOptions.nodes[AnalyzerOptions.enableExperiment];
-      if (experiments == null) {
-        parentSpan = analyzerOptions.span;
-        content = '''
-
-  enable-experiment:
-    - non-nullable''';
-      } else if (experiments is YamlList) {
-        experiments.nodes.firstWhere(
-          (node) => node.span.text == EnableString.non_nullable,
-          orElse: () {
-            parentSpan = experiments.span;
-            content = '''
-
-    - non-nullable''';
-            return null;
-          },
-        );
-      }
-    }
-
-    if (parentSpan != null) {
-      final space = ' '.codeUnitAt(0);
-      final cr = '\r'.codeUnitAt(0);
-      final lf = '\n'.codeUnitAt(0);
-
-      int offset = parentSpan.end.offset;
-      while (offset > 0) {
-        int ch = optionsContent.codeUnitAt(offset - 1);
-        if (ch == space || ch == cr) {
-          --offset;
-        } else if (ch == lf) {
-          --offset;
-        } else {
-          break;
-        }
-      }
-      SourceFileEdit fileEdit = SourceFileEdit(optionsFile.path, 0,
-          edits: [SourceEdit(offset, 0, content)]);
-      for (SourceEdit sourceEdit in fileEdit.edits) {
-        sourceChange.addEdit(fileEdit.file, fileEdit.fileStamp, sourceEdit);
-      }
-    }
-    _applyEdits(sourceChange);
-  }
-
-  void _applyEdits(SourceChange sourceChange) {
-    for (var fileEdit in sourceChange.edits) {
-      File toEdit = packageRoot.getChildAssumingFile(fileEdit.file);
-      String contents = toEdit.exists ? toEdit.readAsStringSync() : '';
-      for (SourceEdit edit in fileEdit.edits) {
-        contents = edit.apply(contents);
-      }
-      toEdit.writeAsStringSync(contents);
-    }
-  }
-}
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace.dart
deleted file mode 100644
index 87a39e7..0000000
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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:nnbd_migration/src/fantasyland/fantasy_sub_package.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace_impl.dart';
-
-export 'package:nnbd_migration/src/fantasyland/fantasy_sub_package.dart';
-
-/// Represent a single [FantasyWorkspace].
-abstract class FantasyWorkspace {
-  String get workspaceRootPath;
-
-  /// Fully initialized subpackages.
-  Map<FantasySubPackageSettings, FantasySubPackage> subPackages;
-
-  /// Add a package to the workspace, given [packageSettings].
-  ///
-  /// Completes when the repository and subPackage is added.
-  /// If allowUpdate is true, the repository may be updated to the latest
-  /// version.
-  Future<FantasySubPackage> addPackageToWorkspace(
-      FantasySubPackageSettings packageSettings, bool allowUpdate);
-
-  /// Run the dart analyzer over these packages.
-  ///
-  /// Assumes they have been migrated.
-  Future<void> analyzePackages(
-      Iterable<FantasySubPackage> subPackages,
-      Iterable<FantasySubPackage> subPackagesLibOnly,
-      List<String> dartanalyzerExec);
-
-  /// Force-migrate these packages.
-  ///
-  /// All [subPackages] must be part of this workspace.  Returned future
-  /// completes when all [subPackages] have been migrated.  Completes with
-  /// `true` if packages needed to be migrated, `false` if skipped.
-  Future<bool> forceMigratePackages(Iterable<FantasySubPackage> subPackages,
-      Iterable<FantasySubPackage> subPackagesLibOnly, List<String> dartdevExec);
-
-  /// Rewrite the package_config.json and/or .packages for this package.
-  Future<void> rewritePackageConfigWith(FantasySubPackage subPackage);
-}
-
-/// Build a "fantasyland"-style repository structure suitable for applying
-/// a migration to.
-Future<FantasyWorkspace> buildFantasyLand(String topLevelPackage,
-    List<String> extraPackages, String fantasyLandDir, bool allowUpdate) {
-  return FantasyWorkspaceTopLevelDevDepsImpl.buildFor(
-      topLevelPackage, extraPackages, fantasyLandDir, allowUpdate);
-}
diff --git a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace_impl.dart b/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace_impl.dart
deleted file mode 100644
index 4888a3f..0000000
--- a/pkg/nnbd_migration/lib/src/fantasyland/fantasy_workspace_impl.dart
+++ /dev/null
@@ -1,352 +0,0 @@
-// 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 'dart:convert';
-import 'dart:io';
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo_impl.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_sub_package.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace.dart';
-import 'package:nnbd_migration/src/utilities/multi_future_tracker.dart';
-import 'package:nnbd_migration/src/utilities/subprocess_launcher.dart';
-import 'package:path/path.dart' as path;
-
-class FantasyWorkspaceError extends Error {
-  final String message;
-
-  FantasyWorkspaceError(this.message);
-
-  @override
-  String toString() => message;
-}
-
-// TODO(jcollins-g): consider refactor that makes resourceProvider required.
-class FantasyWorkspaceDependencies {
-  final Future<FantasyRepo> Function(FantasyRepoSettings, String, bool,
-      {FantasyRepoDependencies fantasyRepoDependencies}) buildGitRepoFrom;
-  final ResourceProvider resourceProvider;
-  final SubprocessLauncher launcher;
-
-  FantasyWorkspaceDependencies(
-      {ResourceProvider resourceProvider,
-      SubprocessLauncher launcher,
-      Future<FantasyRepo> Function(FantasyRepoSettings, String, bool,
-              {FantasyRepoDependencies fantasyRepoDependencies})
-          buildGitRepoFrom,
-      List<String> dartdevExec})
-      : resourceProvider =
-            resourceProvider ?? PhysicalResourceProvider.INSTANCE,
-        launcher = launcher ?? SubprocessLauncher('fantasy-workspace'),
-        buildGitRepoFrom = buildGitRepoFrom ?? FantasyRepo.buildGitRepoFrom;
-}
-
-abstract class FantasyWorkspaceBase extends FantasyWorkspace {
-  final String workspaceRootPath;
-
-  final FantasyWorkspaceDependencies _external;
-
-  FantasyWorkspaceBase._(this.workspaceRootPath,
-      {FantasyWorkspaceDependencies workspaceDependencies})
-      : _external = workspaceDependencies ?? FantasyWorkspaceDependencies() {
-    if (!_external.resourceProvider.pathContext.isAbsolute(workspaceRootPath)) {
-      throw FantasyWorkspaceError('workspaceRootPath must be absolute');
-    }
-  }
-
-  MultiFutureTracker _packageConfigLock = MultiFutureTracker(1);
-
-  /// Repositories on which [addRepoToWorkspace] has been called.
-  Map<String, Future<FantasyRepo>> _repos = {};
-
-  /// Fully initialized subpackages.
-  ///
-  /// This is complete once all [addPackageNameToWorkspace] futures are complete.
-  /// futures are complete.  Packages may appear here early.
-  Map<FantasySubPackageSettings, FantasySubPackage> subPackages = {};
-
-  File _packagesFile;
-
-  File get packagesFile => _packagesFile ??= _external.resourceProvider.getFile(
-      _external.resourceProvider.pathContext
-          .join(workspaceRootPath, '.packages'));
-
-  File _packageConfigJson;
-
-  File get packageConfigJson => _packageConfigJson ??=
-      _external.resourceProvider.getFile(_external.resourceProvider.pathContext
-          .join(workspaceRootPath, '.dart_tool', 'package_config.json'));
-
-  File _migratedPackagesFile;
-
-  // TODO(jcollins-g): Remove this hack once a good way of determining whether
-  // a package is already migrated is available. (and our front-end implements it)
-  File get migratedPackagesFile => _migratedPackagesFile ??=
-      _external.resourceProvider.getFile(_external.resourceProvider.pathContext
-          .join(workspaceRootPath, '.steamroller_already_migrated'));
-
-  Set<String> _migratedPackagePaths;
-
-  Set<String> get migratedPackagePaths =>
-      _migratedPackagePaths ??= migratedPackagesFile.exists
-          ? migratedPackagesFile.readAsStringSync().split('\n').toSet()
-          : Set();
-
-  /// Call this after migration has completed successfully for [packages].
-  void packagesMigrated(Iterable<FantasySubPackage> packages) {
-    // TODO(jcollins-g): Remove this hack once a reliable way of determining whether
-    // a package is already migrated is available (and our front-end implements it)
-    _migratedPackagePaths.addAll(packages.map((p) => p.packageRoot.path));
-    migratedPackagesFile.writeAsStringSync(_migratedPackagePaths.join('\n'));
-  }
-
-  /// The returned future should complete only when this package's repository
-  /// is:
-  ///
-  ///  cloned
-  ///  up to date
-  ///  added to the global .packages
-  ///  symlinked into the workspace
-  ///  has a [FantasySubPackage] assigned to its key in [subPackages].
-  ///
-  /// Returns a list of [FantasySubPackageSettings] that needed to be added as
-  /// dependencies.
-  ///
-  /// Which dependencies are automatically added is implementation dependent.
-  Future<void> addPackageNameToWorkspace(String packageName, bool allowUpdate);
-
-  Future<FantasySubPackage> addPackageToWorkspace(
-      FantasySubPackageSettings packageSettings, bool allowUpdate) async {
-    FantasyRepo containingRepo =
-        await addRepoToWorkspace(packageSettings.repoSettings, allowUpdate);
-    FantasySubPackage fantasySubPackage =
-        FantasySubPackage(packageSettings, containingRepo);
-    // TODO(jcollins-g): throw if double add
-    subPackages[packageSettings] = fantasySubPackage;
-    fantasySubPackage.cleanUp();
-    return fantasySubPackage;
-  }
-
-  @override
-  Future<bool> forceMigratePackages(
-      Iterable<FantasySubPackage> subPackages,
-      Iterable<FantasySubPackage> subPackagesLibOnly,
-      List<String> dartdevExec) async {
-    String dartdevBin = dartdevExec.first;
-    List<String> args = dartdevExec.sublist(1);
-    args.addAll(
-        ['migrate', '--no-web-preview', '--apply-changes', '--ignore-errors']);
-    bool migrationNecessary = false;
-    // TODO(jcollins-g): consider using the package graph to break up and
-    // parallelize dartdev migrate runs
-    for (FantasySubPackage subPackage in subPackages) {
-      if (!migratedPackagePaths.contains(subPackage.packageRoot.path)) {
-        args.add(subPackage.packageRoot.path);
-        migrationNecessary = true;
-      }
-    }
-    for (FantasySubPackage subPackage in subPackagesLibOnly) {
-      if (!migratedPackagePaths.contains(subPackage.packageRoot.path)) {
-        args.add(subPackage.packageRoot.getChildAssumingFolder('lib').path);
-        migrationNecessary = true;
-      }
-    }
-    if (migrationNecessary) {
-      await _external.launcher
-          .runStreamed(dartdevBin, args, instance: 'dartdev');
-    }
-    // Update the file once we're sure it has completed successfully.
-    packagesMigrated(subPackages);
-    packagesMigrated(subPackagesLibOnly);
-    return migrationNecessary;
-  }
-
-  @override
-  Future<void> analyzePackages(
-      Iterable<FantasySubPackage> subPackages,
-      Iterable<FantasySubPackage> subPackagesLibOnly,
-      List<String> dartanalyzerExec) async {
-    var sdkPath = path.dirname(path.dirname(Platform.resolvedExecutable));
-
-    var analyzers = <Future>[];
-    String dartanalyzer_bin = dartanalyzerExec.first;
-    List<String> baseArgs = dartanalyzerExec.sublist(1);
-    baseArgs
-        .addAll(['--enable-experiment=non-nullable', '--dart-sdk=$sdkPath']);
-
-    Future<void> _spawn(
-        FantasySubPackage subPackage, List<String> allArgs) async {
-      return _external.launcher.runStreamed(dartanalyzer_bin, allArgs,
-          workingDirectory: subPackage.packageRoot.path,
-          instance: subPackage.name,
-          allowNonzeroExit: true);
-    }
-
-    for (FantasySubPackage subPackage in subPackages) {
-      List<String> allArgs = baseArgs.followedBy(['.']).toList();
-      analyzers.add(_spawn(subPackage, allArgs));
-    }
-
-    for (FantasySubPackage subPackage in subPackagesLibOnly) {
-      List<String> allArgs = baseArgs.followedBy(['lib']).toList();
-      analyzers.add(_spawn(subPackage, allArgs));
-    }
-    return Future.wait(analyzers);
-  }
-
-  static const _repoSubDir = '_repo';
-
-  /// Add one repository to the workspace.
-  ///
-  /// If allowUpdate is true, the repository will be pulled before being
-  /// synced.
-  ///
-  /// The returned [Future] completes when the repository is synced and cloned.
-  Future<FantasyRepo> addRepoToWorkspace(
-      FantasyRepoSettings repoSettings, bool allowUpdate) {
-    if (_repos.containsKey(repoSettings.name)) return _repos[repoSettings.name];
-    Folder repoRoot = _external.resourceProvider.getFolder(_external
-        .resourceProvider.pathContext
-        .canonicalize(_external.resourceProvider.pathContext
-            .join(workspaceRootPath, _repoSubDir, repoSettings.name)));
-    _repos[repoSettings.name] = _external.buildGitRepoFrom(
-        repoSettings, repoRoot.path, allowUpdate,
-        fantasyRepoDependencies:
-            FantasyRepoDependencies.fromWorkspaceDependencies(_external));
-    return _repos[repoSettings.name];
-  }
-
-  @override
-  Future<void> rewritePackageConfigWith(FantasySubPackage subPackage) async {
-    return _packageConfigLock.runFutureFromClosure(
-        () async => _rewritePackageConfigWith(subPackage));
-  }
-
-  // Only one [_rewritePackageConfigWith] should be running at a time
-  // per workspace.
-  Future<void> _rewritePackageConfigWith(FantasySubPackage subPackage) async {
-    if (packagesFile.exists) {
-      // A rogue .packages file can signal to tools the absence of a
-      // [FantasySubPackage.languageVersion].  This paradoxically will mean
-      // to our tools that all language features, including NNBD, are enabled,
-      // which is not necessarily what we want.  It is safer to delete this to
-      // prevent it from being used accidentally.
-      packagesFile.delete();
-    }
-    Map<String, Object> packageConfigMap = {
-      "configVersion": 2,
-      "packages": <Map<String, String>>[],
-    };
-    if (packageConfigJson.exists) {
-      packageConfigMap = jsonDecode(packageConfigJson.readAsStringSync())
-          as Map<String, Object>;
-    }
-
-    packageConfigMap['generated'] = DateTime.now().toIso8601String();
-    packageConfigMap['generator'] = 'fantasyland';
-    // TODO(jcollins-g): analyzer seems to depend on this and ignore some versions
-    packageConfigMap['generatorVersion'] = "2.8.0-dev.9999.0";
-
-    var packages = packageConfigMap['packages'] as List;
-    var rewriteMe =
-        packages.firstWhere((p) => p['name'] == subPackage.name, orElse: () {
-      Map<String, String> newMap = {};
-      packages.add(newMap);
-      return newMap;
-    });
-
-    rewriteMe['name'] = subPackage.name;
-    String subPackageRootUriString =
-        subPackage.packageRoot.toUri().normalizePath().toString();
-    if (subPackageRootUriString.endsWith('/')) {
-      subPackageRootUriString = subPackageRootUriString.substring(
-          0, subPackageRootUriString.length - 1);
-    }
-    rewriteMe['rootUri'] = subPackageRootUriString;
-    // TODO(jcollins-g): is this ever anything different?
-    rewriteMe['packageUri'] = 'lib/';
-    if (subPackage.languageVersion != null) {
-      rewriteMe['languageVersion'] = subPackage.languageVersion;
-    } else {
-      rewriteMe.remove('languageVersion');
-    }
-
-    packageConfigJson.parent.create();
-    JsonEncoder encoder = new JsonEncoder.withIndent("  ");
-    packageConfigJson.writeAsStringSync(encoder.convert(packageConfigMap));
-  }
-}
-
-/// Represents a [FantasyWorkspaceBase] that only fetches dev_dependencies
-/// for the top level package.
-class FantasyWorkspaceTopLevelDevDepsImpl extends FantasyWorkspaceBase {
-  final String topLevelPackage;
-
-  FantasyWorkspaceTopLevelDevDepsImpl._(
-      this.topLevelPackage, String workspaceRootPath,
-      {FantasyWorkspaceDependencies workspaceDependencies})
-      : super._(workspaceRootPath,
-            workspaceDependencies: workspaceDependencies);
-
-  static Future<FantasyWorkspace> buildFor(
-      String topLevelPackage,
-      List<String> extraPackageNames,
-      String workspaceRootPath,
-      bool allowUpdate,
-      {FantasyWorkspaceDependencies workspaceDependencies}) async {
-    var workspace = FantasyWorkspaceTopLevelDevDepsImpl._(
-        topLevelPackage, workspaceRootPath,
-        workspaceDependencies: workspaceDependencies);
-    await Future.wait([
-      for (var n in [topLevelPackage, ...extraPackageNames])
-        workspace.addPackageNameToWorkspace(n, allowUpdate)
-    ]);
-    return workspace;
-  }
-
-  Future<FantasySubPackage> addPackageNameToWorkspace(
-      String packageName, bool allowUpdate) async {
-    FantasySubPackageSettings packageSettings =
-        FantasySubPackageSettings.fromName(packageName);
-    return await addPackageToWorkspace(packageSettings, allowUpdate);
-  }
-
-  @override
-  Future<FantasySubPackage> addPackageToWorkspace(
-      FantasySubPackageSettings packageSettings, bool allowUpdate,
-      {Set<FantasySubPackageSettings> seenPackages}) async {
-    seenPackages ??= {};
-    if (seenPackages.contains(packageSettings)) return null;
-    seenPackages.add(packageSettings);
-    return await _addPackageToWorkspace(
-        packageSettings, allowUpdate, seenPackages);
-  }
-
-  Future<FantasySubPackage> _addPackageToWorkspace(
-      FantasySubPackageSettings packageSettings,
-      bool allowUpdate,
-      Set<FantasySubPackageSettings> seenPackages) async {
-    FantasySubPackage fantasySubPackage =
-        await super.addPackageToWorkspace(packageSettings, allowUpdate);
-    String packageName = packageSettings.name;
-
-    await rewritePackageConfigWith(fantasySubPackage);
-    List<FantasySubPackageSettings> dependencies = [];
-
-    if (packageName == topLevelPackage) {
-      dependencies = await fantasySubPackage.getPackageAllDependencies();
-    } else {
-      dependencies = await fantasySubPackage.getPackageDependencies();
-    }
-
-    await Future.wait([
-      for (var subPackageSettings in dependencies)
-        addPackageToWorkspace(subPackageSettings, allowUpdate,
-            seenPackages: seenPackages)
-    ]);
-    return fantasySubPackage;
-  }
-}
diff --git a/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart b/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
index 2fa4073..5148f75 100644
--- a/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/non_nullable_fix.dart
@@ -56,6 +56,8 @@
 
   final ResourceProvider resourceProvider;
 
+  final LineInfo Function(String) _getLineInfo;
+
   /// The HTTP server that serves the preview tool.
   HttpPreviewServer _server;
 
@@ -81,7 +83,7 @@
   /// A list of the URLs corresponding to the included roots.
   List<String> previewUrls;
 
-  NonNullableFix(this.listener, this.resourceProvider,
+  NonNullableFix(this.listener, this.resourceProvider, this._getLineInfo,
       {List<String> included = const [],
       this.preferredPort,
       this.enablePreview = true,
@@ -264,7 +266,7 @@
             ? null
             : MigrationSummary(summaryPath, resourceProvider, includedRoot));
     adapter = NullabilityMigrationAdapter(listener);
-    migration = NullabilityMigration(adapter,
+    migration = NullabilityMigration(adapter, _getLineInfo,
         permissive: _usePermissiveMode,
         instrumentation: instrumentationListener);
   }
diff --git a/pkg/nnbd_migration/lib/src/front_end/unit_renderer.dart b/pkg/nnbd_migration/lib/src/front_end/unit_renderer.dart
index 66aec49..2eaa081 100644
--- a/pkg/nnbd_migration/lib/src/front_end/unit_renderer.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/unit_renderer.dart
@@ -100,7 +100,6 @@
   /// The content of the file (not including added links and anchors) will be
   /// HTML-escaped.
   String _computeNavigationContent() {
-    var unitDir = pathContext.dirname(pathMapper.map(unitInfo.path));
     var content = unitInfo.content;
     var mapper = unitInfo.offsetMapper;
     var openInsertions = <int, String>{};
@@ -140,9 +139,7 @@
         if (target.filePath != unitInfo.path ||
             region.offset != target.offset) {
           var openInsertion = openInsertions[openOffset] ?? '';
-          var unitPath = pathContext.relative(pathMapper.map(target.filePath),
-              from: unitDir);
-          var targetUri = _uriForRelativePath(unitPath, target);
+          var targetUri = _uriForPath(pathMapper.map(target.filePath), target);
           openInsertion =
               '<a href="$targetUri" class="nav-link">$openInsertion';
           openInsertions[openOffset] = openInsertion;
@@ -316,11 +313,11 @@
 
   /// Returns the URL that will navigate to the given [target] in the file at
   /// the given [relativePath].
-  String _uriForRelativePath(String relativePath, NavigationTarget target) {
+  String _uriForPath(String path, NavigationTarget target) {
     var queryParams = {
       'offset': target.offset,
       if (target.line != null) 'line': target.line,
     }.entries.map((entry) => '${entry.key}=${entry.value}').join('&');
-    return '$relativePath?$queryParams';
+    return '$path?$queryParams';
   }
 }
diff --git a/pkg/nnbd_migration/lib/src/node_builder.dart b/pkg/nnbd_migration/lib/src/node_builder.dart
index 4c6112b..dd52503 100644
--- a/pkg/nnbd_migration/lib/src/node_builder.dart
+++ b/pkg/nnbd_migration/lib/src/node_builder.dart
@@ -41,6 +41,8 @@
   @override
   final Source source;
 
+  final LineInfo Function(String) _getLineInfo;
+
   /// If the parameters of a function or method are being visited, the
   /// [DecoratedType]s of the function's named parameters that have been seen so
   /// far.  Otherwise `null`.
@@ -65,7 +67,7 @@
   final TypeProvider _typeProvider;
 
   NodeBuilder(this._variables, this.source, this.listener, this._graph,
-      this._typeProvider,
+      this._typeProvider, this._getLineInfo,
       {this.instrumentation});
 
   NullabilityNodeTarget get safeTarget {
@@ -88,7 +90,7 @@
     var exceptionElement = node.exceptionParameter?.staticElement;
     var target = exceptionElement == null
         ? NullabilityNodeTarget.text('exception type')
-        : NullabilityNodeTarget.element(exceptionElement);
+        : NullabilityNodeTarget.element(exceptionElement, _getLineInfo);
     DecoratedType exceptionType = _pushNullabilityNodeTarget(
         target, () => node.exceptionType?.accept(this));
     if (node.exceptionParameter != null) {
@@ -159,7 +161,8 @@
       assert(constructorElement.isSynthetic);
       var decoratedReturnType =
           _createDecoratedTypeForClass(classElement, node);
-      var target = NullabilityNodeTarget.element(constructorElement);
+      var target =
+          NullabilityNodeTarget.element(constructorElement, _getLineInfo);
       var functionType = DecoratedType.forImplicitFunction(
           _typeProvider, constructorElement.type, _graph.never, _graph, target,
           returnType: decoratedReturnType);
@@ -207,7 +210,7 @@
   DecoratedType visitDeclaredIdentifier(DeclaredIdentifier node) {
     node.metadata.accept(this);
     var declaredElement = node.declaredElement;
-    var target = NullabilityNodeTarget.element(declaredElement);
+    var target = NullabilityNodeTarget.element(declaredElement, _getLineInfo);
     DecoratedType type =
         _pushNullabilityNodeTarget(target, () => node.type?.accept(this));
     if (node.identifier != null) {
@@ -256,12 +259,13 @@
 
     for (var item in node.constants) {
       var declaredElement = item.declaredElement;
-      var target = NullabilityNodeTarget.element(declaredElement);
+      var target = NullabilityNodeTarget.element(declaredElement, _getLineInfo);
       _variables.recordDecoratedElementType(declaredElement,
           DecoratedType(classElement.thisType, makeNonNullNode(target, item)));
     }
     final valuesGetter = classElement.getGetter('values');
-    var valuesTarget = NullabilityNodeTarget.element(valuesGetter);
+    var valuesTarget =
+        NullabilityNodeTarget.element(valuesGetter, _getLineInfo);
     _variables.recordDecoratedElementType(
         valuesGetter,
         DecoratedType(valuesGetter.type, makeNonNullNode(valuesTarget),
@@ -272,14 +276,14 @@
                       makeNonNullNode(valuesTarget.typeArgument(0)))
                 ])));
     final indexGetter = classElement.getGetter('index');
-    var indexTarget = NullabilityNodeTarget.element(indexGetter);
+    var indexTarget = NullabilityNodeTarget.element(indexGetter, _getLineInfo);
     _variables.recordDecoratedElementType(
         indexGetter,
         DecoratedType(indexGetter.type, makeNonNullNode(indexTarget),
             returnType: DecoratedType(indexGetter.returnType,
                 makeNonNullNode(indexTarget.returnType()))));
     final toString = classElement.getMethod('toString');
-    var toStringTarget = NullabilityNodeTarget.element(toString);
+    var toStringTarget = NullabilityNodeTarget.element(toString, _getLineInfo);
     _variables.recordDecoratedElementType(
         toString,
         DecoratedType(toString.type, makeNonNullNode(toStringTarget),
@@ -361,7 +365,7 @@
     var functionType = declaredElement.function.type;
     var returnType = node.returnType;
     DecoratedType decoratedReturnType;
-    var target = NullabilityNodeTarget.element(declaredElement);
+    var target = NullabilityNodeTarget.element(declaredElement, _getLineInfo);
     if (returnType != null) {
       _pushNullabilityNodeTarget(target.returnType(), () {
         decoratedReturnType = returnType.accept(this);
@@ -408,7 +412,8 @@
     node.metadata.accept(this);
     DecoratedType decoratedFunctionType;
     node.typeParameters?.accept(this);
-    var target = NullabilityNodeTarget.element(node.declaredElement);
+    var target =
+        NullabilityNodeTarget.element(node.declaredElement, _getLineInfo);
     _pushNullabilityNodeTarget(target, () {
       decoratedFunctionType = node.functionType.accept(this);
     });
@@ -621,7 +626,8 @@
     node.metadata.accept(this);
     var typeAnnotation = node.type;
     var type = _pushNullabilityNodeTarget(
-        NullabilityNodeTarget.element(node.variables.first.declaredElement),
+        NullabilityNodeTarget.element(
+            node.variables.first.declaredElement, _getLineInfo),
         () => typeAnnotation?.accept(this));
     var hint = getPrefixHint(node.firstTokenAfterCommentAndMetadata);
     if (hint != null && hint.kind == HintCommentKind.late_) {
@@ -631,7 +637,8 @@
       variable.metadata.accept(this);
       var declaredElement = variable.declaredElement;
       if (type == null) {
-        var target = NullabilityNodeTarget.element(declaredElement);
+        var target =
+            NullabilityNodeTarget.element(declaredElement, _getLineInfo);
         type = DecoratedType.forImplicitType(
             _typeProvider, declaredElement.type, _graph, target);
         instrumentation?.implicitType(source, node, type);
@@ -673,7 +680,7 @@
     metadata?.accept(this);
     var functionType = declaredElement.type;
     DecoratedType decoratedReturnType;
-    var target = NullabilityNodeTarget.element(declaredElement);
+    var target = NullabilityNodeTarget.element(declaredElement, _getLineInfo);
     if (returnType != null) {
       _pushNullabilityNodeTarget(target.returnType(), () {
         decoratedReturnType = returnType.accept(this);
@@ -831,7 +838,8 @@
     }
     var decoratedSupertypes = <ClassElement, DecoratedType>{};
     _pushNullabilityNodeTarget(
-        NullabilityNodeTarget.element(declaredElement).supertype, () {
+        NullabilityNodeTarget.element(declaredElement, _getLineInfo).supertype,
+        () {
       for (var supertype in supertypes) {
         DecoratedType decoratedSupertype;
         if (supertype == null) {
diff --git a/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart b/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
index dcaff93..077d9e2 100644
--- a/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
+++ b/pkg/nnbd_migration/lib/src/nullability_migration_impl.dart
@@ -56,6 +56,8 @@
   final PostmortemFileWriter _postmortemFileWriter =
       _makePostmortemFileWriter();
 
+  final LineInfo Function(String) _getLineInfo;
+
   /// Prepares to perform nullability migration.
   ///
   /// If [permissive] is `true`, exception handling logic will try to proceed
@@ -70,15 +72,28 @@
   /// should be warned about or removed (in the way specified by
   /// [removeViaComments]).
   NullabilityMigrationImpl(NullabilityMigrationListener listener,
+      LineInfo Function(String) getLineInfo,
       {bool permissive: false,
       NullabilityMigrationInstrumentation instrumentation,
       bool removeViaComments = false,
       bool warnOnWeakCode = true})
-      : this._(listener, NullabilityGraph(instrumentation: instrumentation),
-            permissive, instrumentation, removeViaComments, warnOnWeakCode);
+      : this._(
+            listener,
+            NullabilityGraph(instrumentation: instrumentation),
+            permissive,
+            instrumentation,
+            removeViaComments,
+            warnOnWeakCode,
+            getLineInfo);
 
-  NullabilityMigrationImpl._(this.listener, this._graph, this._permissive,
-      this._instrumentation, this.removeViaComments, this.warnOnWeakCode) {
+  NullabilityMigrationImpl._(
+      this.listener,
+      this._graph,
+      this._permissive,
+      this._instrumentation,
+      this.removeViaComments,
+      this.warnOnWeakCode,
+      this._getLineInfo) {
     _instrumentation?.immutableNodes(_graph.never, _graph.always);
     _postmortemFileWriter?.graph = _graph;
   }
@@ -142,7 +157,7 @@
   void prepareInput(ResolvedUnitResult result) {
     _sanityCheck(result);
     if (_variables == null) {
-      _variables = Variables(_graph, result.typeProvider,
+      _variables = Variables(_graph, result.typeProvider, _getLineInfo,
           instrumentation: _instrumentation,
           postmortemFileWriter: _postmortemFileWriter);
       _decoratedClassHierarchy = DecoratedClassHierarchy(_variables, _graph);
@@ -150,8 +165,13 @@
     var unit = result.unit;
     try {
       DecoratedTypeParameterBounds.current = _decoratedTypeParameterBounds;
-      unit.accept(NodeBuilder(_variables, unit.declaredElement.source,
-          _permissive ? listener : null, _graph, result.typeProvider,
+      unit.accept(NodeBuilder(
+          _variables,
+          unit.declaredElement.source,
+          _permissive ? listener : null,
+          _graph,
+          result.typeProvider,
+          _getLineInfo,
           instrumentation: _instrumentation));
     } finally {
       DecoratedTypeParameterBounds.current = null;
diff --git a/pkg/nnbd_migration/lib/src/nullability_node_target.dart b/pkg/nnbd_migration/lib/src/nullability_node_target.dart
index baa55f6..8b0a9c6 100644
--- a/pkg/nnbd_migration/lib/src/nullability_node_target.dart
+++ b/pkg/nnbd_migration/lib/src/nullability_node_target.dart
@@ -4,6 +4,7 @@
 
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/source/line_info.dart';
 import 'package:nnbd_migration/instrumentation.dart';
 
 String _computeElementName(Element element) {
@@ -28,7 +29,8 @@
 /// code is referenced by a given nullability node.
 abstract class NullabilityNodeTarget {
   /// Creates a [NullabilityNodeTarget] referring to a particular element.
-  factory NullabilityNodeTarget.element(Element element) =
+  factory NullabilityNodeTarget.element(
+          Element element, LineInfo Function(String) getLineInfo) =
       _NullabilityNodeTarget_Element;
 
   /// Creates a [NullabilityNodeTarget] with a simple text description.
@@ -107,8 +109,12 @@
 class _NullabilityNodeTarget_Element extends NullabilityNodeTarget {
   final String name;
 
-  _NullabilityNodeTarget_Element(Element element)
+  final CodeReference codeReference;
+
+  _NullabilityNodeTarget_Element(
+      Element element, LineInfo Function(String) getLineInfo)
       : name = _computeElementName(element),
+        codeReference = CodeReference.fromElement(element, getLineInfo),
         super._();
 
   @override
diff --git a/pkg/nnbd_migration/lib/src/variables.dart b/pkg/nnbd_migration/lib/src/variables.dart
index 1dcac79..5973dcb 100644
--- a/pkg/nnbd_migration/lib/src/variables.dart
+++ b/pkg/nnbd_migration/lib/src/variables.dart
@@ -71,10 +71,12 @@
 
   final PostmortemFileWriter postmortemFileWriter;
 
-  Variables(this._graph, this._typeProvider,
+  final LineInfo Function(String) _getLineInfo;
+
+  Variables(this._graph, this._typeProvider, this._getLineInfo,
       {this.instrumentation, this.postmortemFileWriter})
       : _alreadyMigratedCodeDecorator =
-            AlreadyMigratedCodeDecorator(_graph, _typeProvider);
+            AlreadyMigratedCodeDecorator(_graph, _typeProvider, _getLineInfo);
 
   /// Given a [class_], gets the decorated type information for the superclasses
   /// it directly implements/extends/etc.
@@ -380,7 +382,7 @@
       element = (element as FunctionTypeAliasElement).function;
     }
 
-    var target = NullabilityNodeTarget.element(element);
+    var target = NullabilityNodeTarget.element(element, _getLineInfo);
     if (element is FunctionTypedElement) {
       decoratedType = _alreadyMigratedCodeDecorator.decorate(
           element.preMigrationType, element, target);
diff --git a/pkg/nnbd_migration/pubspec.yaml b/pkg/nnbd_migration/pubspec.yaml
index 4f3b776..f55ed27 100644
--- a/pkg/nnbd_migration/pubspec.yaml
+++ b/pkg/nnbd_migration/pubspec.yaml
@@ -12,4 +12,3 @@
   yaml: any
 dev_dependencies:
   args: ^1.5.2
-  mockito: any
diff --git a/pkg/nnbd_migration/test/abstract_context.dart b/pkg/nnbd_migration/test/abstract_context.dart
index b1ffcc8..f954485 100644
--- a/pkg/nnbd_migration/test/abstract_context.dart
+++ b/pkg/nnbd_migration/test/abstract_context.dart
@@ -119,6 +119,8 @@
     return context.driver;
   }
 
+  LineInfo getLineInfo(String path) => session.getFile(path).lineInfo;
+
   void setUp() {
     setupResourceProvider();
     overlayResourceProvider = OverlayResourceProvider(resourceProvider);
diff --git a/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart b/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart
index 4ed0086..7b5e9ca 100644
--- a/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart
+++ b/pkg/nnbd_migration/test/already_migrated_code_decorator_test.dart
@@ -6,6 +6,7 @@
 import 'package:analyzer/dart/element/nullability_suffix.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/dart/element/type_provider.dart';
+import 'package:analyzer/source/line_info.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/generated/testing/element_factory.dart';
@@ -50,7 +51,8 @@
 
   _AlreadyMigratedCodeDecoratorTestBase._(
       this.suffix, this.graph, this.typeProvider)
-      : decorator = AlreadyMigratedCodeDecorator(graph, typeProvider);
+      : decorator =
+            AlreadyMigratedCodeDecorator(graph, typeProvider, _getLineInfo);
 
   NullabilityNode get always => graph.always;
 
@@ -383,16 +385,21 @@
     var decoratedSupertypes = decorator.getImmediateSupertypes(class_).toList();
     var typeParam = class_.typeParameters[0];
     expect(decoratedSupertypes, hasLength(2));
-    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable, 'Future');
+    // Note: the bogus location `async:1:1` is because we're using a
+    // TestTypeProvider.
+    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable,
+        'Future (async:1:1)');
     // Since Future<T> is a subtype of FutureOr<T>, we consider FutureOr<T> to
     // be an immediate supertype, even though the class declaration for Future
     // doesn't mention FutureOr.
+    // Note: the bogus location `async:1:1` is because we're using a
+    // TestTypeProvider.
     checkFutureOr(
         decoratedSupertypes[1],
         checkExplicitlyNonNullable,
         (t, displayName) => checkTypeParameter(
             t, checkExplicitlyNonNullable, typeParam, displayName),
-        'Future');
+        'Future (async:1:1)');
   }
 
   void test_getImmediateSupertypes_generic() {
@@ -404,6 +411,7 @@
         t.instantiate(nullabilitySuffix: suffix),
       ),
     );
+    class_.enclosingElement = ElementFactory.compilationUnit('test.dart');
     var decoratedSupertypes = decorator.getImmediateSupertypes(class_).toList();
     expect(decoratedSupertypes, hasLength(1));
     checkIterable(
@@ -411,45 +419,57 @@
         checkExplicitlyNonNullable,
         (type, displayName) => checkTypeParameter(
             type, checkExplicitlyNonNullable, t, displayName),
-        'C');
+        'C (test.dart:1:1)');
   }
 
   void test_getImmediateSupertypes_interface() {
     var class_ =
         element = ElementFactory.classElement('C', typeProvider.objectType);
     class_.interfaces = [typeProvider.numType];
+    class_.enclosingElement = ElementFactory.compilationUnit('test.dart');
     var decoratedSupertypes = decorator.getImmediateSupertypes(class_).toList();
     expect(decoratedSupertypes, hasLength(2));
-    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable, 'C');
-    checkNum(decoratedSupertypes[1], checkExplicitlyNonNullable, 'C');
+    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable,
+        'C (test.dart:1:1)');
+    checkNum(decoratedSupertypes[1], checkExplicitlyNonNullable,
+        'C (test.dart:1:1)');
   }
 
   void test_getImmediateSupertypes_mixin() {
     var class_ =
         element = ElementFactory.classElement('C', typeProvider.objectType);
     class_.mixins = [typeProvider.numType];
+    class_.enclosingElement = ElementFactory.compilationUnit('test.dart');
     var decoratedSupertypes = decorator.getImmediateSupertypes(class_).toList();
     expect(decoratedSupertypes, hasLength(2));
-    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable, 'C');
-    checkNum(decoratedSupertypes[1], checkExplicitlyNonNullable, 'C');
+    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable,
+        'C (test.dart:1:1)');
+    checkNum(decoratedSupertypes[1], checkExplicitlyNonNullable,
+        'C (test.dart:1:1)');
   }
 
   void test_getImmediateSupertypes_superclassConstraint() {
     var class_ = element = ElementFactory.mixinElement(
         name: 'C', constraints: [typeProvider.numType]);
+    class_.enclosingElement = ElementFactory.compilationUnit('test.dart');
     var decoratedSupertypes = decorator.getImmediateSupertypes(class_).toList();
     expect(decoratedSupertypes, hasLength(1));
-    checkNum(decoratedSupertypes[0], checkExplicitlyNonNullable, 'C');
+    checkNum(decoratedSupertypes[0], checkExplicitlyNonNullable,
+        'C (test.dart:1:1)');
   }
 
   void test_getImmediateSupertypes_supertype() {
     var class_ =
         element = ElementFactory.classElement('C', typeProvider.objectType);
+    class_.enclosingElement = ElementFactory.compilationUnit('test.dart');
     var decoratedSupertypes = decorator.getImmediateSupertypes(class_).toList();
     expect(decoratedSupertypes, hasLength(1));
     // TODO(paulberry): displayName should be 'Object supertype of C'
-    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable, 'C');
+    checkObject(decoratedSupertypes[0], checkExplicitlyNonNullable,
+        'C (test.dart:1:1)');
   }
+
+  static LineInfo _getLineInfo(String path) => LineInfo([0]);
 }
 
 /// Specialization of [_AlreadyMigratedCodeDecoratorTestBase] for testing the
diff --git a/pkg/nnbd_migration/test/api_test.dart b/pkg/nnbd_migration/test/api_test.dart
index 6047aa9..5522a28 100644
--- a/pkg/nnbd_migration/test/api_test.dart
+++ b/pkg/nnbd_migration/test/api_test.dart
@@ -50,7 +50,7 @@
       driver.getFileSync(newFile(path, content: input[path]).path);
     }
     var listener = new TestMigrationListener();
-    var migration = NullabilityMigration(listener,
+    var migration = NullabilityMigration(listener, getLineInfo,
         permissive: _usePermissiveMode,
         removeViaComments: removeViaComments,
         warnOnWeakCode: warnOnWeakCode);
diff --git a/pkg/nnbd_migration/test/decorated_type_test.dart b/pkg/nnbd_migration/test/decorated_type_test.dart
index b114798..853bf6d 100644
--- a/pkg/nnbd_migration/test/decorated_type_test.dart
+++ b/pkg/nnbd_migration/test/decorated_type_test.dart
@@ -5,6 +5,7 @@
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/dart/element/type_provider.dart';
+import 'package:analyzer/source/line_info.dart';
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/generated/element_type_provider.dart';
 import 'package:analyzer/src/generated/testing/test_type_provider.dart';
@@ -40,7 +41,7 @@
   factory DecoratedTypeTest() {
     var typeProvider = TestTypeProvider();
     var graph = NullabilityGraph();
-    var variables = Variables(graph, typeProvider);
+    var variables = Variables(graph, typeProvider, _getLineInfo);
     return DecoratedTypeTest._(graph, typeProvider, variables);
   }
 
@@ -612,6 +613,8 @@
     var decoratedType = function(dynamic_, positional: [xType], node: always);
     expect(decoratedType.toString(), 'dynamic Function([$xType])?');
   }
+
+  static LineInfo _getLineInfo(String path) => LineInfo([0]);
 }
 
 class _ElementTypeProvider extends ElementTypeProvider {
diff --git a/pkg/nnbd_migration/test/fantasyland/fantasy_repo_test.dart b/pkg/nnbd_migration/test/fantasyland/fantasy_repo_test.dart
deleted file mode 100644
index 3d9e580..0000000
--- a/pkg/nnbd_migration/test/fantasyland/fantasy_repo_test.dart
+++ /dev/null
@@ -1,217 +0,0 @@
-// 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 'dart:io' as io;
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:mockito/mockito.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo_impl.dart';
-import 'package:nnbd_migration/src/utilities/subprocess_launcher.dart';
-import 'package:path/path.dart' as path;
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'src/filesystem_test_base.dart';
-
-main() {
-  defineReflectiveSuite(() {
-    defineReflectiveTests(FantasyRepoSettingsTest);
-    defineReflectiveTests(FantasyRepoE2ETest);
-    defineReflectiveTests(FantasyRepoTest);
-  });
-}
-
-@reflectiveTest
-class FantasyRepoSettingsTest {
-  test_fromNameDefaultCase() {
-    FantasyRepoSettings settings = FantasyRepoSettings.fromName('defaultCase');
-
-    expect(settings.name, equals('defaultCase'));
-    expect(settings.clone, equals('git@github.com:dart-lang/defaultCase.git'));
-    expect(settings.branch, equals('master'));
-    expect(settings.revision, equals('master'));
-  }
-
-  test_fromNameDotDartCase() {
-    FantasyRepoSettings settings =
-        FantasyRepoSettings.fromName('somethingImportant.dart');
-
-    expect(settings.name, equals('somethingImportant.dart'));
-    expect(settings.clone,
-        equals('git@github.com:google/somethingImportant.dart.git'));
-    expect(settings.branch, equals('master'));
-    expect(settings.revision, equals('master'));
-  }
-
-  test_fromNameTableCase() {
-    FantasyRepoSettings settings = FantasyRepoSettings.fromName('git');
-
-    expect(settings.name, equals('git'));
-    expect(settings.clone, equals('git@github.com:kevmoo/git.git'));
-    expect(settings.branch, equals('master'));
-    expect(settings.revision, equals('master'));
-  }
-
-  test_equality() {
-    var test1 = FantasyRepoSettings('one', 'two', 'three', 'four');
-    var test2 = FantasyRepoSettings('one', 'two', 'three', 'four');
-    var test3 = FantasyRepoSettings('one', 'two', 'three', 'five');
-    var test4 = FantasyRepoSettings('one', 'two');
-
-    expect(test1, equals(test2));
-    expect(test1, isNot(equals(test3)));
-    expect(test1, isNot(equals(test4)));
-  }
-}
-
-@reflectiveTest
-class FantasyRepoE2ETest {
-  io.Directory tempDir;
-
-  setUp() async {
-    tempDir = await io.Directory.systemTemp.createTemp('FantasyRepoE2ETest');
-  }
-
-  test_fantasyRepoE2ETest() async {
-    // Only one of these, as they are slow due to the real fork/execs of 'git'.
-    // Check any important edge cases via unit tests and mocking.
-
-    // TODO(jcollins-g): This test is not fully isolated from the global git
-    // config.  Fix that.
-    SubprocessLauncher launcher = SubprocessLauncher('FantasyRepoE2ETest');
-    FantasyRepoDependencies fantasyRepoDependencies =
-        FantasyRepoDependencies(launcher: launcher);
-    io.Directory origRepoDir =
-        io.Directory(path.join(tempDir.path, 'origRepo'));
-
-    // Create and add a commit to origRepoDir that includes a file we should
-    // check out, and others we shouldn't.
-    await launcher.runStreamed('git', ['init', origRepoDir.path]);
-    io.File dotPackages = io.File(path.join(origRepoDir.path, '.packages'));
-    io.File pubspecLock = io.File(path.join(origRepoDir.path, 'pubspec.lock'));
-    io.File pubspecYaml = io.File(path.join(origRepoDir.path, 'pubspec.yaml'));
-    io.File packageConfigJson = io.File(
-        path.join(origRepoDir.path, '.dart_tool', 'package_config.json'));
-    List<io.File> allFiles = [
-      dotPackages,
-      pubspecLock,
-      pubspecYaml,
-      packageConfigJson
-    ];
-    await Future.wait([
-      for (var f in [dotPackages, pubspecLock, pubspecYaml, packageConfigJson])
-        f.create(recursive: true)
-    ]);
-    await launcher.runStreamed(
-        'git', ['add', '-f', ...allFiles.map((f) => path.canonicalize(f.path))],
-        workingDirectory: origRepoDir.path);
-    await launcher.runStreamed('git', ['commit', '-m', 'add some files'],
-        workingDirectory: origRepoDir.path);
-
-    // Use the repo builder to clone this and verify that the right files are
-    // checked out.
-    io.Directory repoRoot = io.Directory(path.join(tempDir.path, 'repoRoot'));
-    await FantasyRepo.buildGitRepoFrom(
-        FantasyRepoSettings('repoE2Etest', origRepoDir.path),
-        repoRoot.path,
-        true,
-        fantasyRepoDependencies: fantasyRepoDependencies);
-
-    dotPackages = io.File(path.join(repoRoot.path, '.packages'));
-    pubspecLock = io.File(path.join(repoRoot.path, 'pubspec.lock'));
-    pubspecYaml = io.File(path.join(repoRoot.path, 'pubspec.yaml'));
-    packageConfigJson =
-        io.File(path.join(repoRoot.path, '.dart_tool', 'package_config.json'));
-
-    expect(await dotPackages.exists(), isFalse);
-    expect(await pubspecLock.exists(), isFalse);
-    expect(await pubspecYaml.exists(), isTrue);
-    expect(await packageConfigJson.exists(), isFalse);
-
-    // Update the original repository.
-    io.File aNewFile =
-        io.File(path.join(origRepoDir.path, 'hello_new_file_here'));
-    await aNewFile.create(recursive: true);
-    await launcher.runStreamed(
-        'git', ['add', '-f', path.canonicalize(aNewFile.path)],
-        workingDirectory: origRepoDir.path);
-    await launcher.runStreamed('git', ['commit', '-m', 'add more files'],
-        workingDirectory: origRepoDir.path);
-
-    // Finally, use the repoBuilder to update a repository from head and verify
-    // we did it right.
-    await FantasyRepo.buildGitRepoFrom(
-        FantasyRepoSettings('repoE2Etest', origRepoDir.path),
-        repoRoot.path,
-        true,
-        fantasyRepoDependencies: fantasyRepoDependencies);
-
-    aNewFile = io.File(path.join(repoRoot.path, 'hello_new_file_here'));
-    expect(await dotPackages.exists(), isFalse);
-    expect(await pubspecLock.exists(), isFalse);
-    expect(await pubspecYaml.exists(), isTrue);
-    expect(await packageConfigJson.exists(), isFalse);
-    expect(await aNewFile.exists(), isTrue);
-  }
-}
-
-@reflectiveTest
-class FantasyRepoTest extends FilesystemTestBase {
-  String parentPath;
-  String repoPath;
-  Folder repoDir;
-  Folder parentDir;
-
-  setUp() {
-    super.setUp();
-    parentPath = convertPath('/parentdir');
-    repoPath = join(parentPath, 'subdir');
-    repoDir = resourceProvider.getFolder(repoPath);
-    parentDir = resourceProvider.getFolder(parentPath);
-  }
-
-  _setUpNewClone(String repoName) async {
-    FantasyRepoSettings settings = FantasyRepoSettings.fromName(repoName);
-    FantasyRepoDependencies fantasyRepoDependencies = FantasyRepoDependencies(
-        launcher: mockLauncher, resourceProvider: resourceProvider);
-    await FantasyRepo.buildGitRepoFrom(settings, repoPath, true,
-        fantasyRepoDependencies: fantasyRepoDependencies);
-  }
-
-  test_checkHttpStringSubstitution() async {
-    await _setUpNewClone('defaultCase');
-    verify(mockLauncher.runStreamed(
-        'git',
-        [
-          'remote',
-          'add',
-          'origin',
-          '-t',
-          'master',
-          'git@github.com:dart-lang/defaultCase.git'
-        ],
-        workingDirectory: repoPath,
-        instance: 'defaultCase'));
-    verify(mockLauncher.runStreamed(
-        'git',
-        [
-          'remote',
-          'add',
-          'originHTTP',
-          '-t',
-          'master',
-          'https://github.com/dart-lang/defaultCase.git'
-        ],
-        workingDirectory: repoPath,
-        instance: 'defaultCase'));
-  }
-
-  test_verifyWorkingDirectoryForGitConfig() async {
-    await _setUpNewClone('defaultCase');
-    verify(mockLauncher.runStreamed(
-        'git', ['config', 'core.sparsecheckout', 'true'],
-        workingDirectory: repoPath, instance: 'defaultCase'));
-  }
-}
diff --git a/pkg/nnbd_migration/test/fantasyland/fantasy_sub_package_test.dart b/pkg/nnbd_migration/test/fantasyland/fantasy_sub_package_test.dart
deleted file mode 100644
index aace8a5..0000000
--- a/pkg/nnbd_migration/test/fantasyland/fantasy_sub_package_test.dart
+++ /dev/null
@@ -1,186 +0,0 @@
-// 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/file_system/file_system.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_sub_package.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace.dart';
-import 'package:path/path.dart' as path;
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'src/filesystem_test_base.dart';
-
-main() {
-  defineReflectiveSuite(() {
-    defineReflectiveTests(FantasySubPackageSettingsTest);
-    defineReflectiveTests(FantasySubPackageTest);
-  });
-}
-
-@reflectiveTest
-class FantasySubPackageSettingsTest {
-  test_settingsFromTable() {
-    var subPackageSettings = FantasySubPackageSettings.fromName('vm_service');
-    expect(subPackageSettings.name, equals('vm_service'));
-    expect(subPackageSettings.repoSettings.name, equals('sdk'));
-    expect(subPackageSettings.subDir, equals(path.join('pkg', 'vm_service')));
-  }
-
-  test_settingsFromTableDefault() {
-    var subPackageSettings =
-        FantasySubPackageSettings.fromName('completely_unknown_package');
-    expect(subPackageSettings.name, equals('completely_unknown_package'));
-    expect(subPackageSettings.repoSettings.name,
-        equals('completely_unknown_package'));
-    expect(subPackageSettings.subDir, equals('.'));
-  }
-
-  test_settingsEqual() {
-    var repo1 = FantasyRepoSettings.fromName('some_repo_somewhere');
-    var repo2 = FantasyRepoSettings.fromName('another_repo_somewhere_else');
-    var test1 = FantasySubPackageSettings('foo', repo1, subDir: '.');
-    var test2 = FantasySubPackageSettings('foo', repo2, subDir: '.');
-    var test3 = FantasySubPackageSettings('foo', repo1,
-        subDir: path.join('pkg', 'something'));
-    var test4 = FantasySubPackageSettings('foobie', repo1);
-    var test5 = FantasySubPackageSettings('foo', repo1);
-
-    expect(test1, equals(test1));
-    expect(test1, isNot(equals(test2)));
-    expect(test1, isNot(equals(test3)));
-    expect(test1, isNot(equals(test4)));
-    expect(test1, equals(test5));
-  }
-}
-
-class FantasyRepoFake extends FantasyRepo {
-  final String name;
-  final FantasyRepoSettings repoSettings;
-  final Folder repoRoot;
-
-  FantasyRepoFake(this.repoSettings, this.repoRoot) : name = repoSettings.name;
-}
-
-@reflectiveTest
-class FantasySubPackageTest extends FilesystemTestBase {
-  FantasyRepoFake fantasyRepo;
-  FantasySubPackage fantasySubPackage;
-  Folder repoRoot;
-  File pubspecYaml;
-  File analysisOptionsYaml;
-
-  setUp() {
-    super.setUp();
-    String repoRootPath = convertPath('/workspace/repo_root');
-    repoRoot = resourceProvider.getFolder(repoRootPath);
-    fantasyRepo = FantasyRepoFake(
-        FantasyRepoSettings('unreal_repo', '', '', ''), repoRoot);
-    // subPackage 'unreal_package' at 'workspace_root/repo_root/unreal_package_dir'.
-    fantasySubPackage = FantasySubPackage(
-        FantasySubPackageSettings('unreal_package', fantasyRepo.repoSettings,
-            subDir: 'unreal_package_dir'),
-        fantasyRepo,
-        resourceProvider: resourceProvider);
-    // the pubspecYaml.
-    pubspecYaml = resourceProvider
-        .getFile(join(repoRootPath, 'unreal_package_dir', 'pubspec.yaml'));
-    analysisOptionsYaml = resourceProvider.getFile(
-        join(repoRootPath, 'unreal_package_dir', 'analysis_options.yaml'));
-  }
-
-  test_removeSdkConstraintHack() async {
-    pubspecYaml.writeAsStringSync('''
-      name: unreal_package
-      version: 1.2.3
-      environment:
-         sdk: '>=2.2.0 <3.0.0'
-    ''');
-    expect(fantasySubPackage.languageVersion, equals('2.2'));
-    await fantasySubPackage.removeSdkConstraintHack();
-    expect(fantasySubPackage.languageVersion, isNull);
-    expect(pubspecYaml.readAsStringSync(), equals('''
-      name: unreal_package
-      version: 1.2.3
-      environment:
-    '''));
-  }
-
-  test_recognizeAllDependencies() async {
-    pubspecYaml.writeAsStringSync('''
-      name: unreal_package
-      version: 1.2.3
-      dependencies:
-        package2:
-          path: correctly/enclosed
-        package3:
-          version: '0.0.0 >= 1.0.0'
-        package4:
-          version: any
-      dev_dependencies:
-        package5:
-          version: any
-    ''');
-    List<FantasySubPackageSettings> dependencies =
-        await fantasySubPackage.getPackageAllDependencies();
-    expect(dependencies.length, equals(4));
-  }
-
-  test_recognizePathSubdir() async {
-    pubspecYaml.writeAsStringSync('''
-      name: unreal_package
-      version: 1.2.3
-      dependencies:
-        package2:
-          path: correctly/enclosed
-    ''');
-    List<FantasySubPackageSettings> dependencies =
-        await fantasySubPackage.getPackageAllDependencies();
-    expect(dependencies.first.name, equals('package2'));
-    expect(dependencies.first.repoSettings.name, equals('unreal_repo'));
-    expect(dependencies.first.subDir,
-        equals(join('unreal_package_dir', 'correctly', 'enclosed')));
-  }
-
-  test_recognizeVersion() async {
-    pubspecYaml.writeAsStringSync('''
-      name: unreal_package
-      version: 1.2.3
-      dependencies:
-        package3:
-          version: '0.0.0 >= 1.0.0'
-    ''');
-    List<FantasySubPackageSettings> dependencies =
-        await fantasySubPackage.getPackageAllDependencies();
-    expect(dependencies.first.name, equals('package3'));
-    expect(dependencies.first.repoSettings.name, equals('package3'));
-    expect(dependencies.first.subDir, equals('.'));
-  }
-
-  @assertFailingTest
-  test_assertOnPathOutsidePackage() async {
-    pubspecYaml.writeAsStringSync('''
-      name: unreal_package
-      version: 1.2.3
-      dependencies:
-        package2:
-          path: ../incorrectly/enclosed
-    ''');
-    await fantasySubPackage.getPackageAllDependencies();
-  }
-
-  test_analysisOptionsCreate() async {
-    pubspecYaml.writeAsStringSync('''
-      name: unreal_package
-    ''');
-    await fantasySubPackage.enableExperimentHack();
-    expect(analysisOptionsYaml.exists, isTrue);
-    expect(
-        analysisOptionsYaml.readAsStringSync(),
-        'analyzer:\n'
-        '  enable-experiment:\n'
-        '    - non-nullable\n'
-        '\n');
-  }
-}
diff --git a/pkg/nnbd_migration/test/fantasyland/fantasy_workspace_test.dart b/pkg/nnbd_migration/test/fantasyland/fantasy_workspace_test.dart
deleted file mode 100644
index ff3ae24..0000000
--- a/pkg/nnbd_migration/test/fantasyland/fantasy_workspace_test.dart
+++ /dev/null
@@ -1,105 +0,0 @@
-// 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 'dart:io';
-
-import 'package:mockito/mockito.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace_impl.dart';
-import 'package:path/path.dart' as path;
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'src/filesystem_test_base.dart';
-
-main() {
-  defineReflectiveSuite(() {
-    defineReflectiveTests(FantasyWorkspaceTest);
-    defineReflectiveTests(FantasyWorkspaceIntegrationTest);
-  });
-}
-
-@reflectiveTest
-class FantasyWorkspaceTest extends FilesystemTestBase {
-  setUp() async {
-    super.setUp();
-  }
-
-  test_fantasyWorkspaceAnalyze() async {
-    FantasyWorkspace testWorkspace =
-        await FantasyWorkspaceTopLevelDevDepsImpl.buildFor(
-            'test_package',
-            ['extra_package_1', 'extra_package_2'],
-            convertPath('/fantasyland'),
-            true,
-            workspaceDependencies: workspaceDependencies);
-    await testWorkspace.analyzePackages(
-        testWorkspace.subPackages.values.where((p) => p.name == 'test_package'),
-        // We are forcing extra_package_1 to be treated as migrated with
-        // 'lib_only' for the purpose of testing.  This would not be the case in
-        // normal steamroll_ecosystem.dart runs.
-        testWorkspace.subPackages.values
-            .where((p) => p.name == 'extra_package_1'),
-        ['dart', 'really_the_analyzer.dart']);
-
-    var sdkPath = path.dirname(path.dirname(Platform.resolvedExecutable));
-    verify(mockLauncher.runStreamed(
-        'dart',
-        [
-          'really_the_analyzer.dart',
-          '--enable-experiment=non-nullable',
-          '--dart-sdk=$sdkPath',
-          '.'
-        ],
-        workingDirectory: convertPath('/fantasyland/_repo/test_package'),
-        instance: 'test_package',
-        allowNonzeroExit: true));
-    verify(mockLauncher.runStreamed(
-        'dart',
-        [
-          'really_the_analyzer.dart',
-          '--enable-experiment=non-nullable',
-          '--dart-sdk=$sdkPath',
-          'lib'
-        ],
-        workingDirectory: convertPath('/fantasyland/_repo/extra_package_1'),
-        instance: 'extra_package_1',
-        allowNonzeroExit: true));
-  }
-}
-
-@reflectiveTest
-class FantasyWorkspaceIntegrationTest extends FilesystemTestBase {
-  FantasyWorkspace workspace;
-
-  setUp() {
-    super.setUp();
-  }
-
-  /// Verify connection between workspace and buildGitRepoFrom.
-  test_fantasyWorkspaceDevDepsImplIntegration() async {
-    workspace = await FantasyWorkspaceTopLevelDevDepsImpl.buildFor(
-        'test_package',
-        ['extra_package_1', 'extra_package_2'],
-        convertPath('/fantasyland'),
-        true,
-        workspaceDependencies: workspaceDependencies);
-    expect(getFolder('/fantasyland').exists, isTrue);
-    for (var n in ['test_package', 'extra_package_1', 'extra_package_2']) {
-      String repoPath = convertPath('/fantasyland/_repo/$n');
-      verify(mockLauncher.runStreamed(
-          'git',
-          [
-            'remote',
-            'add',
-            'origin',
-            '-t',
-            'master',
-            'git@github.com:dart-lang/$n.git'
-          ],
-          workingDirectory: repoPath,
-          instance: n));
-    }
-  }
-}
diff --git a/pkg/nnbd_migration/test/fantasyland/src/filesystem_test_base.dart b/pkg/nnbd_migration/test/fantasyland/src/filesystem_test_base.dart
deleted file mode 100644
index 14878ab..0000000
--- a/pkg/nnbd_migration/test/fantasyland/src/filesystem_test_base.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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/test_utilities/resource_provider_mixin.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_repo_impl.dart';
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace_impl.dart';
-import 'package:nnbd_migration/src/utilities/subprocess_launcher.dart';
-import 'package:mockito/mockito.dart';
-
-class MockSubprocessLauncher extends Mock implements SubprocessLauncher {}
-
-class FilesystemTestBase with ResourceProviderMixin {
-  MockSubprocessLauncher mockLauncher;
-  FantasyRepoDependencies fantasyRepoDependencies;
-  FantasyWorkspaceDependencies workspaceDependencies;
-
-  setUp() {
-    mockLauncher = MockSubprocessLauncher();
-    workspaceDependencies = FantasyWorkspaceDependencies(
-        resourceProvider: resourceProvider, launcher: mockLauncher);
-    fantasyRepoDependencies = FantasyRepoDependencies.fromWorkspaceDependencies(
-        workspaceDependencies);
-  }
-}
diff --git a/pkg/nnbd_migration/test/fantasyland/test_all.dart b/pkg/nnbd_migration/test/fantasyland/test_all.dart
deleted file mode 100644
index fa3036a..0000000
--- a/pkg/nnbd_migration/test/fantasyland/test_all.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'fantasy_repo_test.dart' as fantasy_repo_test;
-import 'fantasy_sub_package_test.dart' as fantasy_sub_package_test;
-import 'fantasy_workspace_test.dart' as fantasy_workspace_test;
-
-main() {
-  defineReflectiveSuite(() {
-    fantasy_repo_test.main();
-    fantasy_sub_package_test.main();
-    fantasy_workspace_test.main();
-  });
-}
diff --git a/pkg/nnbd_migration/test/front_end/analysis_abstract.dart b/pkg/nnbd_migration/test/front_end/analysis_abstract.dart
index 03f98ee..7daaddd 100644
--- a/pkg/nnbd_migration/test/front_end/analysis_abstract.dart
+++ b/pkg/nnbd_migration/test/front_end/analysis_abstract.dart
@@ -10,7 +10,6 @@
 /// An abstract base for all 'analysis' domain tests.
 class AbstractAnalysisTest extends AbstractContextTest
     with ResourceProviderMixin {
-  bool generateSummaryFiles = false;
   String projectPath;
   String testFolder;
   String testFile;
diff --git a/pkg/nnbd_migration/test/front_end/info_builder_test.dart b/pkg/nnbd_migration/test/front_end/info_builder_test.dart
index e03998a..8d7ad3c 100644
--- a/pkg/nnbd_migration/test/front_end/info_builder_test.dart
+++ b/pkg/nnbd_migration/test/front_end/info_builder_test.dart
@@ -1384,8 +1384,8 @@
     assertTraceEntry(unit, entries[1], 'f.y', unit.content.indexOf('x[0]'),
         contains('data flow'));
     // Entry 2 is the nullability of the implicit list element type of x
-    assertTraceEntry(
-        unit, entries[2], null, null, contains('type argument 0 of f.x'));
+    assertTraceEntry(unit, entries[2], 'f.x', unit.content.indexOf('x ='),
+        contains('type argument 0 of f.x'));
     // Entry 3 is the edge from the explicit list element type on the RHS of x
     // to the implicit list element type on the LHS of x
     assertTraceEntry(unit, entries[3], 'f.x', unit.content.indexOf('<int?>[i]'),
diff --git a/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart b/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart
index 6c1d384..76d4c1c 100644
--- a/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart
+++ b/pkg/nnbd_migration/test/front_end/nnbd_migration_test_base.dart
@@ -204,7 +204,7 @@
     var listener = DartFixListener(server);
     var instrumentationListener = InstrumentationListener();
     var adapter = NullabilityMigrationAdapter(listener);
-    var migration = NullabilityMigration(adapter,
+    var migration = NullabilityMigration(adapter, getLineInfo,
         permissive: false,
         instrumentation: instrumentationListener,
         removeViaComments: removeViaComments,
diff --git a/pkg/nnbd_migration/test/instrumentation_test.dart b/pkg/nnbd_migration/test/instrumentation_test.dart
index bf7607c..1193181 100644
--- a/pkg/nnbd_migration/test/instrumentation_test.dart
+++ b/pkg/nnbd_migration/test/instrumentation_test.dart
@@ -60,6 +60,9 @@
   }
 
   @override
+  void finished() {}
+
+  @override
   void graphEdge(EdgeInfo edge, EdgeOriginInfo originInfo) {
     if (edge.destinationNode != test.always) {
       expect(test.edgeOrigin, isNot(contains(edge)));
@@ -102,9 +105,6 @@
   void prepareForUpdate() {
     test.changes = null;
   }
-
-  @override
-  void finished() {}
 }
 
 @reflectiveTest
@@ -143,7 +143,7 @@
     var sourcePath = convertPath('/home/test/lib/test.dart');
     newFile(sourcePath, content: content);
     var listener = new TestMigrationListener();
-    var migration = NullabilityMigration(listener,
+    var migration = NullabilityMigration(listener, getLineInfo,
         instrumentation: _InstrumentationClient(this),
         removeViaComments: removeViaComments,
         warnOnWeakCode: warnOnWeakCode);
diff --git a/pkg/nnbd_migration/test/migration_cli_test.dart b/pkg/nnbd_migration/test/migration_cli_test.dart
index 13635f2..bcd1c0d 100644
--- a/pkg/nnbd_migration/test/migration_cli_test.dart
+++ b/pkg/nnbd_migration/test/migration_cli_test.dart
@@ -16,6 +16,7 @@
 import 'package:nnbd_migration/migration_cli.dart';
 import 'package:nnbd_migration/src/front_end/non_nullable_fix.dart';
 import 'package:nnbd_migration/src/front_end/web/edit_details.dart';
+import 'package:nnbd_migration/src/front_end/web/file_details.dart';
 import 'package:nnbd_migration/src/front_end/web/navigation_tree.dart';
 import 'package:path/path.dart' as path;
 import 'package:test/test.dart';
@@ -149,9 +150,11 @@
     processManager._mockResult = ProcessResult(123 /* pid */,
         pubOutdatedExitCode, pubOutdatedStdout, pubOutdatedStderr);
     logger = _TestLogger(true);
-    var success =
-        DependencyChecker(resourceProvider.pathContext, logger, processManager)
-            .check();
+    var projectContents = simpleProject(sourceText: 'int x;');
+    var projectDir = createProjectDir(projectContents);
+    var success = DependencyChecker(
+            projectDir, resourceProvider.pathContext, logger, processManager)
+        .check();
     expect(success, isFalse);
   }
 
@@ -162,9 +165,11 @@
     processManager._mockResult = ProcessResult(123 /* pid */,
         pubOutdatedExitCode, pubOutdatedStdout, pubOutdatedStderr);
     logger = _TestLogger(true);
-    var success =
-        DependencyChecker(resourceProvider.pathContext, logger, processManager)
-            .check();
+    var projectContents = simpleProject(sourceText: 'int x;');
+    var projectDir = createProjectDir(projectContents);
+    var success = DependencyChecker(
+            projectDir, resourceProvider.pathContext, logger, processManager)
+        .check();
     expect(success, isTrue);
   }
 
@@ -449,6 +454,41 @@
     });
   }
 
+  test_lifecycle_preview_navigation_links() async {
+    var projectContents = simpleProject(sourceText: 'int x;');
+    projectContents['lib/src/test.dart'] = 'import "../test.dart"; int y = x;';
+    var projectDir = await createProjectDir(projectContents);
+    var cli = _createCli();
+    await runWithPreviewServer(cli, [projectDir], (url) async {
+      expect(
+          logger.stdoutBuffer.toString(), contains('No analysis issues found'));
+      await assertPreviewServerResponsive(url);
+      final uri = Uri.parse(url);
+      final authToken = uri.queryParameters['authToken'];
+      final fileResponse = await http.get(
+          uri.replace(
+              path: resourceProvider.pathContext
+                  .toUri(resourceProvider.pathContext
+                      .join(projectDir, 'lib', 'src', 'test.dart'))
+                  .path,
+              queryParameters: {'inline': 'true', 'authToken': authToken}),
+          headers: {'Content-Type': 'application/json; charset=UTF-8'});
+      final fileJson = FileDetails.fromJson(jsonDecode(fileResponse.body));
+      final navigation = fileJson.navigationContent;
+      final aLink = RegExp(r'<a href="([^"]+)" class="nav-link">');
+      for (final match in aLink.allMatches(navigation)) {
+        var href = match.group(1);
+        print(href);
+        final contentsResponse = await http.get(
+            uri.replace(
+                path: Uri.parse(href).path,
+                queryParameters: {'inline': 'true', 'authToken': authToken}),
+            headers: {'Content-Type': 'application/json; charset=UTF-8'});
+        assertHttpSuccess(contentsResponse);
+      }
+    });
+  }
+
   test_lifecycle_preview_navigation_tree() async {
     var projectContents = simpleProject(sourceText: 'int x;');
     var projectDir = await createProjectDir(projectContents);
@@ -1125,7 +1165,8 @@
 
   dynamic noSuchMethod(Invocation invocation) {}
 
-  ProcessResult runSync(String executable, List<String> arguments) =>
+  ProcessResult runSync(String executable, List<String> arguments,
+          {String workingDirectory}) =>
       _mockResult ??
       ProcessResult(
         123 /* pid */,
diff --git a/pkg/nnbd_migration/test/migration_visitor_test_base.dart b/pkg/nnbd_migration/test/migration_visitor_test_base.dart
index c91a11c..3e3cf4e 100644
--- a/pkg/nnbd_migration/test/migration_visitor_test_base.dart
+++ b/pkg/nnbd_migration/test/migration_visitor_test_base.dart
@@ -298,8 +298,9 @@
 
   final _expressionChecks = <Expression, ExpressionChecksOrigin>{};
 
-  InstrumentedVariables(NullabilityGraph graph, TypeProvider typeProvider)
-      : super(graph, typeProvider);
+  InstrumentedVariables(NullabilityGraph graph, TypeProvider typeProvider,
+      LineInfo Function(String) getLineInfo)
+      : super(graph, typeProvider, getLineInfo);
 
   /// Gets the [ExpressionChecks] associated with the given [expression].
   ExpressionChecksOrigin checkExpression(Expression expression) =>
@@ -363,9 +364,9 @@
 
   Future<CompilationUnit> analyze(String code) async {
     await resolveTestUnit(code);
-    variables = InstrumentedVariables(graph, typeProvider);
-    testUnit
-        .accept(NodeBuilder(variables, testSource, null, graph, typeProvider));
+    variables = InstrumentedVariables(graph, typeProvider, getLineInfo);
+    testUnit.accept(NodeBuilder(
+        variables, testSource, null, graph, typeProvider, getLineInfo));
     return testUnit;
   }
 
diff --git a/pkg/nnbd_migration/test/node_builder_test.dart b/pkg/nnbd_migration/test/node_builder_test.dart
index 9abb1b4..24737b9 100644
--- a/pkg/nnbd_migration/test/node_builder_test.dart
+++ b/pkg/nnbd_migration/test/node_builder_test.dart
@@ -1444,7 +1444,8 @@
 ''');
     var decoratedType =
         variables.decoratedElementType(findNode.simple('x').staticElement);
-    expect(decoratedType.returnType.node.displayName, 'return type of main.x');
+    expect(decoratedType.returnType.node.displayName,
+        'return type of main.x (test.dart:2:7)');
   }
 
   Future<void> test_localVariable_type_inferred_generic() async {
@@ -1456,9 +1457,9 @@
     var decoratedType =
         variables.decoratedElementType(findNode.simple('x').staticElement);
     expect(decoratedType.typeArguments[0].node.displayName,
-        'type argument 0 of main.x');
+        'type argument 0 of main.x (test.dart:2:7)');
     expect(decoratedType.typeArguments[1].node.displayName,
-        'type argument 1 of main.x');
+        'type argument 1 of main.x (test.dart:2:7)');
   }
 
   Future<void> test_method_generic_bounded() async {
diff --git a/pkg/nnbd_migration/test/test_all.dart b/pkg/nnbd_migration/test/test_all.dart
index 355276b..0be5fd9 100644
--- a/pkg/nnbd_migration/test/test_all.dart
+++ b/pkg/nnbd_migration/test/test_all.dart
@@ -15,7 +15,6 @@
 import 'edit_plan_test.dart' as edit_plan_test;
 import 'edit_planner_pass_through_merging_test.dart'
     as edit_planner_pass_through_merging_test;
-import 'fantasyland/test_all.dart' as fantasyland;
 import 'fix_aggregator_test.dart' as fix_aggregator_test;
 import 'fix_builder_test.dart' as fix_builder_test;
 import 'fix_reason_target_test.dart' as fix_reason_target_test;
@@ -37,7 +36,6 @@
     edge_builder_test.main();
     edit_plan_test.main();
     edit_planner_pass_through_merging_test.main();
-    fantasyland.main();
     fix_aggregator_test.main();
     fix_builder_test.main();
     fix_reason_target_test.main();
diff --git a/pkg/nnbd_migration/tool/src/package.dart b/pkg/nnbd_migration/tool/src/package.dart
index b0c42e6..152b61f 100644
--- a/pkg/nnbd_migration/tool/src/package.dart
+++ b/pkg/nnbd_migration/tool/src/package.dart
@@ -7,7 +7,6 @@
 import 'dart:convert';
 import 'dart:io';
 
-import 'package:nnbd_migration/src/fantasyland/fantasy_workspace.dart';
 import 'package:nnbd_migration/src/utilities/subprocess_launcher.dart';
 import 'package:path/path.dart' as path;
 
@@ -80,26 +79,6 @@
   List<String> get migrationPaths => [_packagePath];
 }
 
-/// Abstraction for a fantasy-land package.
-class FantasyLandPackage extends Package {
-  final String name;
-  final FantasyWorkspace fantasyLand;
-
-  FantasyLandPackage._(this.name, this.fantasyLand) : super('${name}__flat');
-
-  static Future<FantasyLandPackage> fantasyLandPackageFactory(
-      String name, Playground playground) async {
-    return FantasyLandPackage._(
-        name,
-        await buildFantasyLand(name, [],
-            path.join(playground.playgroundPath, '${name}__flat'), true));
-  }
-
-  @override
-  // TODO(jcollins-g): traverse [fantasyLand.subPackages] and calculate paths to migrate.
-  List<String> get migrationPaths => throw UnimplementedError;
-}
-
 /// Abstraction for a package fetched via Git.
 class GitPackage extends Package {
   final String _clonePath;
diff --git a/pkg/nnbd_migration/tool/trial_migration.dart b/pkg/nnbd_migration/tool/trial_migration.dart
index 21d4337..3203d1d 100644
--- a/pkg/nnbd_migration/tool/trial_migration.dart
+++ b/pkg/nnbd_migration/tool/trial_migration.dart
@@ -64,9 +64,12 @@
       var localFiles =
           context.contextRoot.analyzedFiles().where((s) => s.endsWith('.dart'));
       files.addAll(localFiles);
-      var migration = NullabilityMigration(listener, permissive: true);
+      var session = context.currentSession;
+      LineInfo getLineInfo(String path) => session.getFile(path).lineInfo;
+      var migration =
+          NullabilityMigration(listener, getLineInfo, permissive: true);
       for (var file in localFiles) {
-        var resolvedUnit = await context.currentSession.getResolvedUnit(file);
+        var resolvedUnit = await session.getResolvedUnit(file);
         if (!resolvedUnit.errors.any((e) => e.severity == Severity.error)) {
           migration.prepareInput(resolvedUnit);
         } else {
@@ -74,13 +77,13 @@
         }
       }
       for (var file in localFiles) {
-        var resolvedUnit = await context.currentSession.getResolvedUnit(file);
+        var resolvedUnit = await session.getResolvedUnit(file);
         if (!resolvedUnit.errors.any((e) => e.severity == Severity.error)) {
           migration.processInput(resolvedUnit);
         }
       }
       for (var file in localFiles) {
-        var resolvedUnit = await context.currentSession.getResolvedUnit(file);
+        var resolvedUnit = await session.getResolvedUnit(file);
         if (!resolvedUnit.errors.any((e) => e.severity == Severity.error)) {
           migration.finalizeInput(resolvedUnit);
         }
diff --git a/pkg/pkg.status b/pkg/pkg.status
index b49a9be..627b42b 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -24,6 +24,37 @@
 analyzer/test/src/summary/resynthesize_kernel_test: Slow, Pass
 analyzer/test/src/task/strong/checker_test: Slow, Pass
 analyzer_plugin/test/plugin/folding_mixin_test: Slow, Pass
+compiler/test/analyses/analyze_test: Slow, Pass
+compiler/test/analyses/api_dynamic_test: Slow, Pass
+compiler/test/analyses/dart2js_dynamic_test: Slow, Pass
+compiler/test/closure/closure_test: Slow, Pass
+compiler/test/codegen/load_elimination_test: Slow, Pass
+compiler/test/codegen/model_test: Slow, Pass
+compiler/test/deferred_loading/deferred_loading_test: Slow, Pass
+compiler/test/end_to_end/dump_info_test: Slow, Pass
+compiler/test/equivalence/id_equivalence1_test: Slow, Pass
+compiler/test/equivalence/id_equivalence2_test: Slow, Pass
+compiler/test/impact/impact_test: Slow, Pass
+compiler/test/inference/inference0_test: Slow, Pass
+compiler/test/inference/inference1_test: Slow, Pass
+compiler/test/inference/inference2_test: Slow, Pass
+compiler/test/inference/inference3_test: Slow, Pass
+compiler/test/inference/swarm_test: Slow, Pass #
+compiler/test/inlining/inlining_test: Slow, Pass
+compiler/test/model/native_test: Slow, Pass
+compiler/test/model/no_such_method_enabled_test: Slow, Pass
+compiler/test/model/subtype_test: Slow, Pass
+compiler/test/modular/*: Slow, Pass
+compiler/test/nalyses/analyze_test: Slow, Pass
+compiler/test/packages/*: SkipByDesign
+compiler/test/rti/rti_emission_test: Slow, Pass
+compiler/test/rti/rti_need0_test: Slow, Pass
+compiler/test/rti/rti_need1_test: Slow, Pass
+compiler/test/serialization/serialization_test: Slow, Pass
+compiler/test/sourcemaps/source_mapping_invokes_test: Slow, Pass
+compiler/test/sourcemaps/source_mapping_operators_test: Slow, Pass
+compiler/test/sourcemaps/source_mapping_test: Slow, Pass
+compiler/test/sourcemaps/stacktrace_test: Slow, Pass
 dartdev/test/commands/analyze_test: Slow, Pass
 dartdev/test/commands/help_test: Slow, Pass
 dev_compiler/test/modular/*: Slow, Pass
@@ -92,6 +123,13 @@
 test_runner/test/*: SkipByDesign # Only meant to run on vm
 testing/*: SkipByDesign # Only meant to run on vm
 
+[ $mode == debug ]
+compiler/test/deferred/load_graph_segmentation_test: Slow, Pass
+compiler/test/deferred/load_mapping_test: Slow, Pass
+compiler/test/end_to_end/dart2js_batch_test: Slow, Pass
+compiler/test/end_to_end/exit_code_test: Slow, Pass
+compiler/test/end_to_end/in_user_code_test: Slow, Pass
+
 [ $runtime == dart_precompiled ]
 *: SkipByDesign # The pkg test framework imports dart:mirrors.
 
@@ -156,6 +194,21 @@
 status_file/*: SkipByDesign # Only meant to run on the standalone VM.
 testing/test/analyze_test: SkipByDesign
 
+[ $checked ]
+compiler/test/codegen/value_range_kernel_test: Slow, Pass
+compiler/test/codegen/value_range_test: Slow, Pass
+compiler/test/end_to_end/exit_code_test: Slow, Pass
+compiler/test/end_to_end/output_type_test: Slow, Pass
+compiler/test/end_to_end/uri_retention_test: Slow, Pass
+compiler/test/jsinterop/declaration_test: Slow, Pass
+compiler/test/jsinterop/interop_anonymous_unreachable_test: Slow, Pass
+compiler/test/jsinterop/world_test: Slow, Pass
+compiler/test/sourcemaps/stacktrace_test: Slow, Pass
+
+[ !$checked ]
+compiler/test/end_to_end/exit_code_test: SkipByDesign # This tests requires checked mode.
+compiler/test/jsinterop/declaration_test: Slow, Pass
+
 [ $jscl ]
 kernel/test/*: SkipByDesign # Uses dart:io and bigints.
 
@@ -237,3 +290,6 @@
 
 [ $mode != release || $runtime != vm || $system == windows ]
 kernel/test/closures_test: Skip
+
+[ $runtime == chrome || $runtime == ff || $runtime == firefox || $runtime == safari || $jscl ]
+compiler/test/*: Skip # dart2js uses #import('dart:io'); and it is not self-hosted (yet).
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 6be64fb..97be6bd 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -508,6 +508,8 @@
       ..._configuration.sharedOptions,
       ..._experimentsArgument(_configuration, testFile),
       ...testFile.ddcOptions,
+      if (_configuration.nnbdMode == NnbdMode.strong)
+        '--sound-null-safety',
       // The file being compiled is the last argument.
       args.last
     ];
@@ -521,7 +523,9 @@
       //
       // For local development we don't have a built SDK yet, so point directly
       // at the built summary file location.
-      var sdkSummaryFile = 'ddc_sdk.dill';
+      var sdkSummaryFile = _configuration.nnbdMode == NnbdMode.strong
+          ? 'ddc_outline_sound.dill'
+          : 'ddc_outline.dill';
       var sdkSummary = Path(_configuration.buildDirectory)
           .append(sdkSummaryFile)
           .absolute
@@ -541,6 +545,8 @@
 
     // Link to the summaries for the available packages, so that they don't
     // get recompiled into the test's own module.
+    var packageSummaryDir =
+        _configuration.nnbdMode == NnbdMode.strong ? 'pkg_sound' : 'pkg_kernel';
     for (var package in testPackages) {
       args.add("-s");
 
@@ -548,7 +554,7 @@
       // dartdevc explicit module paths for each one. When the test is run, we
       // will tell require.js where to find each package's compiled JS.
       var summary = Path(_configuration.buildDirectory)
-          .append("/gen/utils/dartdevc/pkg_kernel/$package.dill")
+          .append("/gen/utils/dartdevc/$packageSummaryDir/$package.dill")
           .absolute
           .toNativePath();
       args.add("$summary=$package");
diff --git a/pkg/test_runner/lib/src/test_configurations.dart b/pkg/test_runner/lib/src/test_configurations.dart
index 4a77be1..c1af470 100644
--- a/pkg/test_runner/lib/src/test_configurations.dart
+++ b/pkg/test_runner/lib/src/test_configurations.dart
@@ -32,7 +32,6 @@
   Path('runtime/observatory/tests/observatory_ui'),
   Path('samples'),
   Path('samples-dev'),
-  Path('tests/compiler/dart2js'),
   Path('tests/compiler/dart2js_extra'),
   Path('tests/compiler/dart2js_native'),
   Path('tests/compiler/dartdevc_native'),
diff --git a/pkg/test_runner/lib/src/test_suite.dart b/pkg/test_runner/lib/src/test_suite.dart
index 540dfd2..b06096b 100644
--- a/pkg/test_runner/lib/src/test_suite.dart
+++ b/pkg/test_runner/lib/src/test_suite.dart
@@ -867,11 +867,6 @@
     if (configuration.compiler == Compiler.dart2analyzer) {
       args.add('--format=machine');
       args.add('--no-hints');
-
-      if (testFile.path.filename.contains("dart2js") ||
-          testFile.path.directoryPath.segments().last.contains('html_common')) {
-        args.add("--use-dart2js-libraries");
-      }
     }
 
     args.add(testFile.path.toNativePath());
diff --git a/pkg/vm/lib/incremental_compiler.dart b/pkg/vm/lib/incremental_compiler.dart
index 841f84b..a169532 100644
--- a/pkg/vm/lib/incremental_compiler.dart
+++ b/pkg/vm/lib/incremental_compiler.dart
@@ -34,6 +34,7 @@
 
   Uri get entryPoint => _entryPoint;
   IncrementalKernelGenerator get generator => _generator;
+  Component get lastKnownGoodComponent => _lastKnownGood;
 
   IncrementalCompiler(this._compilerOptions, this._entryPoint,
       {this.initializeFromDillUri, bool incrementalSerialization: true})
diff --git a/pkg/vm/lib/kernel_front_end.dart b/pkg/vm/lib/kernel_front_end.dart
index dcff366..044478e 100644
--- a/pkg/vm/lib/kernel_front_end.dart
+++ b/pkg/vm/lib/kernel_front_end.dart
@@ -102,7 +102,7 @@
       defaultsTo: true);
   args.addFlag('tree-shake-write-only-fields',
       help: 'Enable tree shaking of fields which are only written in AOT mode.',
-      defaultsTo: false);
+      defaultsTo: true);
   args.addFlag('protobuf-tree-shaker',
       help: 'Enable protobuf tree shaker transformation in AOT mode.',
       defaultsTo: false);
@@ -274,9 +274,7 @@
 
   final IOSink sink = new File(outputFileName).openWrite();
   final BinaryPrinter printer = new BinaryPrinter(sink,
-      libraryFilter: minimalKernel
-          ? ((lib) => !results.loadedLibraries.contains(lib))
-          : null);
+      libraryFilter: (lib) => !results.loadedLibraries.contains(lib));
   printer.writeComponentFile(results.component);
   await sink.close();
 
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index a7ccbbc..12b5821 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -422,14 +422,16 @@
     try {
       int count = 1;
       if (args.length == 1) {
-        count = int.parse(args[0]);
+        count = int.tryParse(args[0]);
+        if (count == null || count < 1 || count >= debugger.stackDepth) {
+          debugger.console.print(
+              'Frame must be an int in bounds [1..${debugger.stackDepth - 1}]:'
+              ' saw ${args[0]}');
+          return;
+        }
       } else if (args.length > 1) {
         debugger.console.print('rewind expects 0 or 1 argument');
         return;
-      } else if (count < 1 || count > debugger.stackDepth) {
-        debugger.console
-            .print('frame must be in range [1..${debugger.stackDepth - 1}]');
-        return;
       }
       await debugger.rewind(count);
     } on S.ServerRpcException catch (e) {
diff --git a/runtime/platform/elf.h b/runtime/platform/elf.h
index fac5ab4..39b8e81 100644
--- a/runtime/platform/elf.h
+++ b/runtime/platform/elf.h
@@ -134,6 +134,7 @@
 static const intptr_t PF_W = 2;
 static const intptr_t PF_R = 4;
 
+static const intptr_t SHT_NULL = 0;
 static const intptr_t SHT_PROGBITS = 1;
 static const intptr_t SHT_SYMTAB = 2;
 static const intptr_t SHT_STRTAB = 3;
@@ -150,6 +151,7 @@
 
 static const intptr_t STN_UNDEF = 0;
 
+static const intptr_t PT_NULL = 0;
 static const intptr_t PT_LOAD = 1;
 static const intptr_t PT_DYNAMIC = 2;
 static const intptr_t PT_PHDR = 6;
diff --git a/runtime/tests/vm/dart/regress_41971_test.dart b/runtime/tests/vm/dart/regress_41971_test.dart
new file mode 100644
index 0000000..28f63ad
--- /dev/null
+++ b/runtime/tests/vm/dart/regress_41971_test.dart
@@ -0,0 +1,42 @@
+// 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.
+//
+// This test checks that late constant folding passes don't violate
+// representation requirements for uses of a definition that is being
+// folded away.
+
+import 'dart:ffi';
+
+import 'package:expect/expect.dart';
+import 'package:ffi/ffi.dart';
+
+class X {
+  int field;
+  X(this.field);
+}
+
+@pragma('vm:never-inline')
+int loadFrom(Pointer<Int32> p) {
+  final x = X(0);
+  x.field = 1;
+  if ((x.field + 1) == 2) {
+    x.field = 0;
+  }
+
+  // The code above tries to delay folding of x.field into a constant
+  // until later passes. Inside p[...] there will be an unboxed Int64
+  // arithmetic used to compute an index which will get constant folded
+  // as soon as x.field is constant folded. CP should insert unboxed constant
+  // or an unbox of a constant as a result of constant folding. If it does
+  // not - then we will get an incorrect graph where a tagged value is flowing
+  // into a LoadIndexed instruction without a deopt-id.
+  return p[x.field];
+}
+
+void main() {
+  final p = allocate<Int32>(count: 128);
+  p[0] = 42;
+  Expect.equals(42, loadFrom(p));
+  free(p);
+}
diff --git a/runtime/tests/vm/dart/regress_flutter_57398_test.dart b/runtime/tests/vm/dart/regress_flutter_57398_test.dart
new file mode 100644
index 0000000..79c5614
--- /dev/null
+++ b/runtime/tests/vm/dart/regress_flutter_57398_test.dart
@@ -0,0 +1,36 @@
+// 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.
+//
+// Check that we correctly handle FutureOr<T> when computing if a location
+// of the given static type can contain Smi or not.
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class W<T> {
+  final FutureOr<T> v;
+  W({this.v});
+
+  @pragma('vm:never-inline')
+  bool compare(W<T> o) {
+    // We will emit a dispatch table call here which uses LoadClassId
+    // instruction to get class id of o. If FutureOr<T> is treated incorrectly
+    // then optimizer will assume that v can't be a Smi and remove smi
+    // handling from LoadClassId - leading to a crash.
+    return this.v == o.v;
+  }
+}
+
+@pragma('vm:never-inline')
+FutureOr<int> make(int v) {
+  return v > 0 ? v : Future.value(v);
+}
+
+void main(List<String> args) {
+  final i0 = args.length == 0 ? 1 : -2;
+  final i1 = args.length == 1 ? -3 : 4;
+  var w = W(v: make(i0));
+  Expect.isTrue(w.compare(W(v: make(i0))));
+  Expect.isFalse(w.compare(W(v: make(i1))));
+}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index b65f316..d565a24 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -38,6 +38,10 @@
 
 [ $arch == simarm || $arch == simarm64 ]
 dart/isolates/thread_pool_test: SkipByDesign # Test uses dart:ffi which is not supported on simulators.
+dart/unboxed_param_args_descriptor_test: SkipByDesign # FFI helper not supported on simulator
+dart/unboxed_param_tear_off_test: SkipByDesign # FFI helper not supported on simulator
+dart/unboxed_param_test: SkipByDesign # FFI helper not supported on simulator
+dart/regress_41971_test: SkipByDesign # dart:ffi is not supported on simulator
 
 [ $builder_tag == asan ]
 dart/transferable_throws_oom_test: SkipByDesign # This test tries to allocate too much memory on purpose. Still dartbug.com/37188
@@ -273,11 +277,6 @@
 [ $compiler == dart2analyzer || $compiler == dart2js ]
 dart/data_uri*test: Skip # Data uri's not supported by dart2js or the analyzer.
 
-[ $arch == simarm || $arch == simarm64 ]
-dart/unboxed_param_args_descriptor_test: SkipByDesign # FFI helper not supported on simulator
-dart/unboxed_param_tear_off_test: SkipByDesign # FFI helper not supported on simulator
-dart/unboxed_param_test: SkipByDesign # FFI helper not supported on simulator
-
 [ $compiler == dartk || $compiler == dartkb ]
 cc/DartAPI_New: Fail # Issue #33041
 cc/DartGeneratedArrayLiteralMessages: Crash # Issue 32190
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index d97b37d..f213b2b 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -5013,29 +5013,19 @@
   ASSERT(code != Code::null());
 
   const intptr_t offset = image_writer_->GetTextOffsetFor(instr, code);
-  if (offset == 0) {
-    // Code should have been removed by DropCodeWithoutReusableInstructions.
-    UnexpectedObject(code, "Expected instructions to reuse");
-  }
-
-  // If offset < 0, it's pointing to a shared instruction. We don't profile
-  // references to shared text/data (since they don't consume any space). Of
-  // course, the space taken for the reference is profiled.
-  if (profile_writer_ != nullptr && offset >= 0) {
-    // Instructions cannot be roots.
+#if defined(DART_PRECOMPILER)
+  if (profile_writer_ != nullptr) {
     ASSERT(IsAllocatedReference(object_currently_writing_.id_));
-    auto offset_space = vm_ ? V8SnapshotProfileWriter::kVmText
-                            : V8SnapshotProfileWriter::kIsolateText;
-    V8SnapshotProfileWriter::ObjectId to_object = {
-        offset_space, offset < 0 ? -offset : offset};
-    V8SnapshotProfileWriter::ObjectId from_object = {
-        V8SnapshotProfileWriter::kSnapshot, object_currently_writing_.id_};
+    const auto offset_space = vm_ ? V8SnapshotProfileWriter::kVmText
+                                  : V8SnapshotProfileWriter::kIsolateText;
+    const V8SnapshotProfileWriter::ObjectId to_object(offset_space, offset);
+    const V8SnapshotProfileWriter::ObjectId from_object(
+        V8SnapshotProfileWriter::kSnapshot, object_currently_writing_.id_);
     profile_writer_->AttributeReferenceTo(
         from_object, {to_object, V8SnapshotProfileWriter::Reference::kProperty,
                       profile_writer_->EnsureString("<instructions>")});
   }
 
-#if defined(DART_PRECOMPILER)
   if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
     static_assert(
         ImageWriter::kBareInstructionsAlignment > 1,
diff --git a/runtime/vm/compiler/aot/aot_call_specializer.cc b/runtime/vm/compiler/aot/aot_call_specializer.cc
index 316cbd0..5f2d330 100644
--- a/runtime/vm/compiler/aot/aot_call_specializer.cc
+++ b/runtime/vm/compiler/aot/aot_call_specializer.cc
@@ -226,7 +226,8 @@
 
   // If Smi is not assignable to the interface target of the call, the receiver
   // is definitely not a Smi.
-  if (instr->HasNonSmiAssignableInterface(Thread::Current()->zone())) {
+  if (!instr->CanReceiverBeSmiBasedOnInterfaceTarget(
+          Thread::Current()->zone())) {
     return false;
   }
 
@@ -478,7 +479,7 @@
         left_type->IsNullableInt() && right_type->IsNullableInt();
 
     if (auto* call = instr->AsInstanceCall()) {
-      if (call->HasNonSmiAssignableInterface(zone())) {
+      if (!call->CanReceiverBeSmiBasedOnInterfaceTarget(zone())) {
         has_nullable_int_args = false;
       }
     }
@@ -1300,10 +1301,8 @@
     return;
   }
 
-  const AbstractType& target_type =
-      AbstractType::Handle(Class::Handle(interface_target.Owner()).RareType());
   const bool receiver_can_be_smi =
-      CompileType::Smi().IsAssignableTo(target_type);
+      call->CanReceiverBeSmiBasedOnInterfaceTarget(zone());
   auto load_cid = new (Z) LoadClassIdInstr(receiver->CopyWithType(Z), kUntagged,
                                            receiver_can_be_smi);
   InsertBefore(call, load_cid, call->env(), FlowGraph::kValue);
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index 5a2d32b..a357237 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -163,7 +163,6 @@
       libraries_(GrowableObjectArray::Handle(I->object_store()->libraries())),
       pending_functions_(
           GrowableObjectArray::Handle(GrowableObjectArray::New())),
-      pending_static_fields_to_retain_(),
       sent_selectors_(),
       seen_functions_(HashTables::New<FunctionSet>(/*initial_capacity=*/1024)),
       possibly_retained_functions_(
@@ -477,9 +476,11 @@
     Zone* zone_;
   };
 
+  phase_ = Phase::kCompilingConstructorsForInstructionCounts;
   HANDLESCOPE(T);
   ConstructorVisitor visitor(this, Z);
   ProgramVisitor::WalkProgram(Z, I, &visitor);
+  phase_ = Phase::kPreparation;
 }
 
 void Precompiler::AddRoots() {
@@ -520,16 +521,10 @@
   }
 }
 
-void Precompiler::AddRetainedStaticField(const Field& field) {
-  if (pending_static_fields_to_retain_.HasKey(&field)) {
-    return;
-  }
-  pending_static_fields_to_retain_.Insert(&Field::ZoneHandle(Z, field.raw()));
-}
-
 void Precompiler::Iterate() {
   Function& function = Function::Handle(Z);
 
+  phase_ = Phase::kFixpointCodeGeneration;
   while (changed_) {
     changed_ = false;
 
@@ -538,20 +533,10 @@
       ProcessFunction(function);
     }
 
-    // AddField might retain more static fields.
-    while (!pending_static_fields_to_retain_.IsEmpty()) {
-      FieldSet copy = pending_static_fields_to_retain_;
-      pending_static_fields_to_retain_.Clear();
-      FieldSet::Iterator it = copy.GetIterator();
-      for (const Field** field = it.Next(); field != nullptr;
-           field = it.Next()) {
-        AddField(**field);
-      }
-    }
-
     CheckForNewDynamicFunctions();
     CollectCallbackFields();
   }
+  phase_ = Phase::kDone;
 }
 
 void Precompiler::CollectCallbackFields() {
@@ -2478,25 +2463,29 @@
                             function_stats);
       }
 
-      for (intptr_t i = 0; i < graph_compiler.used_static_fields().length();
-           i++) {
-        // We can't use precompiler_->AddField() directly here because they
-        // need to be added later as part of Iterate(). If they are added
-        // before that, initializer functions will get their code cleared by
-        // Precompiler::ClearAllCode().
-        precompiler_->AddRetainedStaticField(
-            *graph_compiler.used_static_fields().At(i));
-      }
+      if (precompiler_->phase() ==
+          Precompiler::Phase::kFixpointCodeGeneration) {
+        for (intptr_t i = 0; i < graph_compiler.used_static_fields().length();
+             i++) {
+          precompiler_->AddField(*graph_compiler.used_static_fields().At(i));
+        }
 
-      const GrowableArray<const compiler::TableSelector*>& call_selectors =
-          graph_compiler.dispatch_table_call_targets();
-      for (intptr_t i = 0; i < call_selectors.length(); i++) {
-        precompiler_->AddTableSelector(call_selectors[i]);
+        const GrowableArray<const compiler::TableSelector*>& call_selectors =
+            graph_compiler.dispatch_table_call_targets();
+        for (intptr_t i = 0; i < call_selectors.length(); i++) {
+          precompiler_->AddTableSelector(call_selectors[i]);
+        }
+      } else {
+        // We should not be generating code outside of these two specific
+        // precompilation phases.
+        RELEASE_ASSERT(
+            precompiler_->phase() ==
+            Precompiler::Phase::kCompilingConstructorsForInstructionCounts);
       }
 
       // In bare instructions mode try adding all entries from the object
       // pool into the global object pool. This might fail if we have
-      // nested code generation (i.e. we generated some stubs) whichs means
+      // nested code generation (i.e. we generated some stubs) which means
       // that some of the object indices we used are already occupied in the
       // global object pool.
       //
diff --git a/runtime/vm/compiler/aot/precompiler.h b/runtime/vm/compiler/aot/precompiler.h
index c4135c4..4c1b140 100644
--- a/runtime/vm/compiler/aot/precompiler.h
+++ b/runtime/vm/compiler/aot/precompiler.h
@@ -217,9 +217,18 @@
 
   static Precompiler* Instance() { return singleton_; }
 
-  void AddRetainedStaticField(const Field& field);
+  void AddField(const Field& field);
   void AddTableSelector(const compiler::TableSelector* selector);
 
+  enum class Phase {
+    kPreparation,
+    kCompilingConstructorsForInstructionCounts,
+    kFixpointCodeGeneration,
+    kDone,
+  };
+
+  Phase phase() const { return phase_; }
+
  private:
   static Precompiler* singleton_;
 
@@ -241,7 +250,6 @@
                           Class* temp_cls);
   void AddConstObject(const class Instance& instance);
   void AddClosureCall(const Array& arguments_descriptor);
-  void AddField(const Field& field);
   void AddFunction(const Function& function, bool retain = true);
   void AddInstantiatedClass(const Class& cls);
   void AddSelector(const String& selector);
@@ -306,7 +314,6 @@
   compiler::ObjectPoolBuilder global_object_pool_builder_;
   GrowableObjectArray& libraries_;
   const GrowableObjectArray& pending_functions_;
-  FieldSet pending_static_fields_to_retain_;
   SymbolSet sent_selectors_;
   FunctionSet seen_functions_;
   FunctionSet possibly_retained_functions_;
@@ -323,6 +330,8 @@
 
   bool get_runtime_type_is_unique_;
   void* il_serialization_stream_;
+
+  Phase phase_ = Phase::kPreparation;
 };
 
 class FunctionsTraits {
diff --git a/runtime/vm/compiler/assembler/assembler_arm.cc b/runtime/vm/compiler/assembler/assembler_arm.cc
index df568a3..5f12e5f 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm.cc
@@ -529,6 +529,11 @@
   Emit(encoding);
 }
 
+void Assembler::dmb() {
+  // Emit a `dmb ish` instruction.
+  Emit(kDataMemoryBarrier);
+}
+
 void Assembler::EnterSafepoint(Register addr, Register state) {
   // We generate the same number of instructions whether or not the slow-path is
   // forced. This simplifies GenerateJitCallbackTrampolines.
diff --git a/runtime/vm/compiler/assembler/assembler_arm.h b/runtime/vm/compiler/assembler/assembler_arm.h
index 67c8495..d382569 100644
--- a/runtime/vm/compiler/assembler/assembler_arm.h
+++ b/runtime/vm/compiler/assembler/assembler_arm.h
@@ -404,6 +404,14 @@
   void LoadMemoryValue(Register dst, Register base, int32_t offset) {
     LoadFromOffset(kWord, dst, base, offset, AL);
   }
+  void LoadAcquire(Register dst, Register address, int32_t offset = 0) {
+    ldr(dst, Address(address, offset));
+    dmb();
+  }
+  void StoreRelease(Register src, Register address, int32_t offset = 0) {
+    dmb();
+    str(src, Address(address, offset));
+  }
 
   void CompareWithFieldValue(Register value, FieldAddress address) {
     CompareWithMemoryValue(value, address);
@@ -565,6 +573,8 @@
   void ldrex(Register rd, Register rn, Condition cond = AL);
   void strex(Register rd, Register rt, Register rn, Condition cond = AL);
 
+  void dmb();
+
   // Emit code to transition between generated and native modes.
   //
   // These require that CSP and SP are equal and aligned and require two scratch
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h
index df7c6e9..743e95f 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.h
+++ b/runtime/vm/compiler/assembler/assembler_arm64.h
@@ -487,6 +487,22 @@
   void LoadMemoryValue(Register dst, Register base, int32_t offset) {
     LoadFromOffset(dst, base, offset, kDoubleWord);
   }
+  void LoadAcquire(Register dst, Register address, int32_t offset = 0) {
+    if (offset != 0) {
+      AddImmediate(TMP2, address, offset);
+      ldar(dst, TMP2);
+    } else {
+      ldar(dst, address);
+    }
+  }
+  void StoreRelease(Register src, Register address, int32_t offset = 0) {
+    if (offset != 0) {
+      AddImmediate(TMP2, address, offset);
+      stlr(src, TMP2);
+    } else {
+      stlr(src, address);
+    }
+  }
 
   void CompareWithFieldValue(Register value, FieldAddress address) {
     CompareWithMemoryValue(value, address);
@@ -954,6 +970,14 @@
     Emit(encoding);
   }
 
+  void ldar(Register rt, Register rn, OperandSize sz = kDoubleWord) {
+    EmitLoadStoreExclusive(LDAR, R31, rn, rt, sz);
+  }
+
+  void stlr(Register rt, Register rn, OperandSize sz = kDoubleWord) {
+    EmitLoadStoreExclusive(STLR, R31, rn, rt, sz);
+  }
+
   // Conditional select.
   void csel(Register rd, Register rn, Register rm, Condition cond) {
     EmitConditionalSelect(CSEL, rd, rn, rm, cond, kDoubleWord);
diff --git a/runtime/vm/compiler/assembler/assembler_arm64_test.cc b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
index e133f9f..ce1ba92 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64_test.cc
+++ b/runtime/vm/compiler/assembler/assembler_arm64_test.cc
@@ -682,6 +682,62 @@
             EXECUTE_TEST_CODE_INT64(FailedSemaphore32, test->entry()));
 }
 
+ASSEMBLER_TEST_GENERATE(LoadAcquireStoreRelease, assembler) {
+  // We cannot really test that ldar/stlr have the barrier behavior, but at
+  // least we can test that the load/store behavior is correct.
+  Label failed, done;
+
+  __ SetupDartSP();
+  __ EnterFrame(0);
+
+  // Test 64-bit ladr.
+  __ PushImmediate(0x1122334455667788);
+  __ ldar(R1, SP, kDoubleWord);
+  __ CompareImmediate(R1, 0x1122334455667788);
+  __ BranchIf(NOT_EQUAL, &failed);
+  __ Drop(1);
+
+  // Test 32-bit ladr - must zero extend.
+  __ PushImmediate(0x1122334455667788);
+  __ ldar(R1, SP, kWord);
+  __ CompareImmediate(R1, 0x55667788);
+  __ BranchIf(NOT_EQUAL, &failed);
+  __ Drop(1);
+
+  // Test 64-bit stlr.
+  __ PushImmediate(0);
+  __ LoadImmediate(R1, 0x1122334455667788);
+  __ stlr(R1, SP, kDoubleWord);
+  __ Pop(R1);
+  __ CompareImmediate(R1, 0x1122334455667788);
+  __ BranchIf(NOT_EQUAL, &failed);
+
+  // Test 32-bit stlr.
+  __ PushImmediate(0);
+  __ LoadImmediate(R1, 0x1122334455667788);
+  __ stlr(R1, SP, kWord);
+  __ Pop(R1);
+  __ CompareImmediate(R1, 0x55667788);
+  __ BranchIf(NOT_EQUAL, &failed);
+
+  __ LoadImmediate(R0, 0x42);
+  __ b(&done);
+
+  __ Bind(&failed);
+  __ LoadImmediate(R0, 0x84);
+
+  __ Bind(&done);
+  __ LeaveFrame();
+  __ RestoreCSP();
+  __ ret();
+}
+
+ASSEMBLER_TEST_RUN(LoadAcquireStoreRelease, test) {
+  typedef intptr_t (*LoadAcquireStoreRelease)() DART_UNUSED;
+  EXPECT_EQ(0x42,
+            EXECUTE_TEST_CODE_INT64(LoadAcquireStoreRelease, test->entry()));
+}
+
 // Logical register operations.
 ASSEMBLER_TEST_GENERATE(AndRegs, assembler) {
   __ movz(R1, Immediate(43), 0);
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.h b/runtime/vm/compiler/assembler/assembler_ia32.h
index f2bbd9f..28296be 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.h
+++ b/runtime/vm/compiler/assembler/assembler_ia32.h
@@ -578,6 +578,16 @@
   void LoadMemoryValue(Register dst, Register base, int32_t offset) {
     movl(dst, Address(base, offset));
   }
+  void LoadAcquire(Register dst, Register address, int32_t offset = 0) {
+    // On intel loads have load-acquire behavior (i.e. loads are not re-ordered
+    // with other loads).
+    movl(dst, Address(address, offset));
+  }
+  void StoreRelease(Register src, Register address, int32_t offset = 0) {
+    // On intel stores have store-release behavior (i.e. stores are not
+    // re-ordered with other stores).
+    movl(Address(address, offset), src);
+  }
 
   // Issues a move instruction if 'to' is not the same as 'from'.
   void MoveRegister(Register to, Register from);
diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h
index 4a02ad7..643b0bd 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.h
+++ b/runtime/vm/compiler/assembler/assembler_x64.h
@@ -863,6 +863,16 @@
   void LoadMemoryValue(Register dst, Register base, int32_t offset) {
     movq(dst, Address(base, offset));
   }
+  void LoadAcquire(Register dst, Register address, int32_t offset = 0) {
+    // On intel loads have load-acquire behavior (i.e. loads are not re-ordered
+    // with other loads).
+    movq(dst, Address(address, offset));
+  }
+  void StoreRelease(Register src, Register address, int32_t offset = 0) {
+    // On intel stores have store-release behavior (i.e. stores are not
+    // re-ordered with other stores).
+    movq(Address(address, offset), src);
+  }
 
   void CompareWithFieldValue(Register value, FieldAddress address) {
     cmpq(value, address);
diff --git a/runtime/vm/compiler/assembler/disassembler_arm.cc b/runtime/vm/compiler/assembler/disassembler_arm.cc
index 5ca27fb..db51d1e 100644
--- a/runtime/vm/compiler/assembler/disassembler_arm.cc
+++ b/runtime/vm/compiler/assembler/disassembler_arm.cc
@@ -1427,6 +1427,9 @@
   if (instr->ConditionField() == kSpecialCondition) {
     if (instr->InstructionBits() == static_cast<int32_t>(0xf57ff01f)) {
       Format(instr, "clrex");
+    } else if (instr->InstructionBits() ==
+               static_cast<int32_t>(kDataMemoryBarrier)) {
+      Format(instr, "dmb ish");
     } else {
       if (instr->IsSIMDDataProcessing()) {
         DecodeSIMDDataProcessing(instr);
diff --git a/runtime/vm/compiler/assembler/disassembler_arm64.cc b/runtime/vm/compiler/assembler/disassembler_arm64.cc
index 08604a4..57c6b66 100644
--- a/runtime/vm/compiler/assembler/disassembler_arm64.cc
+++ b/runtime/vm/compiler/assembler/disassembler_arm64.cc
@@ -740,7 +740,7 @@
 }
 
 void ARM64Decoder::DecodeLoadStoreExclusive(Instr* instr) {
-  if ((instr->Bit(23) != 0) || (instr->Bit(21) != 0) || (instr->Bit(15) != 0)) {
+  if (instr->Bit(21) != 0 || instr->Bit(23) != instr->Bit(15)) {
     Unknown(instr);
   }
   const int32_t size = instr->Bits(30, 2);
@@ -749,10 +749,22 @@
   }
 
   const bool is_load = instr->Bit(22) == 1;
+  const bool is_exclusive = instr->Bit(23) == 0;
+  const bool is_ordered = instr->Bit(15) == 1;
   if (is_load) {
-    Format(instr, "ldxr 'rt, 'rn");
+    const bool is_load_acquire = !is_exclusive && is_ordered;
+    if (is_load_acquire) {
+      Format(instr, "ldar 'rt, 'rn");
+    } else {
+      Format(instr, "ldxr 'rt, 'rn");
+    }
   } else {
-    Format(instr, "stxr 'rs, 'rt, 'rn");
+    const bool is_store_release = !is_exclusive && is_ordered;
+    if (is_store_release) {
+      Format(instr, "stlr 'rt, 'rn");
+    } else {
+      Format(instr, "stxr 'rs, 'rt, 'rn");
+    }
   }
 }
 
diff --git a/runtime/vm/compiler/backend/bce_test.cc b/runtime/vm/compiler/backend/bce_test.cc
index 4567e63..39ffddb 100644
--- a/runtime/vm/compiler/backend/bce_test.cc
+++ b/runtime/vm/compiler/backend/bce_test.cc
@@ -291,7 +291,7 @@
         foo(100);
       }
     )";
-  TestScriptJIT(kScriptChars, 2, 1);
+  TestScriptJIT(kScriptChars, 2, 0);
 }
 
 }  // namespace dart
diff --git a/runtime/vm/compiler/backend/block_builder.h b/runtime/vm/compiler/backend/block_builder.h
index 311b0ab..02ea193 100644
--- a/runtime/vm/compiler/backend/block_builder.h
+++ b/runtime/vm/compiler/backend/block_builder.h
@@ -23,7 +23,10 @@
         entry_(entry),
         current_(entry),
         dummy_env_(
-            new Environment(0, 0, flow_graph->parsed_function(), nullptr)) {}
+            new Environment(0, 0, flow_graph->parsed_function(), nullptr)) {
+    // Some graph transformations use environments from block entries.
+    entry->SetEnvironment(dummy_env_);
+  }
 
   Definition* AddToInitialDefinitions(Definition* def) {
     def->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index());
@@ -44,7 +47,8 @@
 
   template <typename T>
   T* AddInstruction(T* instr) {
-    if (instr->ComputeCanDeoptimize()) {
+    if (instr->ComputeCanDeoptimize() ||
+        instr->CanBecomeDeoptimizationTarget()) {
       // All instructions that can deoptimize must have an environment attached
       // to them.
       instr->SetEnvironment(dummy_env_);
@@ -55,15 +59,15 @@
 
   const Function& function() const { return flow_graph_->function(); }
 
-  void AddReturn(Value* value) {
+  ReturnInstr* AddReturn(Value* value) {
     const auto& function = flow_graph_->function();
     const auto representation = FlowGraph::ReturnRepresentationOf(function);
-
     ReturnInstr* instr = new ReturnInstr(
         TokenPos(), value, CompilerState::Current().GetNextDeoptId(),
         PcDescriptorsLayout::kInvalidYieldIndex, representation);
     AddInstruction(instr);
     entry_->set_last_instruction(instr);
+    return instr;
   }
 
   Definition* AddParameter(intptr_t index, bool with_frame) {
@@ -114,6 +118,8 @@
                          TargetEntryInstr* false_successor) {
     auto branch =
         new BranchInstr(comp, CompilerState::Current().GetNextDeoptId());
+    // Some graph transformations use environments from branches.
+    branch->SetEnvironment(dummy_env_);
     current_->AppendInstruction(branch);
     current_ = nullptr;
 
diff --git a/runtime/vm/compiler/backend/compile_type.h b/runtime/vm/compiler/backend/compile_type.h
index f72eb52..32c9949 100644
--- a/runtime/vm/compiler/backend/compile_type.h
+++ b/runtime/vm/compiler/backend/compile_type.h
@@ -239,9 +239,13 @@
     return false;
   }
 
-  bool Specialize(GrowableArray<intptr_t>* class_ids);
+  // Returns true if a value of this CompileType can contain a Smi.
+  // Note that this is not the same as calling
+  // CompileType::Smi().IsAssignableTo(this) - because this compile type
+  // can be uninstantiated.
+  bool CanBeSmi();
 
-  bool IsNotSmi();
+  bool Specialize(GrowableArray<intptr_t>* class_ids);
 
   void PrintTo(BufferFormatter* f) const;
   SExpression* ToSExpression(FlowGraphSerializer* s) const;
diff --git a/runtime/vm/compiler/backend/constant_propagator.cc b/runtime/vm/compiler/backend/constant_propagator.cc
index 67bc54f..ee60614 100644
--- a/runtime/vm/compiler/backend/constant_propagator.cc
+++ b/runtime/vm/compiler/backend/constant_propagator.cc
@@ -1669,9 +1669,12 @@
     if (auto call = defn->AsStaticCall()) {
       ASSERT(!call->HasPushArguments());
     }
-    ConstantInstr* constant = graph_->GetConstant(constant_value_);
-    defn->ReplaceUsesWith(constant);
-    return true;
+    Definition* replacement =
+        graph_->TryCreateConstantReplacementFor(defn, constant_value_);
+    if (replacement != defn) {
+      defn->ReplaceUsesWith(replacement);
+      return true;
+    }
   }
   return false;
 }
diff --git a/runtime/vm/compiler/backend/constant_propagator_test.cc b/runtime/vm/compiler/backend/constant_propagator_test.cc
index 40db6b4..df5c09b 100644
--- a/runtime/vm/compiler/backend/constant_propagator_test.cc
+++ b/runtime/vm/compiler/backend/constant_propagator_test.cc
@@ -6,6 +6,7 @@
 
 #include "vm/compiler/backend/block_builder.h"
 #include "vm/compiler/backend/il_test_helper.h"
+#include "vm/compiler/backend/type_propagator.h"
 #include "vm/unit_test.h"
 
 namespace dart {
@@ -91,4 +92,169 @@
                   it.value()->definition() == v0);
 }
 
+// This test does not work on 32-bit platforms because it requires
+// kUnboxedInt64 constants.
+#if defined(ARCH_IS_64_BIT)
+namespace {
+struct FoldingResult {
+  static FoldingResult NoFold() { return {false, 0}; }
+
+  static FoldingResult FoldsTo(int64_t result) { return {true, result}; }
+
+  bool should_fold;
+  int64_t result;
+};
+
+static void ConstantPropagatorUnboxedOpTest(
+    Thread* thread,
+    int64_t lhs,
+    int64_t rhs,
+    std::function<Definition*(Definition*, Definition*, intptr_t)> make_op,
+    FoldingResult expected) {
+  using compiler::BlockBuilder;
+
+  CompilerState S(thread, /*is_aot=*/false);
+  FlowGraphBuilderHelper H;
+
+  // We are going to build the following graph:
+  //
+  // B0[graph_entry]
+  // B1[function_entry]:
+  //   if 1 == 1 then B2 else B3
+  // B2:
+  //   goto B4
+  // B3:
+  //   goto B4
+  // B4:
+  //   v1 <- Phi(lhs, -1) repr
+  //   v2 <- Constant(rhs)
+  //   v3 <- make_op(v1, v2)
+  //   Return(v3)
+
+  auto b1 = H.flow_graph()->graph_entry()->normal_entry();
+  auto b2 = H.TargetEntry();
+  auto b3 = H.TargetEntry();
+  auto b4 = H.JoinEntry();
+  ReturnInstr* ret;
+
+  {
+    BlockBuilder builder(H.flow_graph(), b1);
+    builder.AddBranch(
+        new StrictCompareInstr(
+            TokenPosition::kNoSource, Token::kEQ_STRICT,
+            new Value(H.IntConstant(1)), new Value(H.IntConstant(1)),
+            /*needs_number_check=*/false, S.GetNextDeoptId()),
+        b2, b3);
+  }
+
+  {
+    BlockBuilder builder(H.flow_graph(), b2);
+    builder.AddInstruction(new GotoInstr(b4, S.GetNextDeoptId()));
+  }
+
+  {
+    BlockBuilder builder(H.flow_graph(), b3);
+    builder.AddInstruction(new GotoInstr(b4, S.GetNextDeoptId()));
+  }
+
+  PhiInstr* v1;
+  Definition* op;
+  {
+    BlockBuilder builder(H.flow_graph(), b4);
+    v1 = H.Phi(b4, {{b2, H.IntConstant(lhs)}, {b3, H.IntConstant(-1)}});
+    builder.AddPhi(v1);
+    op = builder.AddDefinition(
+        make_op(v1, H.IntConstant(rhs), S.GetNextDeoptId()));
+    ret = builder.AddReturn(new Value(op));
+  }
+
+  H.FinishGraph();
+  FlowGraphTypePropagator::Propagate(H.flow_graph());
+  // Force phi unboxing independent of heuristics.
+  v1->set_representation(op->representation());
+  H.flow_graph()->SelectRepresentations();
+  H.flow_graph()->Canonicalize();
+  EXPECT_PROPERTY(ret->value()->definition(),
+                  it.IsBoxInteger() && it.RequiredInputRepresentation(0) ==
+                                           op->representation());
+
+  ConstantPropagator::Optimize(H.flow_graph());
+
+  // If |should_fold| then check that resulting graph is
+  //
+  //         Return(Box(Unbox(Constant(result))))
+  //
+  // otherwise check that the graph is
+  //
+  //         Return(Box(op))
+  //
+  {
+    auto ret_val = ret->value()->definition();
+    EXPECT_PROPERTY(
+        ret_val, it.IsBoxInteger() &&
+                     it.RequiredInputRepresentation(0) == op->representation());
+    auto boxed_value = ret_val->AsBoxInteger()->value()->definition();
+    if (expected.should_fold) {
+      EXPECT_PROPERTY(
+          boxed_value,
+          it.IsUnboxInteger() && it.representation() == op->representation());
+      auto unboxed_value = boxed_value->AsUnboxInteger()->value()->definition();
+      EXPECT_PROPERTY(unboxed_value,
+                      it.IsConstant() && it.AsConstant()->value().IsInteger());
+      EXPECT_EQ(
+          expected.result,
+          Integer::Cast(unboxed_value->AsConstant()->value()).AsInt64Value());
+    } else {
+      EXPECT_PROPERTY(boxed_value, &it == op);
+    }
+  }
+}
+}  // namespace
+
+// This test verifies that constant propagation respects representations when
+// replacing unboxed operations.
+ISOLATE_UNIT_TEST_CASE(ConstantPropagator_Regress35371) {
+  auto make_int64_add = [](Definition* lhs, Definition* rhs,
+                           intptr_t deopt_id) {
+    return new BinaryInt64OpInstr(Token::kADD, new Value(lhs), new Value(rhs),
+                                  deopt_id, Instruction::kNotSpeculative);
+  };
+
+  auto make_int32_add = [](Definition* lhs, Definition* rhs,
+                           intptr_t deopt_id) {
+    return new BinaryInt32OpInstr(Token::kADD, new Value(lhs), new Value(rhs),
+                                  deopt_id);
+  };
+
+  auto make_int32_truncating_add = [](Definition* lhs, Definition* rhs,
+                                      intptr_t deopt_id) {
+    auto op = new BinaryInt32OpInstr(Token::kADD, new Value(lhs),
+                                     new Value(rhs), deopt_id);
+    op->mark_truncating();
+    return op;
+  };
+
+  ConstantPropagatorUnboxedOpTest(thread, /*lhs=*/1, /*lhs=*/2, make_int64_add,
+                                  FoldingResult::FoldsTo(3));
+  ConstantPropagatorUnboxedOpTest(thread, /*lhs=*/kMaxInt64, /*lhs=*/1,
+                                  make_int64_add,
+                                  FoldingResult::FoldsTo(kMinInt64));
+
+  ConstantPropagatorUnboxedOpTest(thread, /*lhs=*/1, /*lhs=*/2, make_int32_add,
+                                  FoldingResult::FoldsTo(3));
+  ConstantPropagatorUnboxedOpTest(thread, /*lhs=*/kMaxInt32 - 1, /*lhs=*/1,
+                                  make_int32_add,
+                                  FoldingResult::FoldsTo(kMaxInt32));
+
+  // Overflow of int32 representation and operation is not marked as truncating.
+  ConstantPropagatorUnboxedOpTest(thread, /*lhs=*/kMaxInt32, /*lhs=*/1,
+                                  make_int32_add, FoldingResult::NoFold());
+
+  // Overflow of int32 representation and operation is marked as truncating.
+  ConstantPropagatorUnboxedOpTest(thread, /*lhs=*/kMaxInt32, /*lhs=*/1,
+                                  make_int32_truncating_add,
+                                  FoldingResult::FoldsTo(kMinInt32));
+}
+#endif
+
 }  // namespace dart
diff --git a/runtime/vm/compiler/backend/evaluator.cc b/runtime/vm/compiler/backend/evaluator.cc
index 8bb0c3d..18e9856 100644
--- a/runtime/vm/compiler/backend/evaluator.cc
+++ b/runtime/vm/compiler/backend/evaluator.cc
@@ -6,31 +6,6 @@
 
 namespace dart {
 
-static bool IsRepresentable(const Integer& value, Representation rep) {
-  switch (rep) {
-    case kTagged:  // Smi case.
-      return value.IsSmi();
-
-    case kUnboxedInt32:
-      if (value.IsSmi() || value.IsMint()) {
-        return Utils::IsInt(32, value.AsInt64Value());
-      }
-      return false;
-
-    case kUnboxedInt64:
-      return value.IsSmi() || value.IsMint();
-
-    case kUnboxedUint32:
-      if (value.IsSmi() || value.IsMint()) {
-        return Utils::IsUint(32, value.AsInt64Value());
-      }
-      return false;
-
-    default:
-      UNREACHABLE();
-  }
-}
-
 static IntegerPtr BinaryIntegerEvaluateRaw(const Integer& left,
                                            const Integer& right,
                                            Token::Kind token_kind) {
@@ -130,8 +105,10 @@
       const int64_t truncated =
           TruncateTo(result.AsTruncatedInt64Value(), representation);
       result = Integer::New(truncated, Heap::kOld);
-      ASSERT(IsRepresentable(result, representation));
-    } else if (!IsRepresentable(result, representation)) {
+      ASSERT(FlowGraph::IsConstantRepresentable(
+          result, representation, /*tagged_value_must_be_smi=*/true));
+    } else if (!FlowGraph::IsConstantRepresentable(
+                   result, representation, /*tagged_value_must_be_smi=*/true)) {
       // If this operation is not truncating it would deoptimize on overflow.
       // Check that we match this behavior and don't produce a value that is
       // larger than something this operation can produce. We could have
@@ -161,7 +138,9 @@
       zone, UnaryIntegerEvaluateRaw(value_int, token_kind, zone));
 
   if (!result.IsNull()) {
-    if (!IsRepresentable(result, representation)) {
+    if (!FlowGraph::IsConstantRepresentable(
+            result, representation,
+            /*tagged_value_must_be_smi=*/true)) {
       // If this operation is not truncating it would deoptimize on overflow.
       // Check that we match this behavior and don't produce a value that is
       // larger than something this operation can produce. We could have
diff --git a/runtime/vm/compiler/backend/flow_graph.cc b/runtime/vm/compiler/backend/flow_graph.cc
index 49ba718..ac20228 100644
--- a/runtime/vm/compiler/backend/flow_graph.cc
+++ b/runtime/vm/compiler/backend/flow_graph.cc
@@ -189,6 +189,56 @@
   return constant;
 }
 
+bool FlowGraph::IsConstantRepresentable(const Object& value,
+                                        Representation target_rep,
+                                        bool tagged_value_must_be_smi) {
+  switch (target_rep) {
+    case kTagged:
+      return !tagged_value_must_be_smi || value.IsSmi();
+
+    case kUnboxedInt32:
+      if (value.IsInteger()) {
+        return Utils::IsInt(32, Integer::Cast(value).AsInt64Value());
+      }
+      return false;
+
+    case kUnboxedUint32:
+      if (value.IsInteger()) {
+        return Utils::IsUint(32, Integer::Cast(value).AsInt64Value());
+      }
+      return false;
+
+    case kUnboxedInt64:
+      return value.IsInteger();
+
+    case kUnboxedDouble:
+      return value.IsInteger() || value.IsDouble();
+
+    default:
+      return false;
+  }
+}
+
+Definition* FlowGraph::TryCreateConstantReplacementFor(Definition* op,
+                                                       const Object& value) {
+  // Check that representation of the constant matches expected representation.
+  if (!IsConstantRepresentable(
+          value, op->representation(),
+          /*tagged_value_must_be_smi=*/op->Type()->IsNullableSmi())) {
+    return op;
+  }
+
+  Definition* result = GetConstant(value);
+  if (op->representation() != kTagged) {
+    // We checked above that constant can be safely unboxed.
+    result = UnboxInstr::Create(op->representation(), new Value(result),
+                                DeoptId::kNone, Instruction::kNotSpeculative);
+    InsertBefore(op, result, nullptr, FlowGraph::kValue);
+  }
+
+  return result;
+}
+
 void FlowGraph::AddToGraphInitialDefinitions(Definition* defn) {
   defn->set_previous(graph_entry_);
   graph_entry_->initial_definitions()->Add(defn);
diff --git a/runtime/vm/compiler/backend/flow_graph.h b/runtime/vm/compiler/backend/flow_graph.h
index 0a9d929..bac38c8 100644
--- a/runtime/vm/compiler/backend/flow_graph.h
+++ b/runtime/vm/compiler/backend/flow_graph.h
@@ -276,6 +276,20 @@
   void AddToInitialDefinitions(BlockEntryWithInitialDefs* entry,
                                Definition* defn);
 
+  // Tries to create a constant definition with the given value which can be
+  // used to replace the given operation. Ensures that the representation of
+  // the replacement matches the representation of the original definition.
+  // If the given value can't be represented using matching representation
+  // then returns op itself.
+  Definition* TryCreateConstantReplacementFor(Definition* op,
+                                              const Object& value);
+
+  // Returns true if the given constant value can be represented in the given
+  // representation.
+  static bool IsConstantRepresentable(const Object& value,
+                                      Representation target_rep,
+                                      bool tagged_value_must_be_smi);
+
   enum UseKind { kEffect, kValue };
 
   void InsertBefore(Instruction* next,
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc
index f50a514..f67f924 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc
@@ -2366,7 +2366,7 @@
   if (int_type.IsSubtypeOf(dst_type, Heap::kOld)) {
     __ BranchIfSmi(TypeTestABI::kInstanceReg, done);
     is_non_smi = true;
-  } else if (receiver_type->IsNotSmi()) {
+  } else if (!receiver_type->CanBeSmi()) {
     is_non_smi = true;
   }
 
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 2808975..34d0381 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -2267,17 +2267,6 @@
   return op;
 }
 
-Definition* BinaryIntegerOpInstr::CreateConstantResult(FlowGraph* flow_graph,
-                                                       const Integer& result) {
-  Definition* result_defn = flow_graph->GetConstant(result);
-  if (representation() != kTagged) {
-    result_defn = UnboxInstr::Create(representation(), new Value(result_defn),
-                                     GetDeoptId());
-    flow_graph->InsertBefore(this, result_defn, env(), FlowGraph::kValue);
-  }
-  return result_defn;
-}
-
 Definition* CheckedSmiOpInstr::Canonicalize(FlowGraph* flow_graph) {
   if ((left()->Type()->ToCid() == kSmiCid) &&
       (right()->Type()->ToCid() == kSmiCid)) {
@@ -2363,7 +2352,7 @@
         is_truncating(), representation(), Thread::Current()));
 
     if (!result.IsNull()) {
-      return CreateConstantResult(flow_graph, result);
+      return flow_graph->TryCreateConstantReplacementFor(this, result);
     }
   }
 
@@ -2478,7 +2467,8 @@
 
     case Token::kMOD:
       if (std::abs(rhs) == 1) {
-        return CreateConstantResult(flow_graph, Object::smi_zero());
+        return flow_graph->TryCreateConstantReplacementFor(this,
+                                                           Object::smi_zero());
       }
       break;
 
@@ -2497,7 +2487,8 @@
             new DeoptimizeInstr(ICData::kDeoptBinarySmiOp, GetDeoptId());
         flow_graph->InsertBefore(this, deopt, env(), FlowGraph::kEffect);
         // Replace with zero since it always throws.
-        return CreateConstantResult(flow_graph, Object::smi_zero());
+        return flow_graph->TryCreateConstantReplacementFor(this,
+                                                           Object::smi_zero());
       }
       break;
 
@@ -2507,7 +2498,8 @@
         return left()->definition();
       } else if ((rhs >= kBitsPerInt64) ||
                  ((rhs >= result_bits) && is_truncating())) {
-        return CreateConstantResult(flow_graph, Object::smi_zero());
+        return flow_graph->TryCreateConstantReplacementFor(this,
+                                                           Object::smi_zero());
       } else if ((rhs < 0) || ((rhs >= result_bits) && !is_truncating())) {
         // Instruction will always throw on negative rhs operand or
         // deoptimize on large rhs operand.
@@ -2521,7 +2513,8 @@
             new DeoptimizeInstr(ICData::kDeoptBinarySmiOp, GetDeoptId());
         flow_graph->InsertBefore(this, deopt, env(), FlowGraph::kEffect);
         // Replace with zero since it overshifted or always throws.
-        return CreateConstantResult(flow_graph, Object::smi_zero());
+        return flow_graph->TryCreateConstantReplacementFor(this,
+                                                           Object::smi_zero());
       }
       break;
     }
@@ -3070,14 +3063,20 @@
 Definition* UnboxIntegerInstr::Canonicalize(FlowGraph* flow_graph) {
   if (!HasUses() && !CanDeoptimize()) return NULL;
 
+  // Do not attempt to fold this instruction if we have not matched
+  // input/output representations yet.
+  if (HasUnmatchedInputRepresentations()) {
+    return this;
+  }
+
   // Fold away UnboxInteger<rep_to>(BoxInteger<rep_from>(v)).
   BoxIntegerInstr* box_defn = value()->definition()->AsBoxInteger();
-  if (box_defn != NULL) {
+  if (box_defn != NULL && !box_defn->HasUnmatchedInputRepresentations()) {
     Representation from_representation =
         box_defn->value()->definition()->representation();
     if (from_representation == representation()) {
       return box_defn->value()->definition();
-    } else if (from_representation != kTagged) {
+    } else {
       // Only operate on explicit unboxed operands.
       IntConverterInstr* converter = new IntConverterInstr(
           from_representation, representation(),
@@ -4479,9 +4478,7 @@
 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
   const Register object = locs()->in(0).reg();
   const Register result = locs()->out(0).reg();
-  const AbstractType& value_type = *this->object()->Type()->ToAbstractType();
-  if (input_can_be_smi_ && (CompileType::Smi().IsAssignableTo(value_type) ||
-                            value_type.IsTypeParameter())) {
+  if (input_can_be_smi_ && this->object()->Type()->CanBeSmi()) {
     if (representation() == kTagged) {
       __ LoadTaggedClassIdMayBeSmi(result, object);
     } else {
@@ -4516,15 +4513,20 @@
   }
 }
 
-bool InstanceCallBaseInstr::HasNonSmiAssignableInterface(Zone* zone) const {
+bool InstanceCallBaseInstr::CanReceiverBeSmiBasedOnInterfaceTarget(
+    Zone* zone) const {
   if (!interface_target().IsNull()) {
+    // Note: target_type is fully instantiated rare type (all type parameters
+    // are replaced with dynamic) so checking if Smi is assignable to
+    // it would compute correctly whether or not receiver can be a smi.
     const AbstractType& target_type = AbstractType::Handle(
         zone, Class::Handle(zone, interface_target().Owner()).RareType());
     if (!CompileType::Smi().IsAssignableTo(target_type)) {
-      return true;
+      return false;
     }
   }
-  return false;
+  // In all other cases conservatively assume that the receiver can be a smi.
+  return true;
 }
 
 Representation InstanceCallBaseInstr::RequiredInputRepresentation(
@@ -4557,12 +4559,8 @@
 
 void InstanceCallBaseInstr::UpdateReceiverSminess(Zone* zone) {
   if (CompilerState::Current().is_aot() && !receiver_is_not_smi()) {
-    if (Receiver()->Type()->IsNotSmi()) {
-      set_receiver_is_not_smi(true);
-      return;
-    }
-
-    if (HasNonSmiAssignableInterface(zone)) {
+    if (!Receiver()->Type()->CanBeSmi() ||
+        !CanReceiverBeSmiBasedOnInterfaceTarget(zone)) {
       set_receiver_is_not_smi(true);
     }
   }
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 9376cab..28e44b9 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -3919,7 +3919,7 @@
   // interface target, CompileType and hints from TFA.
   void UpdateReceiverSminess(Zone* zone);
 
-  bool HasNonSmiAssignableInterface(Zone* zone) const;
+  bool CanReceiverBeSmiBasedOnInterfaceTarget(Zone* zone) const;
 
   virtual SpeculativeMode SpeculativeModeOfInput(intptr_t idx) const {
     if (type_args_len() > 0) {
@@ -5152,11 +5152,10 @@
   intptr_t OffsetInBytes() const { return slot().offset_in_bytes(); }
 
   compiler::Assembler::CanBeSmi CanValueBeSmi() const {
-    const intptr_t cid = value()->Type()->ToNullableCid();
     // Write barrier is skipped for nullable and non-nullable smis.
-    ASSERT(cid != kSmiCid);
-    return cid == kDynamicCid ? compiler::Assembler::kValueCanBeSmi
-                              : compiler::Assembler::kValueIsNotSmi;
+    ASSERT(value()->Type()->ToNullableCid() != kSmiCid);
+    return value()->Type()->CanBeSmi() ? compiler::Assembler::kValueCanBeSmi
+                                       : compiler::Assembler::kValueIsNotSmi;
   }
 
   const Slot& slot_;
@@ -5313,11 +5312,9 @@
 
  private:
   compiler::Assembler::CanBeSmi CanValueBeSmi() const {
-    const intptr_t cid = value()->Type()->ToNullableCid();
-    // Write barrier is skipped for nullable and non-nullable smis.
-    ASSERT(cid != kSmiCid);
-    return cid == kDynamicCid ? compiler::Assembler::kValueCanBeSmi
-                              : compiler::Assembler::kValueIsNotSmi;
+    ASSERT(value()->Type()->ToNullableCid() != kSmiCid);
+    return value()->Type()->CanBeSmi() ? compiler::Assembler::kValueCanBeSmi
+                                       : compiler::Assembler::kValueIsNotSmi;
   }
 
   const Field& field_;
@@ -6103,9 +6100,11 @@
            other_load->input_can_be_smi_ == input_can_be_smi_;
   }
 
+  PRINT_OPERANDS_TO_SUPPORT
+
  private:
-  Representation representation_;
-  bool input_can_be_smi_;
+  const Representation representation_;
+  const bool input_can_be_smi_;
 
   DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr);
 };
@@ -7214,7 +7213,7 @@
       : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) {
     ASSERT(call->type_args_len() == 0);
     ASSERT(!call->IsInstanceCallBase() ||
-           !call->AsInstanceCallBase()->HasNonSmiAssignableInterface(
+           call->AsInstanceCallBase()->CanReceiverBeSmiBasedOnInterfaceTarget(
                Thread::Current()->zone()));
 
     SetInputAt(0, left);
@@ -7258,7 +7257,7 @@
         is_negated_(false) {
     ASSERT(call->type_args_len() == 0);
     ASSERT(!call->IsInstanceCallBase() ||
-           !call->AsInstanceCallBase()->HasNonSmiAssignableInterface(
+           call->AsInstanceCallBase()->CanReceiverBeSmiBasedOnInterfaceTarget(
                Thread::Current()->zone()));
 
     SetInputAt(0, left);
diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc
index 5175f1e..ee55212 100644
--- a/runtime/vm/compiler/backend/il_printer.cc
+++ b/runtime/vm/compiler/backend/il_printer.cc
@@ -774,6 +774,13 @@
   value()->PrintTo(f);
 }
 
+void LoadClassIdInstr::PrintOperandsTo(BufferFormatter* f) const {
+  if (!input_can_be_smi_) {
+    f->Print("<non-smi> ");
+  }
+  object()->PrintTo(f);
+}
+
 void CheckClassIdInstr::PrintOperandsTo(BufferFormatter* f) const {
   value()->PrintTo(f);
 
diff --git a/runtime/vm/compiler/backend/type_propagator.cc b/runtime/vm/compiler/backend/type_propagator.cc
index 763710b..97efd0f 100644
--- a/runtime/vm/compiler/backend/type_propagator.cc
+++ b/runtime/vm/compiler/backend/type_propagator.cc
@@ -780,21 +780,6 @@
   return type_;
 }
 
-bool CompileType::IsNotSmi() {
-  if (cid_ != kIllegalCid && cid_ != kDynamicCid && cid_ != kSmiCid) {
-    return true;
-  }
-  const AbstractType* type = ToAbstractType();
-  if (type->IsTypeParameter()) {
-    type = &AbstractType::Handle(TypeParameter::Cast(*type).bound());
-  }
-
-  // TODO(sjindel): Use instantiate-to-bounds instead.
-  if (!type->IsInstantiated()) return false;
-  const AbstractType& smi = AbstractType::Handle(Type::SmiType());
-  return !smi.IsSubtypeOf(*type, Heap::Space::kNew);
-}
-
 bool CompileType::IsSubtypeOf(const AbstractType& other) {
   if (other.IsTopTypeForSubtyping()) {
     return true;
@@ -849,6 +834,49 @@
   return false;
 }
 
+// For the given type conservatively computes whether Smi can potentially
+// appear in a location of this type.
+//
+// If recurse is false this function will not call itself recursively
+// to prevent infinite recursion when traversing a cycle in type parameter
+// bounds.
+static bool CanPotentiallyBeSmi(const AbstractType& type, bool recurse) {
+  if (type.IsInstantiated()) {
+    return CompileType::Smi().IsAssignableTo(type);
+  } else if (type.IsTypeParameter()) {
+    // For type parameters look at their bounds (if recurse allows us).
+    const auto& param = TypeParameter::Cast(type);
+    return !recurse || CanPotentiallyBeSmi(AbstractType::Handle(param.bound()),
+                                           /*recurse=*/false);
+  } else if (type.HasTypeClass()) {
+    // If this is an unstantiated type then it can only potentially be a super
+    // type of a Smi if it is either FutureOr<...> or Comparable<...>.
+    // In which case we need to look at the type argument to determine whether
+    // this location can contain a smi.
+    //
+    // Note: we are making a simplification here. This approach will yield
+    // true for Comparable<T> where T extends int - while in reality Smi is
+    // *not* assignable to it (because int implements Comparable<num> and not
+    // Comparable<int>).
+    if (type.IsFutureOrType() ||
+        type.type_class() == CompilerState::Current().ComparableClass().raw()) {
+      const auto& args = TypeArguments::Handle(Type::Cast(type).arguments());
+      const auto& arg0 = AbstractType::Handle(args.TypeAt(0));
+      return !recurse || CanPotentiallyBeSmi(arg0, /*recurse=*/true);
+    }
+    return false;
+  }
+  return false;
+}
+
+bool CompileType::CanBeSmi() {
+  // Fast path for known cid.
+  if (cid_ != kIllegalCid && cid_ != kDynamicCid) {
+    return cid_ == kSmiCid;
+  }
+  return CanPotentiallyBeSmi(*ToAbstractType(), /*recurse=*/true);
+}
+
 void CompileType::PrintTo(BufferFormatter* f) const {
   const char* type_name = "?";
   if (IsNone()) {
diff --git a/runtime/vm/compiler/backend/type_propagator_test.cc b/runtime/vm/compiler/backend/type_propagator_test.cc
index aacaf44..b28c415 100644
--- a/runtime/vm/compiler/backend/type_propagator_test.cc
+++ b/runtime/vm/compiler/backend/type_propagator_test.cc
@@ -396,4 +396,83 @@
                   it.IsObjectType() || it.IsNumberType());
 }
 
+ISOLATE_UNIT_TEST_CASE(CompileType_CanBeSmi) {
+  CompilerState S(thread, /*is_aot=*/false);
+
+  const auto& lib = Library::Handle(LoadTestScript(R"(
+import 'dart:async';
+
+class G<T> {}
+
+class C<NoBound,
+        NumBound extends num,
+        ComparableBound extends Comparable,
+        StringBound extends String> {
+  // Simple instantiated types.
+  @pragma('vm-test:can-be-smi') int t1;
+  @pragma('vm-test:can-be-smi') num t2;
+  @pragma('vm-test:can-be-smi') Object t3;
+  String t4;
+
+  // Type parameters.
+  @pragma('vm-test:can-be-smi') NoBound tp1;
+  @pragma('vm-test:can-be-smi') NumBound tp2;
+  @pragma('vm-test:can-be-smi') ComparableBound tp3;
+  StringBound tp4;
+
+  // Comparable<T> instantiations.
+  @pragma('vm-test:can-be-smi') Comparable c1;
+  Comparable<String> c2;
+  @pragma('vm-test:can-be-smi') Comparable<num> c3;
+  Comparable<int> c4;  // int is not a subtype of Comparable<int>.
+  @pragma('vm-test:can-be-smi') Comparable<NoBound> c5;
+  @pragma('vm-test:can-be-smi') Comparable<NumBound> c6;
+  @pragma('vm-test:can-be-smi') Comparable<ComparableBound> c7;
+  Comparable<StringBound> c8;
+
+  // FutureOr<T> instantiations.
+  @pragma('vm-test:can-be-smi') FutureOr fo1;
+  FutureOr<String> fo2;
+  @pragma('vm-test:can-be-smi') FutureOr<num> fo3;
+  @pragma('vm-test:can-be-smi') FutureOr<int> fo4;
+  @pragma('vm-test:can-be-smi') FutureOr<NoBound> fo5;
+  @pragma('vm-test:can-be-smi') FutureOr<NumBound> fo6;
+  @pragma('vm-test:can-be-smi') FutureOr<ComparableBound> fo7;
+  FutureOr<StringBound> fo8;
+
+  // Other generic classes.
+  G<int> g1;
+  G<NoBound> g2;
+}
+)"));
+
+  const auto& pragma_can_be_smi =
+      String::Handle(Symbols::New(thread, "vm-test:can-be-smi"));
+  auto expected_can_be_smi = [&](const Field& f) {
+    auto& options = Object::Handle();
+    return lib.FindPragma(thread, /*only_core=*/false, f, pragma_can_be_smi,
+                          &options);
+  };
+
+  const auto& cls = Class::Handle(GetClass(lib, "C"));
+  const auto& err = Error::Handle(cls.EnsureIsFinalized(thread));
+  EXPECT(err.IsNull());
+  const auto& fields = Array::Handle(cls.fields());
+
+  auto& field = Field::Handle();
+  auto& type = AbstractType::Handle();
+  for (intptr_t i = 0; i < fields.Length(); i++) {
+    field ^= fields.At(i);
+    type = field.type();
+
+    auto compile_type = CompileType::FromAbstractType(type);
+    if (compile_type.CanBeSmi() != expected_can_be_smi(field)) {
+      dart::Expect(__FILE__, __LINE__)
+          .Fail("expected that CanBeSmi() returns %s for compile type %s\n",
+                expected_can_be_smi(field) ? "true" : "false",
+                compile_type.ToCString());
+    }
+  }
+}
+
 }  // namespace dart
diff --git a/runtime/vm/compiler/call_specializer.cc b/runtime/vm/compiler/call_specializer.cc
index bcf1f47..2d88440 100644
--- a/runtime/vm/compiler/call_specializer.cc
+++ b/runtime/vm/compiler/call_specializer.cc
@@ -116,7 +116,7 @@
       // In precompiler speculate that both sides of bitwise operation
       // are Smi-s.
       if (Token::IsBinaryBitwiseOperator(op_kind) &&
-          !call->HasNonSmiAssignableInterface(zone())) {
+          call->CanReceiverBeSmiBasedOnInterfaceTarget(zone())) {
         class_ids[0] = kSmiCid;
         class_ids[1] = kSmiCid;
       }
@@ -127,7 +127,7 @@
       // Guess cid: if one of the inputs is a number assume that the other
       // is a number of same type, unless the interface target tells us this
       // is impossible.
-      if (!call->HasNonSmiAssignableInterface(zone())) {
+      if (call->CanReceiverBeSmiBasedOnInterfaceTarget(zone())) {
         const intptr_t cid_0 = class_ids[0];
         const intptr_t cid_1 = class_ids[1];
         if ((cid_0 == kDynamicCid) && (IsNumberCid(cid_1))) {
diff --git a/runtime/vm/compiler/compiler_state.cc b/runtime/vm/compiler/compiler_state.cc
index e3e129e..ed8dc49 100644
--- a/runtime/vm/compiler/compiler_state.cc
+++ b/runtime/vm/compiler/compiler_state.cc
@@ -6,6 +6,7 @@
 
 #include <functional>
 
+#include "vm/compiler/aot/precompiler.h"
 #include "vm/compiler/backend/il_printer.h"
 #include "vm/compiler/backend/slot.h"
 #include "vm/growable_array.h"
@@ -76,4 +77,25 @@
                                              : CompilerTracing::kOff;
 }
 
+const Class& CompilerState::ComparableClass() {
+  if (comparable_class_ == nullptr) {
+    Thread* thread = Thread::Current();
+    Zone* zone = thread->zone();
+
+    // When obfuscation is enabled we need to obfuscate the name of the
+    // class before looking it up.
+    String& name = String::Handle(zone, Symbols::New(thread, "Comparable"));
+    if (thread->isolate()->obfuscate()) {
+      Obfuscator obfuscator(thread, Object::null_string());
+      name = obfuscator.Rename(name);
+    }
+
+    const Library& lib = Library::Handle(zone, Library::CoreLibrary());
+    const Class& cls = Class::ZoneHandle(zone, lib.LookupClass(name));
+    ASSERT(!cls.IsNull());
+    comparable_class_ = &cls;
+  }
+  return *comparable_class_;
+}
+
 }  // namespace dart
diff --git a/runtime/vm/compiler/compiler_state.h b/runtime/vm/compiler/compiler_state.h
index c059c77..c394822 100644
--- a/runtime/vm/compiler/compiler_state.h
+++ b/runtime/vm/compiler/compiler_state.h
@@ -93,7 +93,7 @@
   // same index.
   //
   // TODO(vegorov): disambiguate slots for different context IDs.
-  // Beware that context_id is satured at 8-bits, so multiple contexts may
+  // Beware that context_id is saturated at 8-bits, so multiple contexts may
   // share id 255.
   LocalVariable* GetDummyCapturedVariable(intptr_t context_id, intptr_t index);
 
@@ -105,6 +105,9 @@
 
   static CompilerTracing ShouldTrace(const Function& func);
 
+  // Returns class Comparable<T> from dart:core.
+  const Class& ComparableClass();
+
  private:
   CHA cha_;
   intptr_t deopt_id_ = 0;
@@ -121,6 +124,10 @@
 
   const CompilerTracing tracing_;
 
+  // Lookup cache for various classes (to avoid polluting object store with
+  // compiler specific classes).
+  const Class* comparable_class_ = nullptr;
+
   CompilerState* previous_;
 };
 
diff --git a/runtime/vm/compiler/method_recognizer.cc b/runtime/vm/compiler/method_recognizer.cc
index 9fb302e..ba5f065 100644
--- a/runtime/vm/compiler/method_recognizer.cc
+++ b/runtime/vm/compiler/method_recognizer.cc
@@ -356,10 +356,14 @@
     return kDynamicCid;
   }
 
-  if ((owner.Name() == Symbols::List().raw()) &&
-      (function.name() == Symbols::ListFactory().raw())) {
-    ASSERT(argument_count == 1 || argument_count == 2);
-    return (argument_count == 1) ? kGrowableObjectArrayCid : kArrayCid;
+  if (owner.Name() == Symbols::List().raw()) {
+    if (function.name() == Symbols::ListFactory().raw()) {
+      ASSERT(argument_count == 1 || argument_count == 2);
+      return (argument_count == 1) ? kGrowableObjectArrayCid : kArrayCid;
+    } else if (function.name() == Symbols::ListFilledFactory().raw()) {
+      ASSERT(argument_count == 3 || argument_count == 4);
+      return (argument_count == 3) ? kArrayCid : kDynamicCid;
+    }
   }
 
   return ResultCid(function);
diff --git a/runtime/vm/compiler/stub_code_compiler_arm.cc b/runtime/vm/compiler/stub_code_compiler_arm.cc
index 53f4ff6..997d851 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm.cc
@@ -2895,6 +2895,9 @@
 
   // Loop initialization (moved up here to avoid having all dependent loads
   // after each other).
+
+  // We avoid a load-acquire barrier here by relying on the fact that all other
+  // loads from the array are data-dependent loads.
   __ ldr(TypeTestABI::kSubtypeTestCacheReg,
          FieldAddress(TypeTestABI::kSubtypeTestCacheReg,
                       target::SubtypeTestCache::cache_offset()));
@@ -3666,15 +3669,20 @@
   __ AddImmediate(R0, compiler::target::Array::data_offset() - kHeapObjectTag);
   // The instantiations cache is initialized with Object::zero_array() and is
   // therefore guaranteed to contain kNoInstantiator. No length check needed.
-  compiler::Label loop, next, found;
+  compiler::Label loop, next, found, call_runtime;
   __ Bind(&loop);
-  __ ldr(R4, compiler::Address(
-                 R0, TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
-                         target::kWordSize));
+
+  // Use load-acquire to test for sentinel, if we found non-sentinel it is safe
+  // to access the other entries. If we found a sentinel we go to runtime.
+  __ LoadAcquire(R4, R0,
+                 TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
+                     target::kWordSize);
+  __ CompareImmediate(R4, Smi::RawValue(TypeArguments::kNoInstantiator));
+  __ b(&call_runtime, EQ);
+
   __ cmp(R4,
          compiler::Operand(InstantiationABI::kInstantiatorTypeArgumentsReg));
   __ b(&next, NE);
-  // Using IP as destination register and reading it immediately is safe.
   __ ldr(IP, compiler::Address(
                  R0, TypeArguments::Instantiation::kFunctionTypeArgsIndex *
                          target::kWordSize));
@@ -3683,11 +3691,11 @@
   __ Bind(&next);
   __ AddImmediate(
       R0, TypeArguments::Instantiation::kSizeInWords * target::kWordSize);
-  __ CompareImmediate(R4, Smi::RawValue(TypeArguments::kNoInstantiator));
-  __ b(&loop, NE);
+  __ b(&loop);
 
   // Instantiate non-null type arguments.
   // A runtime call to instantiate the type arguments is required.
+  __ Bind(&call_runtime);
   __ EnterStubFrame();
   __ PushObject(Object::null_object());  // Make room for the result.
   static_assert((InstantiationABI::kUninstantiatedTypeArgumentsReg >
diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc
index 5b74a2e..b4051d2 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc
@@ -3022,6 +3022,9 @@
 
   // Loop initialization (moved up here to avoid having all dependent loads
   // after each other).
+
+  // We avoid a load-acquire barrier here by relying on the fact that all other
+  // loads from the array are data-dependent loads.
   __ ldr(TypeTestABI::kSubtypeTestCacheReg,
          FieldAddress(TypeTestABI::kSubtypeTestCacheReg,
                       target::SubtypeTestCache::cache_offset()));
@@ -3806,11 +3809,17 @@
   __ AddImmediate(R0, Array::data_offset() - kHeapObjectTag);
   // The instantiations cache is initialized with Object::zero_array() and is
   // therefore guaranteed to contain kNoInstantiator. No length check needed.
-  compiler::Label loop, next, found;
+  compiler::Label loop, next, found, call_runtime;
   __ Bind(&loop);
-  __ LoadFromOffset(R5, R0,
-                    TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
-                        target::kWordSize);
+
+  // Use load-acquire to test for sentinel, if we found non-sentinel it is safe
+  // to access the other entries. If we found a sentinel we go to runtime.
+  __ LoadAcquire(R5, R0,
+                 TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
+                     target::kWordSize);
+  __ CompareImmediate(R5, Smi::RawValue(TypeArguments::kNoInstantiator));
+  __ b(&call_runtime, EQ);
+
   __ CompareRegisters(R5, InstantiationABI::kInstantiatorTypeArgumentsReg);
   __ b(&next, NE);
   __ LoadFromOffset(
@@ -3821,11 +3830,11 @@
   __ Bind(&next);
   __ AddImmediate(
       R0, TypeArguments::Instantiation::kSizeInWords * target::kWordSize);
-  __ CompareImmediate(R5, Smi::RawValue(TypeArguments::kNoInstantiator));
-  __ b(&loop, NE);
+  __ b(&loop);
 
   // Instantiate non-null type arguments.
   // A runtime call to instantiate the type arguments is required.
+  __ Bind(&call_runtime);
   __ EnterStubFrame();
   __ PushPair(InstantiationABI::kUninstantiatedTypeArgumentsReg, NULL_REG);
   __ PushPair(InstantiationABI::kFunctionTypeArgumentsReg,
diff --git a/runtime/vm/compiler/stub_code_compiler_ia32.cc b/runtime/vm/compiler/stub_code_compiler_ia32.cc
index d7cbd37..a4d8449 100644
--- a/runtime/vm/compiler/stub_code_compiler_ia32.cc
+++ b/runtime/vm/compiler/stub_code_compiler_ia32.cc
@@ -2398,6 +2398,8 @@
   // Loop initialization (moved up here to avoid having all dependent loads
   // after each other)
   __ movl(EDX, Address(ESP, kCacheOffsetInBytes));
+  // We avoid a load-acquire barrier here by relying on the fact that all other
+  // loads from the array are data-dependent loads.
   __ movl(EDX, FieldAddress(EDX, target::SubtypeTestCache::cache_offset()));
   __ addl(EDX, Immediate(target::Array::data_offset() - kHeapObjectTag));
 
@@ -2932,12 +2934,17 @@
   __ leal(EAX, compiler::FieldAddress(EAX, Array::data_offset()));
   // The instantiations cache is initialized with Object::zero_array() and is
   // therefore guaranteed to contain kNoInstantiator. No length check needed.
-  compiler::Label loop, next, found;
+  compiler::Label loop, next, found, call_runtime;
   __ Bind(&loop);
-  __ movl(EDI,
-          compiler::Address(
-              EAX, TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
-                       target::kWordSize));
+
+  // Use load-acquire to test for sentinel, if we found non-sentinel it is safe
+  // to access the other entries. If we found a sentinel we go to runtime.
+  __ LoadAcquire(EDI, EAX,
+                 TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
+                     target::kWordSize);
+  __ CompareImmediate(EDI, Smi::RawValue(TypeArguments::kNoInstantiator));
+  __ j(EQUAL, &call_runtime, compiler::Assembler::kNearJump);
+
   __ cmpl(EDI, InstantiationABI::kInstantiatorTypeArgumentsReg);
   __ j(NOT_EQUAL, &next, compiler::Assembler::kNearJump);
   __ movl(EBX, compiler::Address(
@@ -2948,12 +2955,11 @@
   __ Bind(&next);
   __ addl(EAX, compiler::Immediate(TypeArguments::Instantiation::kSizeInWords *
                                    target::kWordSize));
-  __ cmpl(EDI,
-          compiler::Immediate(Smi::RawValue(TypeArguments::kNoInstantiator)));
-  __ j(NOT_EQUAL, &loop, compiler::Assembler::kNearJump);
+  __ jmp(&loop, compiler::Assembler::kNearJump);
 
   // Instantiate non-null type arguments.
   // A runtime call to instantiate the type arguments is required.
+  __ Bind(&call_runtime);
   __ popl(InstantiationABI::kUninstantiatedTypeArgumentsReg);  // Restore reg.
   __ EnterStubFrame();
   __ PushObject(Object::null_object());  // Make room for the result.
diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc
index 6b8a5b8..a65b7e4 100644
--- a/runtime/vm/compiler/stub_code_compiler_x64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_x64.cc
@@ -2949,6 +2949,9 @@
 
   // Loop initialization (moved up here to avoid having all dependent loads
   // after each other).
+
+  // We avoid a load-acquire barrier here by relying on the fact that all other
+  // loads from the array are data-dependent loads.
   __ movq(RSI, FieldAddress(TypeTestABI::kSubtypeTestCacheReg,
                             target::SubtypeTestCache::cache_offset()));
   __ addq(RSI, Immediate(target::Array::data_offset() - kHeapObjectTag));
@@ -3706,14 +3709,20 @@
                    InstantiationABI::kUninstantiatedTypeArgumentsReg,
                    target::TypeArguments::instantiations_offset()));
   __ leaq(RAX, compiler::FieldAddress(RAX, Array::data_offset()));
+
   // The instantiations cache is initialized with Object::zero_array() and is
   // therefore guaranteed to contain kNoInstantiator. No length check needed.
-  compiler::Label loop, next, found;
+  compiler::Label loop, next, found, call_runtime;
   __ Bind(&loop);
-  __ movq(RDI,
-          compiler::Address(
-              RAX, TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
-                       target::kWordSize));
+
+  // Use load-acquire to test for sentinel, if we found non-sentinel it is safe
+  // to access the other entries. If we found a sentinel we go to runtime.
+  __ LoadAcquire(RDI, RAX,
+                 TypeArguments::Instantiation::kInstantiatorTypeArgsIndex *
+                     target::kWordSize);
+  __ CompareImmediate(RDI, Smi::RawValue(TypeArguments::kNoInstantiator));
+  __ j(EQUAL, &call_runtime, compiler::Assembler::kNearJump);
+
   __ cmpq(RDI, InstantiationABI::kInstantiatorTypeArgumentsReg);
   __ j(NOT_EQUAL, &next, compiler::Assembler::kNearJump);
   __ movq(R10, compiler::Address(
@@ -3724,12 +3733,11 @@
   __ Bind(&next);
   __ addq(RAX, compiler::Immediate(TypeArguments::Instantiation::kSizeInWords *
                                    target::kWordSize));
-  __ cmpq(RDI,
-          compiler::Immediate(Smi::RawValue(TypeArguments::kNoInstantiator)));
-  __ j(NOT_EQUAL, &loop, compiler::Assembler::kNearJump);
+  __ jmp(&loop);
 
   // Instantiate non-null type arguments.
   // A runtime call to instantiate the type arguments is required.
+  __ Bind(&call_runtime);
   __ EnterStubFrame();
   __ PushObject(Object::null_object());  // Make room for the result.
   __ pushq(InstantiationABI::kUninstantiatedTypeArgumentsReg);
diff --git a/runtime/vm/constants_arm.h b/runtime/vm/constants_arm.h
index 3670ea5..04b3f76 100644
--- a/runtime/vm/constants_arm.h
+++ b/runtime/vm/constants_arm.h
@@ -963,6 +963,7 @@
 float ReciprocalSqrtStep(float op1, float op2);
 
 constexpr uword kBreakInstructionFiller = 0xE1200070;  // bkpt #0
+constexpr uword kDataMemoryBarrier = 0xf57ff050 | 0xb;  // dmb ish
 
 }  // namespace dart
 
diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h
index 859db5b..1ce41e1 100644
--- a/runtime/vm/constants_arm64.h
+++ b/runtime/vm/constants_arm64.h
@@ -585,6 +585,8 @@
   LoadStoreExclusiveFixed = B27,
   LDXR = LoadStoreExclusiveFixed | B22,
   STXR = LoadStoreExclusiveFixed,
+  LDAR = LoadStoreExclusiveFixed | B23 | B22 | B15,
+  STLR = LoadStoreExclusiveFixed | B23 | B15,
 };
 
 // C3.3.7-10
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 06afb21..979bd2b 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -617,12 +617,7 @@
   Timeline::Cleanup();
 #endif
   Zone::Cleanup();
-  // Delete the current thread's TLS and set it's TLS to null.
-  // If it is the last thread then the destructor would call
-  // OSThread::Cleanup.
-  OSThread* os_thread = OSThread::Current();
-  OSThread::SetCurrent(NULL);
-  delete os_thread;
+  OSThread::Cleanup();
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleted os_thread\n",
                  UptimeMillis());
diff --git a/runtime/vm/elf.cc b/runtime/vm/elf.cc
index 7fb427c4..6f8f5da 100644
--- a/runtime/vm/elf.cc
+++ b/runtime/vm/elf.cc
@@ -31,18 +31,61 @@
 static const intptr_t kElfSymbolHashTableEntrySize = 4;
 #endif
 
+// A wrapper around StreamingWriteStream that provides methods useful for
+// writing ELF files (e.g., using ELF definitions of data sizes).
+class ElfWriteStream : public ValueObject {
+ public:
+  explicit ElfWriteStream(StreamingWriteStream* stream)
+      : stream_(ASSERT_NOTNULL(stream)) {}
+
+  intptr_t position() const { return stream_->position(); }
+  void Align(const intptr_t alignment) {
+    ASSERT(Utils::IsPowerOfTwo(alignment));
+    stream_->Align(alignment);
+  }
+  void WriteBytes(const uint8_t* b, intptr_t size) {
+    stream_->WriteBytes(b, size);
+  }
+  void WriteByte(uint8_t value) {
+    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
+  }
+  void WriteHalf(uint16_t value) {
+    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
+  }
+  void WriteWord(uint32_t value) {
+    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
+  }
+  void WriteAddr(compiler::target::uword value) {
+    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
+  }
+  void WriteOff(compiler::target::uword value) {
+    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
+  }
+#if defined(TARGET_ARCH_IS_64_BIT)
+  void WriteXWord(uint64_t value) {
+    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
+  }
+#endif
+
+ private:
+  StreamingWriteStream* const stream_;
+};
+
 #define DEFINE_LINEAR_FIELD_METHODS(name, type, init)                          \
   type name() const {                                                          \
     ASSERT(name##_ != init);                                                   \
     return name##_;                                                            \
   }                                                                            \
   void set_##name(type value) {                                                \
-    ASSERT(name##_ == init);                                                   \
+    ASSERT_EQUAL(name##_, init);                                               \
     name##_ = value;                                                           \
   }
 
 #define DEFINE_LINEAR_FIELD(name, type, init) type name##_ = init;
 
+// Used for segments that should not be used as sections.
+static constexpr intptr_t kInvalidSection = -1;
+
 class Section : public ZoneAllocated {
  public:
   Section(intptr_t type,
@@ -58,8 +101,11 @@
         segment_flags(EncodeSegmentFlags(allocate, executable, writable)),
         // Non-segments will never have a memory offset, here represented by 0.
         memory_offset_(allocate ? -1 : 0) {
-    // Only the reserved section (type 0) should have an alignment of 0.
-    ASSERT(type == 0 || alignment > 0);
+    // Only the reserved section (type 0) has (and must have) an alignment of 0.
+    ASSERT(type == elf::SHT_NULL || alignment > 0);
+    ASSERT(alignment == 0 || type != elf::SHT_NULL);
+    // Segment-only entries should have a set segment_type.
+    ASSERT(type != kInvalidSection || segment_type != elf::PT_NULL);
   }
 
   // The constructor that most subclasses will use.
@@ -69,7 +115,7 @@
           bool writable,
           intptr_t alignment = 1)
       : Section(type,
-                /*segment_type=*/allocate ? elf::PT_LOAD : 0,
+                /*segment_type=*/allocate ? elf::PT_LOAD : elf::PT_NULL,
                 allocate,
                 executable,
                 writable,
@@ -124,10 +170,11 @@
     }
   }
 
-  virtual void Write(Elf* stream) = 0;
+  virtual void Write(ElfWriteStream* stream) = 0;
 
-  void WriteSegmentEntry(Elf* stream) {
+  void WriteSegmentEntry(ElfWriteStream* stream) {
     // This should never be used on sections without a segment.
+    ASSERT(segment_type != elf::PT_NULL);
     ASSERT(MemorySize() > 0);
 #if defined(TARGET_ARCH_IS_32_BIT)
     stream->WriteWord(segment_type);
@@ -150,7 +197,9 @@
 #endif
   }
 
-  void WriteSectionEntry(Elf* stream) {
+  void WriteSectionEntry(ElfWriteStream* stream) {
+    // Segment-only entries should not be in sections_.
+    ASSERT(section_type != kInvalidSection);
 #if defined(TARGET_ARCH_IS_32_BIT)
     stream->WriteWord(section_name());
     stream->WriteWord(section_type);
@@ -216,7 +265,7 @@
 class ReservedSection : public Section {
  public:
   ReservedSection()
-      : Section(/*type=*/0,
+      : Section(/*type=*/elf::SHT_NULL,
                 /*allocate=*/false,
                 /*executable=*/false,
                 /*writable=*/false,
@@ -228,7 +277,7 @@
 
   intptr_t FileSize() const { return 0; }
   intptr_t MemorySize() const { return 0; }
-  void Write(Elf* stream) {}
+  void Write(ElfWriteStream* stream) {}
 };
 
 class BlobSection : public Section {
@@ -264,7 +313,7 @@
   intptr_t FileSize() const { return file_size_; }
   intptr_t MemorySize() const { return memory_size_; }
 
-  virtual void Write(Elf* stream) = 0;
+  virtual void Write(ElfWriteStream* stream) = 0;
 
  private:
   const intptr_t file_size_;
@@ -276,7 +325,7 @@
 class ProgramTableSelfSegment : public BlobSection {
  public:
   ProgramTableSelfSegment(intptr_t offset, intptr_t size)
-      : BlobSection(/*type=*/0,
+      : BlobSection(/*type=*/kInvalidSection,
                     /*segment_type=*/elf::PT_PHDR,
                     /*allocate=*/true,
                     /*executable=*/false,
@@ -287,7 +336,7 @@
     set_memory_offset(offset);
   }
 
-  void Write(Elf* stream) { UNREACHABLE(); }
+  void Write(ElfWriteStream* stream) { UNREACHABLE(); }
 };
 
 // A segment for representing the program header table load segment in the
@@ -303,7 +352,7 @@
   // The bug is here:
   //   https://github.com/aosp-mirror/platform_bionic/blob/94963af28e445384e19775a838a29e6a71708179/linker/linker.c#L1991-L2001
   explicit ProgramTableLoadSegment(intptr_t size)
-      : BlobSection(/*type=*/0,
+      : BlobSection(/*type=*/kInvalidSection,
                     /*allocate=*/true,
                     /*executable=*/false,
                     /*writable=*/true,
@@ -313,7 +362,7 @@
     set_memory_offset(0);
   }
 
-  void Write(Elf* stream) { UNREACHABLE(); }
+  void Write(ElfWriteStream* stream) { UNREACHABLE(); }
 };
 
 class ProgramBits : public BlobSection {
@@ -332,7 +381,7 @@
                     memsz != -1 ? memsz : filesz),
         bytes_(ASSERT_NOTNULL(bytes)) {}
 
-  void Write(Elf* stream) { stream->WriteBytes(bytes_, FileSize()); }
+  void Write(ElfWriteStream* stream) { stream->WriteBytes(bytes_, FileSize()); }
 
   const uint8_t* bytes_;
 };
@@ -347,7 +396,7 @@
                     /*filesz=*/0,
                     memsz) {}
 
-  void Write(Elf* stream) {}
+  void Write(ElfWriteStream* stream) {}
 };
 
 class StringTable : public Section {
@@ -367,7 +416,7 @@
   intptr_t FileSize() const { return text_.length(); }
   intptr_t MemorySize() const { return dynamic_ ? FileSize() : 0; }
 
-  void Write(Elf* stream) {
+  void Write(ElfWriteStream* stream) {
     stream->WriteBytes(reinterpret_cast<const uint8_t*>(text_.buffer()),
                        text_.length());
   }
@@ -406,7 +455,7 @@
         size(size),
         cstr_(cstr) {}
 
-  void Write(Elf* stream) const {
+  void Write(ElfWriteStream* stream) const {
     stream->WriteWord(name_index);
 #if defined(TARGET_ARCH_IS_32_BIT)
     stream->WriteAddr(offset);
@@ -454,13 +503,13 @@
   intptr_t FileSize() const { return Length() * kElfSymbolTableEntrySize; }
   intptr_t MemorySize() const { return dynamic_ ? FileSize() : 0; }
 
-  void Write(Elf* stream) {
+  void Write(ElfWriteStream* stream) {
     for (intptr_t i = 0; i < Length(); i++) {
       auto const symbol = At(i);
       const intptr_t start = stream->position();
       symbol->Write(stream);
       const intptr_t end = stream->position();
-      ASSERT((end - start) == kElfSymbolTableEntrySize);
+      ASSERT_EQUAL(end - start, kElfSymbolTableEntrySize);
     }
   }
 
@@ -530,7 +579,7 @@
   intptr_t FileSize() const { return 4 * (nbucket_ + nchain_ + 2); }
   intptr_t MemorySize() const { return FileSize(); }
 
-  void Write(Elf* stream) {
+  void Write(ElfWriteStream* stream) {
     stream->WriteWord(nbucket_);
     stream->WriteWord(nchain_);
     for (intptr_t i = 0; i < nbucket_; i++) {
@@ -572,7 +621,7 @@
   }
   intptr_t MemorySize() const { return FileSize(); }
 
-  void Write(Elf* stream) {
+  void Write(ElfWriteStream* stream) {
     for (intptr_t i = 0; i < entries_.length(); i++) {
       const intptr_t start = stream->position();
 #if defined(TARGET_ARCH_IS_32_BIT)
@@ -583,7 +632,7 @@
       stream->WriteAddr(entries_[i]->value);
 #endif
       const intptr_t end = stream->position();
-      ASSERT((end - start) == kElfDynamicTableEntrySize);
+      ASSERT_EQUAL(end - start, kElfDynamicTableEntrySize);
     }
   }
 
@@ -609,7 +658,7 @@
 class DynamicSegment : public BlobSection {
  public:
   explicit DynamicSegment(DynamicTable* dynamic)
-      : BlobSection(dynamic->section_type,
+      : BlobSection(/*type=*/kInvalidSection,
                     /*segment_type=*/elf::PT_DYNAMIC,
                     /*allocate=*/true,
                     /*executable=*/false,
@@ -619,21 +668,21 @@
     set_memory_offset(dynamic->memory_offset());
   }
 
-  void Write(Elf* stream) { UNREACHABLE(); }
+  void Write(ElfWriteStream* stream) { UNREACHABLE(); }
 };
 
 static const intptr_t kProgramTableSegmentSize = Elf::kPageSize;
 
 Elf::Elf(Zone* zone, StreamingWriteStream* stream, bool strip)
     : zone_(zone),
-      stream_(stream),
+      unwrapped_stream_(stream),
       strip_(strip),
       shstrtab_(new (zone) StringTable(/*allocate=*/false)),
       dynstrtab_(new (zone) StringTable(/*allocate=*/true)),
       dynsym_(new (zone) SymbolTable(/*dynamic=*/true)),
       memory_offset_(kProgramTableSegmentSize) {
   // Assumed by various offset logic in this file.
-  ASSERT(stream_->position() == 0);
+  ASSERT_EQUAL(unwrapped_stream_->position(), 0);
   // The first section in the section header table is always a reserved
   // entry containing only 0 values.
   sections_.Add(new (zone_) ReservedSection());
@@ -809,10 +858,11 @@
   ComputeFileOffsets();
 
   // Finally, write the ELF file contents.
-  WriteHeader();
-  WriteProgramTable();
-  WriteSections();
-  WriteSectionTable();
+  ElfWriteStream wrapped(unwrapped_stream_);
+  WriteHeader(&wrapped);
+  WriteProgramTable(&wrapped);
+  WriteSections(&wrapped);
+  WriteSectionTable(&wrapped);
 }
 
 void Elf::FinalizeProgramTable() {
@@ -873,7 +923,7 @@
   file_offset += section_table_file_size_;
 }
 
-void Elf::WriteHeader() {
+void Elf::WriteHeader(ElfWriteStream* stream) {
 #if defined(TARGET_ARCH_IS_32_BIT)
   uint8_t size = elf::ELFCLASS32;
 #else
@@ -895,26 +945,26 @@
                          0,
                          0,
                          0};
-  stream_->WriteBytes(e_ident, 16);
+  stream->WriteBytes(e_ident, 16);
 
-  WriteHalf(elf::ET_DYN);  // Shared library.
+  stream->WriteHalf(elf::ET_DYN);  // Shared library.
 
 #if defined(TARGET_ARCH_IA32)
-  WriteHalf(elf::EM_386);
+  stream->WriteHalf(elf::EM_386);
 #elif defined(TARGET_ARCH_X64)
-  WriteHalf(elf::EM_X86_64);
+  stream->WriteHalf(elf::EM_X86_64);
 #elif defined(TARGET_ARCH_ARM)
-  WriteHalf(elf::EM_ARM);
+  stream->WriteHalf(elf::EM_ARM);
 #elif defined(TARGET_ARCH_ARM64)
-  WriteHalf(elf::EM_AARCH64);
+  stream->WriteHalf(elf::EM_AARCH64);
 #else
   FATAL("Unknown ELF architecture");
 #endif
 
-  WriteWord(elf::EV_CURRENT);  // Version
-  WriteAddr(0);                // "Entry point"
-  WriteOff(program_table_file_offset_);
-  WriteOff(section_table_file_offset_);
+  stream->WriteWord(elf::EV_CURRENT);  // Version
+  stream->WriteAddr(0);                // "Entry point"
+  stream->WriteOff(program_table_file_offset_);
+  stream->WriteOff(section_table_file_offset_);
 
 #if defined(TARGET_ARCH_ARM)
   uword flags = elf::EF_ARM_ABI | (TargetCPUFeatures::hardfp_supported()
@@ -923,54 +973,56 @@
 #else
   uword flags = 0;
 #endif
-  WriteWord(flags);
+  stream->WriteWord(flags);
 
-  WriteHalf(kElfHeaderSize);
-  WriteHalf(kElfProgramTableEntrySize);
-  WriteHalf(segments_.length());
-  WriteHalf(kElfSectionTableEntrySize);
-  WriteHalf(sections_.length());
-  WriteHalf(shstrtab_->section_index());
+  stream->WriteHalf(kElfHeaderSize);
+  stream->WriteHalf(kElfProgramTableEntrySize);
+  stream->WriteHalf(segments_.length());
+  stream->WriteHalf(kElfSectionTableEntrySize);
+  stream->WriteHalf(sections_.length());
+  stream->WriteHalf(shstrtab_->section_index());
 
-  ASSERT(stream_->position() == kElfHeaderSize);
+  ASSERT_EQUAL(stream->position(), kElfHeaderSize);
 }
 
-void Elf::WriteProgramTable() {
-  ASSERT(stream_->position() == program_table_file_offset_);
+void Elf::WriteProgramTable(ElfWriteStream* stream) {
+  ASSERT(program_table_file_size_ >= 0);  // Check for finalization.
+  ASSERT(stream->position() == program_table_file_offset_);
 
   for (intptr_t i = 0; i < segments_.length(); i++) {
     Section* section = segments_[i];
-    const intptr_t start = stream_->position();
-    section->WriteSegmentEntry(this);
-    const intptr_t end = stream_->position();
-    ASSERT((end - start) == kElfProgramTableEntrySize);
+    const intptr_t start = stream->position();
+    section->WriteSegmentEntry(stream);
+    const intptr_t end = stream->position();
+    ASSERT_EQUAL(end - start, kElfProgramTableEntrySize);
   }
 }
 
-void Elf::WriteSectionTable() {
-  stream_->Align(kElfSectionTableAlignment);
-
-  ASSERT(stream_->position() == section_table_file_offset_);
+void Elf::WriteSectionTable(ElfWriteStream* stream) {
+  ASSERT(section_table_file_size_ >= 0);  // Check for finalization.
+  stream->Align(kElfSectionTableAlignment);
+  ASSERT_EQUAL(stream->position(), section_table_file_offset_);
 
   for (intptr_t i = 0; i < sections_.length(); i++) {
     Section* section = sections_[i];
-    const intptr_t start = stream_->position();
-    section->WriteSectionEntry(this);
-    const intptr_t end = stream_->position();
-    ASSERT((end - start) == kElfSectionTableEntrySize);
+    const intptr_t start = stream->position();
+    section->WriteSectionEntry(stream);
+    const intptr_t end = stream->position();
+    ASSERT_EQUAL(end - start, kElfSectionTableEntrySize);
   }
 }
 
-void Elf::WriteSections() {
-  // Skip the reserved first section, as its alignment is 0 and it does not
-  // contain any contents.
-  ASSERT(sections_[0]->alignment == 0 && sections_[0]->section_type == 0);
+void Elf::WriteSections(ElfWriteStream* stream) {
+  // Skip the reserved first section, as its alignment is 0 (which will cause
+  // stream->Align() to fail) and it never contains file contents anyway.
+  ASSERT_EQUAL(sections_[0]->section_type, elf::SHT_NULL);
+  ASSERT_EQUAL(sections_[0]->alignment, 0);
   for (intptr_t i = 1; i < sections_.length(); i++) {
     Section* section = sections_[i];
-    stream_->Align(section->alignment);
-    ASSERT(stream_->position() == section->file_offset());
-    section->Write(this);
-    ASSERT(stream_->position() == section->file_offset() + section->FileSize());
+    stream->Align(section->alignment);
+    ASSERT(stream->position() == section->file_offset());
+    section->Write(stream);
+    ASSERT(stream->position() == section->file_offset() + section->FileSize());
   }
 }
 
diff --git a/runtime/vm/elf.h b/runtime/vm/elf.h
index 17ce455..9567ddf 100644
--- a/runtime/vm/elf.h
+++ b/runtime/vm/elf.h
@@ -15,6 +15,7 @@
 
 class DynamicSegment;
 class DynamicTable;
+class ElfWriteStream;
 class Section;
 class StringTable;
 class Symbol;
@@ -45,31 +46,6 @@
 
   void Finalize();
 
-  intptr_t position() const { return stream_->position(); }
-  void WriteBytes(const uint8_t* b, intptr_t size) {
-    stream_->WriteBytes(b, size);
-  }
-  void WriteByte(uint8_t value) {
-    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
-  }
-  void WriteHalf(uint16_t value) {
-    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
-  }
-  void WriteWord(uint32_t value) {
-    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
-  }
-  void WriteAddr(compiler::target::uword value) {
-    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
-  }
-  void WriteOff(compiler::target::uword value) {
-    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
-  }
-#if defined(TARGET_ARCH_IS_64_BIT)
-  void WriteXWord(uint64_t value) {
-    stream_->WriteBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));
-  }
-#endif
-
  private:
   void AddSection(Section* section, const char* name);
   intptr_t AddSegmentSymbol(const Section* section, const char* name);
@@ -87,13 +63,13 @@
   void FinalizeProgramTable();
   void ComputeFileOffsets();
 
-  void WriteHeader();
-  void WriteSectionTable();
-  void WriteProgramTable();
-  void WriteSections();
+  void WriteHeader(ElfWriteStream* stream);
+  void WriteSectionTable(ElfWriteStream* stream);
+  void WriteProgramTable(ElfWriteStream* stream);
+  void WriteSections(ElfWriteStream* stream);
 
   Zone* const zone_;
-  StreamingWriteStream* const stream_;
+  StreamingWriteStream* const unwrapped_stream_;
   // Whether the ELF file should be stripped of static information like
   // the static symbol table (and its corresponding string table).
   const bool strip_;
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 06772b1..050a118 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -302,10 +302,14 @@
 #else
       class_table_(nullptr),
 #endif
-      symbols_lock_(new SafepointRwLock()),
       store_buffer_(new StoreBuffer()),
       heap_(nullptr),
       saved_unlinked_calls_(Array::null()),
+      symbols_lock_(new SafepointRwLock()),
+      type_canonicalization_mutex_(
+          NOT_IN_PRODUCT("IsolateGroup::type_canonicalization_mutex_")),
+      type_arguments_canonicalization_mutex_(NOT_IN_PRODUCT(
+          "IsolateGroup::type_arguments_canonicalization_mutex_")),
       active_mutators_monitor_(new Monitor()),
       max_active_mutators_(Scavenger::MaxMutatorThreadCount()) {
   const bool is_vm_isolate = Dart::VmIsolateNameEquals(source_->name);
@@ -399,6 +403,17 @@
 }
 
 void IsolateGroup::Shutdown() {
+  // Ensure to join all threads before waiting for pending GC tasks (the thread
+  // pool can trigger idle notification, which can start new GC tasks).
+  //
+  // (The vm-isolate doesn't have a thread pool.)
+  if (!Dart::VmIsolateNameEquals(source()->name)) {
+    ASSERT(thread_pool_ != nullptr);
+    thread_pool_->Shutdown();
+    thread_pool_.reset();
+  }
+
+  // Wait for any pending GC tasks.
   if (heap_ != nullptr) {
     // Wait for any concurrent GC tasks to finish before shutting down.
     // TODO(rmacnak): Interrupt tasks for faster shutdown.
@@ -424,14 +439,6 @@
     }
   }
 
-  // Ensure to join all threads before starting to delete the members.
-  // (for vm-isolate we don't have a thread pool)
-  if (!Dart::VmIsolateNameEquals(source()->name)) {
-    ASSERT(thread_pool_ != nullptr);
-    thread_pool_->Shutdown();
-    thread_pool_.reset();
-  }
-
   delete this;
 
   // After this isolate group has died we might need to notify a pending
@@ -1568,8 +1575,6 @@
       start_time_micros_(OS::GetCurrentMonotonicMicros()),
       random_(),
       mutex_(NOT_IN_PRODUCT("Isolate::mutex_")),
-      type_canonicalization_mutex_(
-          NOT_IN_PRODUCT("Isolate::type_canonicalization_mutex_")),
       constant_canonicalization_mutex_(
           NOT_IN_PRODUCT("Isolate::constant_canonicalization_mutex_")),
       megamorphic_mutex_(NOT_IN_PRODUCT("Isolate::megamorphic_mutex_")),
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 93a99f2..5be2999 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -364,6 +364,11 @@
   ClassTable* class_table() const { return class_table_.get(); }
   ObjectStore* object_store() const { return object_store_.get(); }
   SafepointRwLock* symbols_lock() { return symbols_lock_.get(); }
+  Mutex* type_canonicalization_mutex() { return &type_canonicalization_mutex_; }
+  Mutex* type_arguments_canonicalization_mutex() {
+    return &type_arguments_canonicalization_mutex_;
+  }
+  Mutex* subtype_test_cache_mutex() { return &subtype_test_cache_mutex_; }
 
   static inline IsolateGroup* Current() {
     Thread* thread = Thread::Current();
@@ -624,10 +629,6 @@
   std::unique_ptr<SharedClassTable> shared_class_table_;
   std::shared_ptr<ObjectStore> object_store_;  // nullptr in JIT mode
   std::shared_ptr<ClassTable> class_table_;    // nullptr in JIT mode
-  // This symbols_mutex_ on Isolate is only used when IsolateGroup does not
-  // have object_store.
-  std::unique_ptr<SafepointRwLock>
-      symbols_lock_;  // Protects concurrent access to the symbol table.
   std::unique_ptr<StoreBuffer> store_buffer_;
   std::unique_ptr<Heap> heap_;
   std::unique_ptr<DispatchTable> dispatch_table_;
@@ -636,6 +637,11 @@
   std::shared_ptr<FieldTable> saved_initial_field_table_;
   uint32_t isolate_group_flags_ = 0;
 
+  std::unique_ptr<SafepointRwLock> symbols_lock_;
+  Mutex type_canonicalization_mutex_;
+  Mutex type_arguments_canonicalization_mutex_;
+  Mutex subtype_test_cache_mutex_;
+
   // Allow us to ensure the number of active mutators is limited by a maximum.
   std::unique_ptr<Monitor> active_mutators_monitor_;
   intptr_t active_mutators_ = 0;
@@ -848,7 +854,6 @@
   }
 
   Mutex* mutex() { return &mutex_; }
-  Mutex* type_canonicalization_mutex() { return &type_canonicalization_mutex_; }
   Mutex* constant_canonicalization_mutex() {
     return &constant_canonicalization_mutex_;
   }
@@ -1472,7 +1477,6 @@
   Random random_;
   Simulator* simulator_ = nullptr;
   Mutex mutex_;          // Protects compiler stats.
-  Mutex type_canonicalization_mutex_;      // Protects type canonicalization.
   Mutex constant_canonicalization_mutex_;  // Protects const canonicalization.
   Mutex megamorphic_mutex_;  // Protects the table of megamorphic caches and
                              // their entries.
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 6c995de..7455635 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -2350,6 +2350,7 @@
     const GrowableArray<const Field*>& fields,
     const GrowableArray<const Instance*>& instances) {
   TIMELINE_SCOPE(InvalidateFields);
+  SafepointMutexLocker ml(isolate()->group()->subtype_test_cache_mutex());
   FieldInvalidator invalidator(zone);
   invalidator.CheckStatics(fields);
   invalidator.CheckInstances(instances);
diff --git a/runtime/vm/malloc_hooks_test.cc b/runtime/vm/malloc_hooks_test.cc
index 76b789b..6d93f9c 100644
--- a/runtime/vm/malloc_hooks_test.cc
+++ b/runtime/vm/malloc_hooks_test.cc
@@ -25,10 +25,17 @@
   }
 }
 
+// Only to be used in UNIT_TEST_CASE which runs without active VM.
+class OSThreadSupport : public ValueObject {
+ public:
+  OSThreadSupport() { OSThread::Init(); }
+
+  ~OSThreadSupport() { OSThread::Cleanup(); }
+};
+
 class EnableMallocHooksScope : public ValueObject {
  public:
   EnableMallocHooksScope() {
-    OSThread::Current();  // Ensure not allocated during test.
     saved_enable_malloc_hooks_ = FLAG_profiler_native_memory;
     FLAG_profiler_native_memory = true;
     MallocHooks::Init();
@@ -66,6 +73,7 @@
 };
 
 UNIT_TEST_CASE(BasicMallocHookTest) {
+  OSThreadSupport os_thread_support;
   EnableMallocHooksScope scope;
 
   EXPECT_EQ(0L, MallocHooks::allocation_count());
@@ -84,6 +92,7 @@
 }
 
 UNIT_TEST_CASE(FreeUnseenMemoryMallocHookTest) {
+  OSThreadSupport os_thread_support;
   EnableMallocHooksScope scope;
 
   const intptr_t pre_hook_buffer_size = 3;
diff --git a/runtime/vm/message_handler_test.cc b/runtime/vm/message_handler_test.cc
index a6ec346..aabd5c4 100644
--- a/runtime/vm/message_handler_test.cc
+++ b/runtime/vm/message_handler_test.cc
@@ -348,8 +348,8 @@
 }
 
 VM_UNIT_TEST_CASE(MessageHandler_Run) {
-  ThreadPool pool;
   TestMessageHandler handler;
+  ThreadPool pool;
   MessageHandlerTestPeer handler_peer(&handler);
 
   EXPECT(!handler.HasLivePorts());
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 1e4781c..dc60b01 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5929,12 +5929,18 @@
 }
 
 ArrayPtr TypeArguments::instantiations() const {
+  // We rely on the fact that any loads from the array are dependent loads and
+  // avoid the load-acquire barrier here.
   return raw_ptr()->instantiations_;
 }
 
 void TypeArguments::set_instantiations(const Array& value) const {
+  // We have to ensure that initializing stores to the array are available
+  // when releasing the pointer to the array pointer.
+  // => We have to use store-release here.
   ASSERT(!value.IsNull());
-  StorePointer(&raw_ptr()->instantiations_, value.raw());
+  StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->instantiations_,
+                                                    value.raw());
 }
 
 intptr_t TypeArguments::Length() const {
@@ -6211,13 +6217,18 @@
 TypeArgumentsPtr TypeArguments::InstantiateAndCanonicalizeFrom(
     const TypeArguments& instantiator_type_arguments,
     const TypeArguments& function_type_arguments) const {
+  auto thread = Thread::Current();
+  auto zone = thread->zone();
+  SafepointMutexLocker ml(
+      thread->isolate_group()->type_arguments_canonicalization_mutex());
+
   ASSERT(!IsInstantiated());
   ASSERT(instantiator_type_arguments.IsNull() ||
          instantiator_type_arguments.IsCanonical());
   ASSERT(function_type_arguments.IsNull() ||
          function_type_arguments.IsCanonical());
   // Lookup instantiators and if found, return instantiated result.
-  Array& prior_instantiations = Array::Handle(instantiations());
+  Array& prior_instantiations = Array::Handle(zone, instantiations());
   ASSERT(!prior_instantiations.IsNull() && prior_instantiations.IsArray());
   // The instantiations cache is initialized with Object::zero_array() and is
   // therefore guaranteed to contain kNoInstantiator. No length check needed.
@@ -6241,7 +6252,7 @@
     index += TypeArguments::Instantiation::kSizeInWords;
   }
   // Cache lookup failed. Instantiate the type arguments.
-  TypeArguments& result = TypeArguments::Handle();
+  TypeArguments& result = TypeArguments::Handle(zone);
   result = InstantiateFrom(instantiator_type_arguments, function_type_arguments,
                            kAllFree, NULL, Heap::kOld);
   // Canonicalize type arguments.
@@ -6264,18 +6275,28 @@
     set_instantiations(prior_instantiations);
     ASSERT((index + TypeArguments::Instantiation::kSizeInWords) < length);
   }
+
+  // Set sentinel marker at next position.
   prior_instantiations.SetAt(
-      index + TypeArguments::Instantiation::kInstantiatorTypeArgsIndex,
-      instantiator_type_arguments);
+      index + TypeArguments::Instantiation::kSizeInWords +
+          TypeArguments::Instantiation::kInstantiatorTypeArgsIndex,
+      Smi::Handle(zone, Smi::New(TypeArguments::kNoInstantiator)));
+
   prior_instantiations.SetAt(
       index + TypeArguments::Instantiation::kFunctionTypeArgsIndex,
       function_type_arguments);
   prior_instantiations.SetAt(
       index + TypeArguments::Instantiation::kInstantiatedTypeArgsIndex, result);
-  prior_instantiations.SetAt(
-      index + TypeArguments::Instantiation::kSizeInWords +
-          TypeArguments::Instantiation::kInstantiatorTypeArgsIndex,
-      Smi::Handle(Smi::New(TypeArguments::kNoInstantiator)));
+
+  // We let any concurrently running mutator thread now see the new entry by
+  // using a store-release barrier.
+  ASSERT(
+      prior_instantiations.At(
+          index + TypeArguments::Instantiation::kInstantiatorTypeArgsIndex) ==
+      Smi::New(TypeArguments::kNoInstantiator));
+  prior_instantiations.SetAtRelease(
+      index + TypeArguments::Instantiation::kInstantiatorTypeArgsIndex,
+      instantiator_type_arguments);
   return result.raw();
 }
 
@@ -6329,7 +6350,7 @@
   ObjectStore* object_store = isolate->object_store();
   TypeArguments& result = TypeArguments::Handle(zone);
   {
-    SafepointMutexLocker ml(isolate->type_canonicalization_mutex());
+    SafepointMutexLocker ml(isolate->group()->type_canonicalization_mutex());
     CanonicalTypeArgumentsSet table(zone,
                                     object_store->canonical_type_arguments());
     result ^= table.GetOrNull(CanonicalTypeArgumentsKey(*this));
@@ -6353,7 +6374,7 @@
     if (IsRecursive()) {
       SetHash(0);
     }
-    SafepointMutexLocker ml(isolate->type_canonicalization_mutex());
+    SafepointMutexLocker ml(isolate->group()->type_canonicalization_mutex());
     CanonicalTypeArgumentsSet table(zone,
                                     object_store->canonical_type_arguments());
     // Since we canonicalized some type arguments above we need to lookup
@@ -17000,8 +17021,18 @@
   return result.raw();
 }
 
+ArrayPtr SubtypeTestCache::cache() const {
+  // We rely on the fact that any loads from the array are dependent loads and
+  // avoid the load-acquire barrier here.
+  return raw_ptr()->cache_;
+}
+
 void SubtypeTestCache::set_cache(const Array& value) const {
-  StorePointer(&raw_ptr()->cache_, value.raw());
+  // We have to ensure that initializing stores to the array are available
+  // when releasing the pointer to the array pointer.
+  // => We have to use store-release here.
+  StorePointer<ArrayPtr, std::memory_order_release>(&raw_ptr()->cache_,
+                                                    value.raw());
 }
 
 intptr_t SubtypeTestCache::NumberOfChecks() const {
@@ -17018,14 +17049,19 @@
     const TypeArguments& instance_parent_function_type_arguments,
     const TypeArguments& instance_delayed_type_arguments,
     const Bool& test_result) const {
+  ASSERT(Thread::Current()
+             ->isolate_group()
+             ->subtype_test_cache_mutex()
+             ->IsOwnedByCurrentThread());
+
   intptr_t old_num = NumberOfChecks();
   Array& data = Array::Handle(cache());
   intptr_t new_len = data.Length() + kTestEntryLength;
   data = Array::Grow(data, new_len);
-  set_cache(data);
 
   SubtypeTestCacheTable entries(data);
   auto entry = entries[old_num];
+  ASSERT(entry.Get<kInstanceClassIdOrFunction>() == Object::null());
   entry.Set<kInstanceClassIdOrFunction>(instance_class_id_or_function);
   entry.Set<kInstanceTypeArguments>(instance_type_arguments);
   entry.Set<kInstantiatorTypeArguments>(instantiator_type_arguments);
@@ -17035,6 +17071,10 @@
   entry.Set<kInstanceDelayedFunctionTypeArguments>(
       instance_delayed_type_arguments);
   entry.Set<kTestResult>(test_result);
+
+  // We let any concurrently running mutator thread now see the new entry (the
+  // `set_cache()` uses a store-release barrier).
+  set_cache(data);
 }
 
 void SubtypeTestCache::GetCheck(
@@ -17046,6 +17086,11 @@
     TypeArguments* instance_parent_function_type_arguments,
     TypeArguments* instance_delayed_type_arguments,
     Bool* test_result) const {
+  ASSERT(Thread::Current()
+             ->isolate_group()
+             ->subtype_test_cache_mutex()
+             ->IsOwnedByCurrentThread());
+
   Array& data = Array::Handle(cache());
   SubtypeTestCacheTable entries(data);
   auto entry = entries[ix];
@@ -19563,7 +19608,8 @@
       type = cls.declaration_type();
       // May be set while canonicalizing type args.
       if (type.IsNull()) {
-        SafepointMutexLocker ml(isolate->type_canonicalization_mutex());
+        SafepointMutexLocker ml(
+            isolate->group()->type_canonicalization_mutex());
         // Recheck if type exists.
         type = cls.declaration_type();
         if (type.IsNull()) {
@@ -19589,7 +19635,7 @@
   AbstractType& type = Type::Handle(zone);
   ObjectStore* object_store = isolate->object_store();
   {
-    SafepointMutexLocker ml(isolate->type_canonicalization_mutex());
+    SafepointMutexLocker ml(isolate->group()->type_canonicalization_mutex());
     CanonicalTypeSet table(zone, object_store->canonical_types());
     type ^= table.GetOrNull(CanonicalTypeKey(*this));
     ASSERT(object_store->canonical_types() == table.Release().raw());
@@ -19637,7 +19683,7 @@
 
     // Check to see if the type got added to canonical list as part of the
     // type arguments canonicalization.
-    SafepointMutexLocker ml(isolate->type_canonicalization_mutex());
+    SafepointMutexLocker ml(isolate->group()->type_canonicalization_mutex());
     CanonicalTypeSet table(zone, object_store->canonical_types());
     type ^= table.GetOrNull(CanonicalTypeKey(*this));
     if (type.IsNull()) {
@@ -19684,7 +19730,7 @@
 
   ObjectStore* object_store = isolate->object_store();
   {
-    SafepointMutexLocker ml(isolate->type_canonicalization_mutex());
+    SafepointMutexLocker ml(isolate->group()->type_canonicalization_mutex());
     CanonicalTypeSet table(zone, object_store->canonical_types());
     type ^= table.GetOrNull(CanonicalTypeKey(*this));
     object_store->set_canonical_types(table.Release());
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index c3d6f0b..903f471 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5190,16 +5190,19 @@
     StoreNonPointer(&raw_ptr()->entry_bits()[index], bits);
   }
 
+  template <std::memory_order order = std::memory_order_relaxed>
   ObjectPtr ObjectAt(intptr_t index) const {
     ASSERT((TypeAt(index) == EntryType::kTaggedObject) ||
            (TypeAt(index) == EntryType::kNativeEntryData));
-    return EntryAddr(index)->raw_obj_;
+    return LoadPointer<ObjectPtr, order>(&(EntryAddr(index)->raw_obj_));
   }
+
+  template <std::memory_order order = std::memory_order_relaxed>
   void SetObjectAt(intptr_t index, const Object& obj) const {
     ASSERT((TypeAt(index) == EntryType::kTaggedObject) ||
            (TypeAt(index) == EntryType::kNativeEntryData) ||
            (TypeAt(index) == EntryType::kImmediate && obj.IsSmi()));
-    StorePointer(&EntryAddr(index)->raw_obj_, obj.raw());
+    StorePointer<ObjectPtr, order>(&EntryAddr(index)->raw_obj_, obj.raw());
   }
 
   uword RawValueAt(intptr_t index) const {
@@ -6921,7 +6924,7 @@
   static void Init();
   static void Cleanup();
 
-  ArrayPtr cache() const { return raw_ptr()->cache_; }
+  ArrayPtr cache() const;
 
  private:
   // A VM heap allocated preinitialized empty subtype entry array.
@@ -9329,20 +9332,22 @@
 
   static ObjectPtr* DataOf(ArrayPtr array) { return array->ptr()->data(); }
 
-  ObjectPtr At(intptr_t index) const { return *ObjectAddr(index); }
+  template <std::memory_order order = std::memory_order_relaxed>
+  ObjectPtr At(intptr_t index) const {
+    return LoadPointer<ObjectPtr, order>(ObjectAddr(index));
+  }
+  template <std::memory_order order = std::memory_order_relaxed>
   void SetAt(intptr_t index, const Object& value) const {
     // TODO(iposva): Add storing NoSafepointScope.
-    StoreArrayPointer(ObjectAddr(index), value.raw());
+    StoreArrayPointer<ObjectPtr, order>(ObjectAddr(index), value.raw());
   }
 
   // Access to the array with acquire release semantics.
   ObjectPtr AtAcquire(intptr_t index) const {
-    return LoadPointer<ObjectPtr, std::memory_order_acquire>(ObjectAddr(index));
+    return At<std::memory_order_acquire>(index);
   }
   void SetAtRelease(intptr_t index, const Object& value) const {
-    // TODO(iposva): Add storing NoSafepointScope.
-    StoreArrayPointer<ObjectPtr, std::memory_order_release>(ObjectAddr(index),
-                                                            value.raw());
+    SetAt<std::memory_order_release>(index, value);
   }
 
   bool IsImmutable() const { return raw()->GetClassId() == kImmutableArrayCid; }
@@ -11171,17 +11176,19 @@
     TupleView(const Array& array, intptr_t index)
         : array_(array), index_(index) {}
 
-    template <EnumType kElement>
+    template <EnumType kElement,
+              std::memory_order order = std::memory_order_relaxed>
     typename std::tuple_element<kElement, TupleT>::type::ObjectPtrType Get()
         const {
       using object_type = typename std::tuple_element<kElement, TupleT>::type;
-      return object_type::RawCast(array_.At(index_ + kElement));
+      return object_type::RawCast(array_.At<order>(index_ + kElement));
     }
 
-    template <EnumType kElement>
+    template <EnumType kElement,
+              std::memory_order order = std::memory_order_relaxed>
     void Set(const typename std::tuple_element<kElement, TupleT>::type& value)
         const {
-      array_.SetAt(index_ + kElement, value);
+      array_.SetAt<order>(index_ + kElement, value);
     }
 
     intptr_t index() const { return (index_ - kStartOffset) / EntrySize; }
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index d09eace..ccf9b01 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -1824,7 +1824,7 @@
   Utils::SNPrint(buffer, sizeof(buffer),
                  "Unhandled exception:\n"
                  "RangeError (length): Invalid value: "
-                 "Not in range 0..%" Pd ", inclusive: %" Pd,
+                 "Not in inclusive range 0..%" Pd ": %" Pd,
                  Array::kMaxElements, length);
   EXPECT_ERROR(result, buffer);
 }
@@ -2973,6 +2973,8 @@
 }
 
 ISOLATE_UNIT_TEST_CASE(SubtypeTestCache) {
+  SafepointMutexLocker ml(thread->isolate_group()->subtype_test_cache_mutex());
+
   String& class_name = String::Handle(Symbols::New(thread, "EmptyClass"));
   Script& script = Script::Handle();
   const Class& empty_class =
diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc
index 61b929c..fe0e8c7 100644
--- a/runtime/vm/os_thread.cc
+++ b/runtime/vm/os_thread.cc
@@ -134,21 +134,18 @@
   return thread_interrupt_disabled_ == 0;
 }
 
-static void DeleteThread(void* thread) {
+static void DeleteOSThreadTLS(void* thread) {
   delete reinterpret_cast<OSThread*>(thread);
 }
 
 void OSThread::Init() {
   // Allocate the global OSThread lock.
-  if (thread_list_lock_ == NULL) {
-    thread_list_lock_ = new Mutex();
-  }
-  ASSERT(thread_list_lock_ != NULL);
+  ASSERT(thread_list_lock_ == nullptr);
+  thread_list_lock_ = new Mutex();
 
   // Create the thread local key.
-  if (thread_key_ == kUnsetThreadLocalKey) {
-    thread_key_ = CreateThreadLocal(DeleteThread);
-  }
+  ASSERT(thread_key_ == kUnsetThreadLocalKey);
+  thread_key_ = CreateThreadLocal(DeleteOSThreadTLS);
   ASSERT(thread_key_ != kUnsetThreadLocalKey);
 
   // Enable creation of OSThread structures in the VM.
@@ -162,21 +159,25 @@
 }
 
 void OSThread::Cleanup() {
-// We cannot delete the thread local key and thread list lock,  yet.
-// See the note on thread_list_lock_ in os_thread.h.
-#if 0
-  if (thread_list_lock_ != NULL) {
-    // Delete the thread local key.
-    ASSERT(thread_key_ != kUnsetThreadLocalKey);
-    DeleteThreadLocal(thread_key_);
-    thread_key_ = kUnsetThreadLocalKey;
+  // Delete the current thread's TLS (if any).
+  OSThread* os_thread = OSThread::Current();
+  OSThread::SetCurrent(nullptr);
+  delete os_thread;
 
-    // Delete the global OSThread lock.
-    ASSERT(thread_list_lock_ != NULL);
-    delete thread_list_lock_;
-    thread_list_lock_ = NULL;
-  }
-#endif
+  // At this point all OSThread structures should have been deleted.
+  // If not we have a bug in the code where a thread is not correctly joined
+  // before `Dart::Cleanup()`.
+  RELEASE_ASSERT(OSThread::thread_list_head_ == nullptr);
+
+  // Delete the thread local key.
+  ASSERT(thread_key_ != kUnsetThreadLocalKey);
+  DeleteThreadLocal(thread_key_);
+  thread_key_ = kUnsetThreadLocalKey;
+
+  // Delete the global OSThread lock.
+  ASSERT(thread_list_lock_ != nullptr);
+  delete thread_list_lock_;
+  thread_list_lock_ = nullptr;
 }
 
 OSThread* OSThread::CreateAndSetUnknownThread() {
@@ -245,7 +246,6 @@
 }
 
 void OSThread::RemoveThreadFromList(OSThread* thread) {
-  bool final_thread = false;
   {
     ASSERT(thread != NULL);
     ASSERT(thread_list_lock_ != NULL);
@@ -263,18 +263,12 @@
           previous->thread_list_next_ = current->thread_list_next_;
         }
         thread->thread_list_next_ = NULL;
-        final_thread = !creation_enabled_ && (thread_list_head_ == NULL);
         break;
       }
       previous = current;
       current = current->thread_list_next_;
     }
   }
-  // Check if this is the last thread. The last thread does a cleanup
-  // which removes the thread local key and the associated mutex.
-  if (final_thread) {
-    Cleanup();
-  }
 }
 
 void OSThread::SetCurrentTLS(BaseThread* value) {
diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h
index c35d68f..fb40b70 100644
--- a/runtime/vm/os_thread.h
+++ b/runtime/vm/os_thread.h
@@ -229,6 +229,7 @@
 
   // Called at VM startup and shutdown.
   static void Init();
+  static void Cleanup();
 
   static bool IsThreadInList(ThreadId id);
 
@@ -255,7 +256,6 @@
   ThreadState* thread() const { return thread_; }
   void set_thread(ThreadState* value) { thread_ = value; }
 
-  static void Cleanup();
 #ifdef SUPPORT_TIMELINE
   static ThreadId GetCurrentThreadTraceId();
 #endif  // PRODUCT
@@ -299,11 +299,8 @@
   // protected and should only be read/written by the OSThread itself.
   void* owning_thread_pool_worker_ = nullptr;
 
-  // thread_list_lock_ cannot have a static lifetime because the order in which
-  // destructors run is undefined. At the moment this lock cannot be deleted
-  // either since otherwise, if a thread only begins to run after we have
-  // started to run TLS destructors for a call to exit(), there will be a race
-  // on its deletion in CreateOSThread().
+  // [thread_list_lock_] cannot have a static lifetime because the order in
+  // which destructors run is undefined.
   static Mutex* thread_list_lock_;
   static OSThread* thread_list_head_;
   static bool creation_enabled_;
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 5a01001..db586ce 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -1132,19 +1132,24 @@
     }
   }
 
-  OS::PrintErr("version=%s\n", Version::String());
-  OSThread* os_thread = OSThread::Current();
-  ASSERT(os_thread != NULL);
-  Isolate* isolate = Isolate::Current();
-  const char* name = isolate == NULL ? "(nil)" : isolate->name();
-  OS::PrintErr("pid=%" Pd ", thread=%" Pd ", isolate=%s(%p)\n",
-               static_cast<intptr_t>(OS::ProcessId()),
-               OSThread::ThreadIdToIntPtr(os_thread->trace_id()), name,
-               isolate);
-  const IsolateGroupSource* source =
-      isolate == nullptr ? nullptr : isolate->source();
-  const IsolateGroupSource* vm_source =
+  auto os_thread = OSThread::Current();
+  ASSERT(os_thread != nullptr);
+  auto thread = Thread::Current();  // NULL if no current isolate.
+  auto isolate = thread == nullptr ? nullptr : thread->isolate();
+  auto isolate_group = thread == nullptr ? nullptr : thread->isolate_group();
+  auto source = isolate_group == nullptr ? nullptr : isolate_group->source();
+  auto vm_source =
       Dart::vm_isolate() == nullptr ? nullptr : Dart::vm_isolate()->source();
+  const char* isolate_group_name =
+      isolate_group == nullptr ? "(nil)" : isolate_group->source()->name;
+  const char* isolate_name = isolate == nullptr ? "(nil)" : isolate->name();
+
+  OS::PrintErr("version=%s\n", Version::String());
+  OS::PrintErr("pid=%" Pd ", thread=%" Pd
+               ", isolate_group=%s(%p), isolate=%s(%p)\n",
+               static_cast<intptr_t>(OS::ProcessId()),
+               OSThread::ThreadIdToIntPtr(os_thread->trace_id()),
+               isolate_group_name, isolate_group, isolate_name, isolate);
   OS::PrintErr("isolate_instructions=%" Px ", vm_instructions=%" Px "\n",
                source == nullptr
                    ? 0
@@ -1158,7 +1163,6 @@
     return;
   }
 
-  Thread* thread = Thread::Current();  // NULL if no current isolate.
   uword stack_lower = 0;
   uword stack_upper = 0;
   if (!GetAndValidateThreadStackBounds(os_thread, thread, fp, sp, &stack_lower,
diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
index 211367b..e3dfb07 100644
--- a/runtime/vm/profiler_test.cc
+++ b/runtime/vm/profiler_test.cc
@@ -937,7 +937,7 @@
   DisableBackgroundCompilationScope dbcs;
   const char* kScript =
       "List foo() => List.filled(4, null);\n"
-      "List bar() => List.empty(growable: true);\n";
+      "List bar() => List.filled(0, null, growable: true);\n";
   const Library& root_library = Library::Handle(LoadTestScript(kScript));
   Isolate* isolate = thread->isolate();
 
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index 3731cb53..88f2ea5 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -425,14 +425,10 @@
   // Code inlined in the caller should have optimized the case where the
   // instantiator can be reused as type argument vector.
   ASSERT(!type_arguments.IsUninstantiatedIdentity());
-  thread->isolate_group()->RunWithStoppedMutators(
-      [&]() {
-        type_arguments = type_arguments.InstantiateAndCanonicalizeFrom(
-            instantiator_type_arguments, function_type_arguments);
-        ASSERT(type_arguments.IsNull() || type_arguments.IsInstantiated());
-        arguments.SetReturn(type_arguments);
-      },
-      /*use_force_growth=*/true);
+  type_arguments = type_arguments.InstantiateAndCanonicalizeFrom(
+      instantiator_type_arguments, function_type_arguments);
+  ASSERT(type_arguments.IsNull() || type_arguments.IsInstantiated());
+  arguments.SetReturn(type_arguments);
 }
 
 // Instantiate type.
@@ -616,15 +612,7 @@
     const TypeArguments& function_type_arguments,
     const Bool& result,
     const SubtypeTestCache& new_cache) {
-  // Since the test is expensive, don't do it unless necessary.
-  // The list of disallowed cases will decrease as they are implemented in
-  // inlined assembly.
-  if (new_cache.IsNull()) {
-    if (FLAG_trace_type_checks) {
-      OS::PrintErr("UpdateTypeTestCache: cache is null\n");
-    }
-    return;
-  }
+  ASSERT(!new_cache.IsNull());
   Class& instance_class = Class::Handle(zone);
   if (instance.IsSmi()) {
     instance_class = Smi::Class();
@@ -653,112 +641,107 @@
       instance_type_arguments = instance.GetTypeArguments();
     }
   }
-  thread->isolate_group()->RunWithStoppedMutators(
-      [&]() {
-        const intptr_t len = new_cache.NumberOfChecks();
-        if (len >= FLAG_max_subtype_cache_entries) {
-          if (FLAG_trace_type_checks) {
-            OS::PrintErr(
-                "Not updating subtype test cache as its length reached %d\n",
-                FLAG_max_subtype_cache_entries);
-          }
-          return;
-        }
-#if defined(DEBUG)
-        ASSERT(instance_type_arguments.IsNull() ||
-               instance_type_arguments.IsCanonical());
-        ASSERT(instantiator_type_arguments.IsNull() ||
-               instantiator_type_arguments.IsCanonical());
-        ASSERT(function_type_arguments.IsNull() ||
-               function_type_arguments.IsCanonical());
-        ASSERT(instance_parent_function_type_arguments.IsNull() ||
-               instance_parent_function_type_arguments.IsCanonical());
-        ASSERT(instance_delayed_type_arguments.IsNull() ||
-               instance_delayed_type_arguments.IsCanonical());
-        auto& last_instance_class_id_or_function = Object::Handle(zone);
-        auto& last_instance_type_arguments = TypeArguments::Handle(zone);
-        auto& last_instantiator_type_arguments = TypeArguments::Handle(zone);
-        auto& last_function_type_arguments = TypeArguments::Handle(zone);
-        auto& last_instance_parent_function_type_arguments =
-            TypeArguments::Handle(zone);
-        auto& last_instance_delayed_type_arguments =
-            TypeArguments::Handle(zone);
-        Bool& last_result = Bool::Handle(zone);
-        for (intptr_t i = 0; i < len; ++i) {
-          new_cache.GetCheck(
-              i, &last_instance_class_id_or_function,
-              &last_instance_type_arguments, &last_instantiator_type_arguments,
-              &last_function_type_arguments,
-              &last_instance_parent_function_type_arguments,
-              &last_instance_delayed_type_arguments, &last_result);
-          if ((last_instance_class_id_or_function.raw() ==
-               instance_class_id_or_function.raw()) &&
-              (last_instance_type_arguments.raw() ==
-               instance_type_arguments.raw()) &&
-              (last_instantiator_type_arguments.raw() ==
-               instantiator_type_arguments.raw()) &&
-              (last_function_type_arguments.raw() ==
-               function_type_arguments.raw()) &&
-              (last_instance_parent_function_type_arguments.raw() ==
-               instance_parent_function_type_arguments.raw()) &&
-              (last_instance_delayed_type_arguments.raw() ==
-               instance_delayed_type_arguments.raw())) {
-            // Some other isolate might have updated the cache between entry was
-            // found missing and now.
-            return;
-          }
-        }
-#endif
-        new_cache.AddCheck(instance_class_id_or_function,
-                           instance_type_arguments, instantiator_type_arguments,
-                           function_type_arguments,
-                           instance_parent_function_type_arguments,
-                           instance_delayed_type_arguments, result);
-        if (FLAG_trace_type_checks) {
-          AbstractType& test_type = AbstractType::Handle(zone, type.raw());
-          if (!test_type.IsInstantiated()) {
-            test_type = type.InstantiateFrom(instantiator_type_arguments,
-                                             function_type_arguments, kAllFree,
-                                             NULL, Heap::kNew);
-          }
-          const auto& type_class = Class::Handle(zone, test_type.type_class());
-          const auto& instance_class_name =
-              String::Handle(zone, instance_class.Name());
-          OS::PrintErr(
-              "  Updated test cache %#" Px " ix: %" Pd
-              " with (cid-or-fun:"
-              " %#" Px ", type-args: %#" Px ", i-type-args: %#" Px
-              ", "
-              "f-type-args: %#" Px ", p-type-args: %#" Px
-              ", "
-              "d-type-args: %#" Px
-              ", result: %s)\n"
-              "    instance  [class: (%#" Px " '%s' cid: %" Pd
-              "),    type-args: %#" Px
-              " %s]\n"
-              "    test-type [class: (%#" Px " '%s' cid: %" Pd
-              "), i-type-args: %#" Px " %s, f-type-args: %#" Px " %s]\n",
-              static_cast<uword>(new_cache.raw()), len,
-              static_cast<uword>(instance_class_id_or_function.raw()),
-              static_cast<uword>(instance_type_arguments.raw()),
-              static_cast<uword>(instantiator_type_arguments.raw()),
-              static_cast<uword>(function_type_arguments.raw()),
-              static_cast<uword>(instance_parent_function_type_arguments.raw()),
-              static_cast<uword>(instance_delayed_type_arguments.raw()),
-              result.ToCString(), static_cast<uword>(instance_class.raw()),
-              instance_class_name.ToCString(), instance_class.id(),
-              static_cast<uword>(instance_type_arguments.raw()),
-              instance_type_arguments.ToCString(),
-              static_cast<uword>(type_class.raw()),
-              String::Handle(zone, type_class.Name()).ToCString(),
-              type_class.id(),
-              static_cast<uword>(instantiator_type_arguments.raw()),
-              instantiator_type_arguments.ToCString(),
-              static_cast<uword>(function_type_arguments.raw()),
-              function_type_arguments.ToCString());
-        }
-      },
-      /*use_force_growth=*/true);
+  {
+    SafepointMutexLocker ml(
+        thread->isolate_group()->subtype_test_cache_mutex());
+
+    const intptr_t len = new_cache.NumberOfChecks();
+    if (len >= FLAG_max_subtype_cache_entries) {
+      if (FLAG_trace_type_checks) {
+        OS::PrintErr(
+            "Not updating subtype test cache as its length reached %d\n",
+            FLAG_max_subtype_cache_entries);
+      }
+      return;
+    }
+    ASSERT(instance_type_arguments.IsNull() ||
+           instance_type_arguments.IsCanonical());
+    ASSERT(instantiator_type_arguments.IsNull() ||
+           instantiator_type_arguments.IsCanonical());
+    ASSERT(function_type_arguments.IsNull() ||
+           function_type_arguments.IsCanonical());
+    ASSERT(instance_parent_function_type_arguments.IsNull() ||
+           instance_parent_function_type_arguments.IsCanonical());
+    ASSERT(instance_delayed_type_arguments.IsNull() ||
+           instance_delayed_type_arguments.IsCanonical());
+    auto& last_instance_class_id_or_function = Object::Handle(zone);
+    auto& last_instance_type_arguments = TypeArguments::Handle(zone);
+    auto& last_instantiator_type_arguments = TypeArguments::Handle(zone);
+    auto& last_function_type_arguments = TypeArguments::Handle(zone);
+    auto& last_instance_parent_function_type_arguments =
+        TypeArguments::Handle(zone);
+    auto& last_instance_delayed_type_arguments = TypeArguments::Handle(zone);
+    Bool& last_result = Bool::Handle(zone);
+    for (intptr_t i = 0; i < len; ++i) {
+      new_cache.GetCheck(
+          i, &last_instance_class_id_or_function, &last_instance_type_arguments,
+          &last_instantiator_type_arguments, &last_function_type_arguments,
+          &last_instance_parent_function_type_arguments,
+          &last_instance_delayed_type_arguments, &last_result);
+      if ((last_instance_class_id_or_function.raw() ==
+           instance_class_id_or_function.raw()) &&
+          (last_instance_type_arguments.raw() ==
+           instance_type_arguments.raw()) &&
+          (last_instantiator_type_arguments.raw() ==
+           instantiator_type_arguments.raw()) &&
+          (last_function_type_arguments.raw() ==
+           function_type_arguments.raw()) &&
+          (last_instance_parent_function_type_arguments.raw() ==
+           instance_parent_function_type_arguments.raw()) &&
+          (last_instance_delayed_type_arguments.raw() ==
+           instance_delayed_type_arguments.raw())) {
+        // Some other isolate might have updated the cache between entry was
+        // found missing and now.
+        return;
+      }
+    }
+    new_cache.AddCheck(instance_class_id_or_function, instance_type_arguments,
+                       instantiator_type_arguments, function_type_arguments,
+                       instance_parent_function_type_arguments,
+                       instance_delayed_type_arguments, result);
+    if (FLAG_trace_type_checks) {
+      AbstractType& test_type = AbstractType::Handle(zone, type.raw());
+      if (!test_type.IsInstantiated()) {
+        test_type = type.InstantiateFrom(instantiator_type_arguments,
+                                         function_type_arguments, kAllFree,
+                                         NULL, Heap::kNew);
+      }
+      const auto& type_class = Class::Handle(zone, test_type.type_class());
+      const auto& instance_class_name =
+          String::Handle(zone, instance_class.Name());
+      OS::PrintErr(
+          "  Updated test cache %#" Px " ix: %" Pd
+          " with (cid-or-fun:"
+          " %#" Px ", type-args: %#" Px ", i-type-args: %#" Px
+          ", "
+          "f-type-args: %#" Px ", p-type-args: %#" Px
+          ", "
+          "d-type-args: %#" Px
+          ", result: %s)\n"
+          "    instance  [class: (%#" Px " '%s' cid: %" Pd
+          "),    type-args: %#" Px
+          " %s]\n"
+          "    test-type [class: (%#" Px " '%s' cid: %" Pd
+          "), i-type-args: %#" Px " %s, f-type-args: %#" Px " %s]\n",
+          static_cast<uword>(new_cache.raw()), len,
+          static_cast<uword>(instance_class_id_or_function.raw()),
+          static_cast<uword>(instance_type_arguments.raw()),
+          static_cast<uword>(instantiator_type_arguments.raw()),
+          static_cast<uword>(function_type_arguments.raw()),
+          static_cast<uword>(instance_parent_function_type_arguments.raw()),
+          static_cast<uword>(instance_delayed_type_arguments.raw()),
+          result.ToCString(), static_cast<uword>(instance_class.raw()),
+          instance_class_name.ToCString(), instance_class.id(),
+          static_cast<uword>(instance_type_arguments.raw()),
+          instance_type_arguments.ToCString(),
+          static_cast<uword>(type_class.raw()),
+          String::Handle(zone, type_class.Name()).ToCString(), type_class.id(),
+          static_cast<uword>(instantiator_type_arguments.raw()),
+          instantiator_type_arguments.ToCString(),
+          static_cast<uword>(function_type_arguments.raw()),
+          function_type_arguments.ToCString());
+    }
+  }
 }
 
 // Check that the given instance is an instance of the given type.
@@ -782,6 +765,7 @@
       SubtypeTestCache::CheckedHandle(zone, arguments.ArgAt(4));
   ASSERT(type.IsFinalized());
   ASSERT(!type.IsDynamicType());  // No need to check assignment.
+  ASSERT(!cache.IsNull());
   const Bool& result = Bool::Get(instance.IsInstanceOf(
       type, instantiator_type_arguments, function_type_arguments));
   if (FLAG_trace_type_checks) {
@@ -952,26 +936,24 @@
       TypeTestingStubCallPattern tts_pattern(caller_frame->pc());
       const intptr_t stc_pool_idx = tts_pattern.GetSubtypeTestCachePoolIndex();
 
-      thread->isolate_group()->RunWithStoppedMutators(
-          [&]() {
-            // If nobody has updated the pool since the check, we are
-            // updating it now.
-            if (pool.ObjectAt(stc_pool_idx) == Object::null()) {
-              cache = SubtypeTestCache::New();
-              pool.SetObjectAt(stc_pool_idx, cache);
-            }
-          },
-          /*use_force_growth=*/true);
+      // Ensure we do have a STC (lazily create it if not) and all threads use
+      // the same STC.
+      {
+        SafepointMutexLocker ml(isolate->group()->subtype_test_cache_mutex());
+        cache ^= pool.ObjectAt<std::memory_order_acquire>(stc_pool_idx);
+        if (cache.IsNull()) {
+          cache = SubtypeTestCache::New();
+          pool.SetObjectAt<std::memory_order_release>(stc_pool_idx, cache);
+        }
+      }
 #else
       UNREACHABLE();
 #endif
     }
 
-    if (!cache.IsNull()) {  //  we might have lost the race to set up new cache
-      UpdateTypeTestCache(zone, thread, src_instance, dst_type,
-                          instantiator_type_arguments, function_type_arguments,
-                          Bool::True(), cache);
-    }
+    UpdateTypeTestCache(zone, thread, src_instance, dst_type,
+                        instantiator_type_arguments, function_type_arguments,
+                        Bool::True(), cache);
   }
 
   arguments.SetReturn(src_instance);
diff --git a/runtime/vm/simulator_arm.cc b/runtime/vm/simulator_arm.cc
index 0937ce8..46f13f3 100644
--- a/runtime/vm/simulator_arm.cc
+++ b/runtime/vm/simulator_arm.cc
@@ -3371,6 +3371,10 @@
     if (instr->InstructionBits() == static_cast<int32_t>(0xf57ff01f)) {
       // Format(instr, "clrex");
       ClearExclusive();
+    } else if (instr->InstructionBits() ==
+               static_cast<int32_t>(kDataMemoryBarrier)) {
+      // Format(instr, "dmb ish");
+      std::atomic_thread_fence(std::memory_order_seq_cst);
     } else {
       if (instr->IsSIMDDataProcessing()) {
         DecodeSIMDDataProcessing(instr);
diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc
index 5b558a7..fc6f660 100644
--- a/runtime/vm/simulator_arm64.cc
+++ b/runtime/vm/simulator_arm64.cc
@@ -1179,6 +1179,42 @@
   return 1;  // Failure.
 }
 
+intptr_t Simulator::ReadAcquire(uword addr, Instr* instr) {
+  // TODO(42074): Once we switch to C++20 we should change this to use use
+  // `std::atomic_ref<T>` which supports performing atomic operations on
+  // non-atomic data.
+  COMPILE_ASSERT(sizeof(std::atomic<intptr_t>) == sizeof(intptr_t));
+  return reinterpret_cast<std::atomic<intptr_t>*>(addr)->load(
+      std::memory_order_acquire);
+}
+
+uint32_t Simulator::ReadAcquireW(uword addr, Instr* instr) {
+  // TODO(42074): Once we switch to C++20 we should change this to use use
+  // `std::atomic_ref<T>` which supports performing atomic operations on
+  // non-atomic data.
+  COMPILE_ASSERT(sizeof(std::atomic<intptr_t>) == sizeof(intptr_t));
+  return reinterpret_cast<std::atomic<uint32_t>*>(addr)->load(
+      std::memory_order_acquire);
+}
+
+void Simulator::WriteRelease(uword addr, intptr_t value, Instr* instr) {
+  // TODO(42074): Once we switch to C++20 we should change this to use use
+  // `std::atomic_ref<T>` which supports performing atomic operations on
+  // non-atomic data.
+  COMPILE_ASSERT(sizeof(std::atomic<intptr_t>) == sizeof(intptr_t));
+  reinterpret_cast<std::atomic<intptr_t>*>(addr)->store(
+      value, std::memory_order_release);
+}
+
+void Simulator::WriteReleaseW(uword addr, uint32_t value, Instr* instr) {
+  // TODO(42074): Once we switch to C++20 we should change this to use use
+  // `std::atomic_ref<T>` which supports performing atomic operations on
+  // non-atomic data.
+  COMPILE_ASSERT(sizeof(std::atomic<intptr_t>) == sizeof(intptr_t));
+  reinterpret_cast<std::atomic<uint32_t>*>(addr)->store(
+      value, std::memory_order_release);
+}
+
 // Unsupported instructions use Format to print an error and stop execution.
 void Simulator::Format(Instr* instr, const char* format) {
   OS::PrintErr("Simulator found unsupported instruction:\n 0x%p: %s\n", instr,
@@ -2127,7 +2163,7 @@
 }
 
 void Simulator::DecodeLoadStoreExclusive(Instr* instr) {
-  if ((instr->Bit(23) != 0) || (instr->Bit(21) != 0) || (instr->Bit(15) != 0)) {
+  if (instr->Bit(21) != 0 || instr->Bit(23) != instr->Bit(15)) {
     UNIMPLEMENTED();
   }
   const int32_t size = instr->Bits(30, 2);
@@ -2135,33 +2171,47 @@
     UNIMPLEMENTED();
   }
   const Register rs = instr->RsField();
+  ASSERT(rs == R31);  // Should-Be-One
   const Register rn = instr->RnField();
   const Register rt = instr->RtField();
   ASSERT(instr->Rt2Field() == R31);  // Should-Be-One
   const bool is_load = instr->Bit(22) == 1;
+  const bool is_exclusive = instr->Bit(23) == 0;
+  const bool is_ordered = instr->Bit(15) == 1;
   if (is_load) {
-    ASSERT(rs == R31);  // Should-Be-One
-    // Format(instr, "ldxr 'rt, 'rn");
-    if (size == 3) {
+    const bool is_load_acquire = !is_exclusive && is_ordered;
+    if (is_load_acquire) {
+      // Format(instr, "ldar 'rt, 'rn");
       const int64_t addr = get_register(rn, R31IsSP);
-      intptr_t value = ReadExclusiveX(addr, instr);
+      const intptr_t value =
+          (size == 3) ? ReadAcquire(addr, instr) : ReadAcquireW(addr, instr);
       set_register(instr, rt, value, R31IsSP);
     } else {
+      // Format(instr, "ldxr 'rt, 'rn");
       const int64_t addr = get_register(rn, R31IsSP);
-      intptr_t value = ReadExclusiveW(addr, instr);
+      const intptr_t value = (size == 3) ? ReadExclusiveX(addr, instr)
+                                         : ReadExclusiveW(addr, instr);
       set_register(instr, rt, value, R31IsSP);
     }
   } else {
-    // Format(instr, "stxr 'rs, 'rt, 'rn");
-    if (size == 3) {
-      uword value = get_register(rt, R31IsSP);
-      uword addr = get_register(rn, R31IsSP);
-      intptr_t status = WriteExclusiveX(addr, value, instr);
-      set_register(instr, rs, status, R31IsSP);
+    const bool is_store_release = !is_exclusive && is_ordered;
+    if (is_store_release) {
+      // Format(instr, "stlr 'rt, 'rn");
+      const uword value = get_register(rt, R31IsSP);
+      const uword addr = get_register(rn, R31IsSP);
+      if (size == 3) {
+        WriteRelease(addr, value, instr);
+      } else {
+        WriteReleaseW(addr, static_cast<uint32_t>(value), instr);
+      }
     } else {
-      uint32_t value = get_register(rt, R31IsSP);
-      uword addr = get_register(rn, R31IsSP);
-      intptr_t status = WriteExclusiveW(addr, value, instr);
+      // Format(instr, "stxr 'rs, 'rt, 'rn");
+      const uword value = get_register(rt, R31IsSP);
+      const uword addr = get_register(rn, R31IsSP);
+      const intptr_t status =
+          (size == 3)
+              ? WriteExclusiveX(addr, value, instr)
+              : WriteExclusiveW(addr, static_cast<uint32_t>(value), instr);
       set_register(instr, rs, status, R31IsSP);
     }
   }
diff --git a/runtime/vm/simulator_arm64.h b/runtime/vm/simulator_arm64.h
index 9482751..7cfbc16 100644
--- a/runtime/vm/simulator_arm64.h
+++ b/runtime/vm/simulator_arm64.h
@@ -185,6 +185,12 @@
   intptr_t ReadExclusiveW(uword addr, Instr* instr);
   intptr_t WriteExclusiveW(uword addr, intptr_t value, Instr* instr);
 
+  // Load Acquire & Store Release.
+  intptr_t ReadAcquire(uword addr, Instr* instr);
+  uint32_t ReadAcquireW(uword addr, Instr* instr);
+  void WriteRelease(uword addr, intptr_t value, Instr* instr);
+  void WriteReleaseW(uword addr, uint32_t value, Instr* instr);
+
   // Exclusive access reservation: address and value observed during
   // load-exclusive. Store-exclusive verifies that address is the same and
   // performs atomic compare-and-swap with remembered value to observe value
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index 338b6b3..4667869 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -203,6 +203,7 @@
   V(LibraryPrefix, "LibraryPrefix")                                            \
   V(List, "List")                                                              \
   V(ListFactory, "List.")                                                      \
+  V(ListFilledFactory, "List.filled")                                          \
   V(ListLiteralFactory, "List._fromLiteral")                                   \
   V(LocalVarDescriptors, "LocalVarDescriptors")                                \
   V(Map, "Map")                                                                \
diff --git a/runtime/vm/thread_pool_test.cc b/runtime/vm/thread_pool_test.cc
index 1dcf3df..35eaa36 100644
--- a/runtime/vm/thread_pool_test.cc
+++ b/runtime/vm/thread_pool_test.cc
@@ -19,12 +19,7 @@
   UNIT_TEST_CASE(name) {                                                       \
     OSThread::Init();                                                          \
     name##helper();                                                            \
-    /* Delete the current thread's TLS and set it's TLS to null. */            \
-    /* If it is the last thread then the destructor would call */              \
-    /* OSThread::Cleanup. */                                                   \
-    OSThread* os_thread = OSThread::Current();                                 \
-    OSThread::SetCurrent(nullptr);                                             \
-    delete os_thread;                                                          \
+    OSThread::Cleanup();                                                       \
   }                                                                            \
   void name##helper()
 
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart
index e0c10e8..ab61378 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart
@@ -313,6 +313,7 @@
         '(window.IDBKeyRange && # instanceof IDBKeyRange) || '
         '# instanceof ImageData || '
         '# instanceof Node || '
+        '(window.DataView && # instanceof DataView) || '
         // Int8Array.__proto__ is TypedArray.
         '(window.Int8Array && # instanceof Int8Array.__proto__) || '
         '# instanceof Window)',
@@ -324,6 +325,7 @@
     o,
     o,
     o,
+    o,
     o);
 
 class _DartObject {
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index 6ee6431..ac585de 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -394,7 +394,7 @@
     } else if (end == null) {
       explanation = ": Not greater than or equal to $start";
     } else if (end > start) {
-      explanation = ": Not in range $start..$end, inclusive";
+      explanation = ": Not in inclusive range $start..$end";
     } else if (end < start) {
       explanation = ": Valid value range is empty";
     } else {
diff --git a/sdk_nnbd/BUILD.gn b/sdk_nnbd/BUILD.gn
index 7ddc49d..5354079 100644
--- a/sdk_nnbd/BUILD.gn
+++ b/sdk_nnbd/BUILD.gn
@@ -618,28 +618,41 @@
   visibility = [ ":create_full_sdk" ]
   deps = [
     ":copy_libraries",
-    "../utils/compiler:compile_dart2js_platform",
     "../utils/compiler:compile_dart2js_nnbd_strong_platform",
-    "../utils/compiler:compile_dart2js_server_platform",
+    "../utils/compiler:compile_dart2js_platform",
     "../utils/compiler:compile_dart2js_server_nnbd_strong_platform",
+    "../utils/compiler:compile_dart2js_server_platform",
   ]
   sources = [
-    "$root_out_dir/dart2js_platform.dill",
     "$root_out_dir/dart2js_nnbd_strong_platform.dill",
-    "$root_out_dir/dart2js_server_platform.dill",
+    "$root_out_dir/dart2js_platform.dill",
     "$root_out_dir/dart2js_server_nnbd_strong_platform.dill",
+    "$root_out_dir/dart2js_server_platform.dill",
   ]
   outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
 }
 
-# This rule copies ddc summaries to lib/_internal
-copy("copy_dev_compiler_summary") {
+# Copies DDC's SDK outline .dill to lib/_internal
+copy("copy_dev_compiler_outline") {
   visibility = [ ":copy_dev_compiler_sdk" ]
   deps = [
     ":copy_libraries",
     "../utils/dartdevc:dartdevc_platform",
   ]
-  sources = [ "$root_out_dir/ddc_sdk.dill" ]
+  sources = [ "$root_out_dir/ddc_outline.dill" ]
+
+  # TODO(nshahan) Fix the name here to be consistent and merge with below.
+  outputs = [ "$root_out_dir/dart-sdk/lib/_internal/ddc_sdk.dill" ]
+}
+
+# Copies DDC's SDK outline .dill with sound null safety to lib/_internal
+copy("copy_dev_compiler_outline_sound") {
+  visibility = [ "../utils/dartdevc:dartdevc_test" ]
+  deps = [
+    ":copy_libraries",
+    "../utils/dartdevc:dartdevc_platform_sound",
+  ]
+  sources = [ "$root_out_dir/ddc_outline_sound.dill" ]
   outputs = [ "$root_out_dir/dart-sdk/lib/_internal/{{source_file_part}}" ]
 }
 
@@ -720,7 +733,7 @@
   visibility = [ ":create_full_sdk" ]
   public_deps = [
     ":copy_dev_compiler_js",
-    ":copy_dev_compiler_summary",
+    ":copy_dev_compiler_outline",
     ":copy_dev_compiler_tools",
   ]
 }
diff --git a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/js_patch.dart b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/js_patch.dart
index d7f944a..feb5ef1 100644
--- a/sdk_nnbd/lib/_internal/js_dev_runtime/patch/js_patch.dart
+++ b/sdk_nnbd/lib/_internal/js_dev_runtime/patch/js_patch.dart
@@ -307,6 +307,7 @@
         '(window.IDBKeyRange && # instanceof IDBKeyRange) || '
         '# instanceof ImageData || '
         '# instanceof Node || '
+        '(window.DataView && # instanceof DataView) || '
         // Int8Array.__proto__ is TypedArray.
         '(window.Int8Array && # instanceof Int8Array.__proto__) || '
         '# instanceof Window)',
@@ -318,6 +319,7 @@
     o,
     o,
     o,
+    o,
     o);
 
 class _DartObject {
diff --git a/sdk_nnbd/lib/core/errors.dart b/sdk_nnbd/lib/core/errors.dart
index 80d29c7..a84c6ee 100644
--- a/sdk_nnbd/lib/core/errors.dart
+++ b/sdk_nnbd/lib/core/errors.dart
@@ -391,7 +391,7 @@
     } else if (end == null) {
       explanation = ": Not greater than or equal to $start";
     } else if (end > start) {
-      explanation = ": Not in range $start..$end, inclusive";
+      explanation = ": Not in inclusive range $start..$end";
     } else if (end < start) {
       explanation = ": Valid value range is empty";
     } else {
diff --git a/tests/co19/co19-co19.status b/tests/co19/co19-co19.status
index 798ffdd..00bb904 100644
--- a/tests/co19/co19-co19.status
+++ b/tests/co19/co19-co19.status
@@ -6,6 +6,8 @@
 Language/Classes/Abstract_Instance_Members/*: Skip # Not migrated to NNBD
 Language/Classes/Class_Member_Conflicts/*: Skip # Not migrated to NNBD
 Language/Classes/Constructors/*: Skip # Not migrated to NNBD
+Language/Classes/Constructors/Constant_Constructors/*: Skip # Not migrated to NNBD
+Language/Classes/Constructors/Factories/*: Skip # Not migrated to NNBD
 Language/Classes/Constructors/Generative_Constructors/*: Skip # Not migrated to NNBD
 Language/Classes/Getters/*: Skip # Not migrated to NNBD
 Language/Classes/Instance_Methods/*: Skip # Not migrated to NNBD
@@ -155,6 +157,7 @@
 LanguageFeatures/Simple-bounds/static/*: Skip # Not migrated to NNBD
 LanguageFeatures/Simple-bounds/static/type-aliases/*: Skip # Not migrated to NNBD
 LanguageFeatures/Spread-collections/*: Skip # Not migrated to NNBD
+LanguageFeatures/Subtyping/*: Skip # Not migrated to NNBD
 LanguageFeatures/Super-bounded-types/*: Skip # Not migrated to NNBD
 LanguageFeatures/Super-mixins/*: Skip # Not migrated to NNBD
 LanguageFeatures/Triple-Shift/*: Skip # Not migrated to NNBD
@@ -360,6 +363,7 @@
 LibTest/typed_data/Uint64List/*: Skip # Not migrated to NNBD
 LibTest/typed_data/Uint8ClampedList/*: Skip # Not migrated to NNBD
 LibTest/typed_data/Uint8List/*: Skip # Not migrated to NNBD
+Utils/tests/Expect/*: Skip # Not migrated to NNBD
 
 [ $compiler != fasta ]
 Language/Classes/Abstract_Instance_Members/inherited_t13: Skip # github.com/dart-lang/language/issues/115
@@ -622,4 +626,3 @@
 LanguageFeatures/Simple-bounds/static/typedef1_typedef_l1_t08: Skip # github.com/dart-lang/language/issues/115
 LanguageFeatures/regression/32903_t02: Skip # github.com/dart-lang/language/issues/115
 LanguageFeatures/regression/34560_t02: Skip # github.com/dart-lang/language/issues/115
-
diff --git a/tests/compiler/dart2js/annotations/data/marker.options b/tests/compiler/dart2js/annotations/data/marker.options
deleted file mode 100644
index 24b51f0..0000000
--- a/tests/compiler/dart2js/annotations/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/annotations/annotations_test.dart
-prod:nnbd-off=tests/compiler/dart2js/annotations/annotations_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/annotations/annotations_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/annotations/annotations_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/closure/data/marker.options b/tests/compiler/dart2js/closure/data/marker.options
deleted file mode 100644
index ba31510..0000000
--- a/tests/compiler/dart2js/closure/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/closure/closure_test.dart
-prod:nnbd-off=tests/compiler/dart2js/closure/closure_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/closure/closure_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/closure/closure_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/codegen/model_data/marker.options b/tests/compiler/dart2js/codegen/model_data/marker.options
deleted file mode 100644
index ab72a7b2..0000000
--- a/tests/compiler/dart2js/codegen/model_data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/codegen/model_test.dart
-prod:nnbd-off=tests/compiler/dart2js/codegen/model_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/codegen/model_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/codegen/model_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
deleted file mode 100644
index eef4d21..0000000
--- a/tests/compiler/dart2js/dart2js.status
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (c) 2012, 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.
-
-analyses/analyze_test: Slow, Pass
-analyses/api_dynamic_test: Slow, Pass
-analyses/dart2js_dynamic_test: Slow, Pass
-closure/closure_test: Slow, Pass
-codegen/load_elimination_test: Slow, Pass
-codegen/model_test: Slow, Pass
-deferred_loading/deferred_loading_test: Slow, Pass
-end_to_end/dump_info_test: Slow, Pass
-equivalence/id_equivalence1_test: Slow, Pass
-equivalence/id_equivalence2_test: Slow, Pass
-impact/impact_test: Slow, Pass
-inference/inference0_test: Slow, Pass
-inference/inference1_test: Slow, Pass
-inference/inference2_test: Slow, Pass
-inference/inference3_test: Slow, Pass
-inference/swarm_test: Slow, Pass #
-inlining/inlining_test: Slow, Pass
-model/native_test: Slow, Pass
-model/no_such_method_enabled_test: Slow, Pass
-model/subtype_test: Slow, Pass
-modular/*: Slow, Pass
-packages/*: Skip # Skip packages folder
-rti/rti_emission_test: Slow, Pass
-rti/rti_need0_test: Slow, Pass
-rti/rti_need1_test: Slow, Pass
-serialization/serialization_test: Slow, Pass
-sourcemaps/source_mapping_invokes_test: Slow, Pass
-sourcemaps/source_mapping_operators_test: Slow, Pass
-sourcemaps/source_mapping_test: Slow, Pass
-sourcemaps/stacktrace_test: Slow, Pass
-
-[ $mode == debug ]
-deferred/load_graph_segmentation_test: Slow, Pass
-deferred/load_mapping_test: Slow, Pass
-end_to_end/dart2js_batch_test: Slow, Pass
-end_to_end/exit_code_test: Slow, Pass
-end_to_end/in_user_code_test: Slow, Pass
-
-[ $checked ]
-codegen/value_range_kernel_test: Slow, Pass
-codegen/value_range_test: Slow, Pass
-end_to_end/exit_code_test: Slow, Pass
-end_to_end/output_type_test: Slow, Pass
-end_to_end/uri_retention_test: Slow, Pass
-jsinterop/declaration_test: Slow, Pass
-jsinterop/interop_anonymous_unreachable_test: Slow, Pass
-jsinterop/world_test: Slow, Pass
-sourcemaps/stacktrace_test: Slow, Pass
-
-[ !$checked ]
-end_to_end/exit_code_test: Skip # This tests requires checked mode.
-jsinterop/declaration_test: Slow, Pass
-
-[ $runtime == chrome || $runtime == ff || $runtime == firefox || $runtime == safari || $jscl ]
-*: Skip # dart2js uses #import('dart:io'); and it is not self-hosted (yet).
diff --git a/tests/compiler/dart2js/deferred_loading/data/marker.options b/tests/compiler/dart2js/deferred_loading/data/marker.options
deleted file mode 100644
index c970e11..0000000
--- a/tests/compiler/dart2js/deferred_loading/data/marker.options
+++ /dev/null
@@ -1,2 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/field_analysis/jdata/marker.options b/tests/compiler/dart2js/field_analysis/jdata/marker.options
deleted file mode 100644
index f333b74..0000000
--- a/tests/compiler/dart2js/field_analysis/jdata/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart
-prod:nnbd-off=tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/field_analysis/jfield_analysis_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/field_analysis/kdata/marker.options b/tests/compiler/dart2js/field_analysis/kdata/marker.options
deleted file mode 100644
index 19ad6c1..0000000
--- a/tests/compiler/dart2js/field_analysis/kdata/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart
-prod:nnbd-off=tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/field_analysis/kfield_analysis_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/impact/data/marker.options b/tests/compiler/dart2js/impact/data/marker.options
deleted file mode 100644
index 8ea68a6..0000000
--- a/tests/compiler/dart2js/impact/data/marker.options
+++ /dev/null
@@ -1,2 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/impact/impact_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/impact/impact_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/callers/marker.options b/tests/compiler/dart2js/inference/callers/marker.options
deleted file mode 100644
index 64dc9c4..0000000
--- a/tests/compiler/dart2js/inference/callers/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/inference/callers_test.dart
-prod:nnbd-off=tests/compiler/dart2js/inference/callers_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/inference/callers_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/inference/callers_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/data/marker.options b/tests/compiler/dart2js/inference/data/marker.options
deleted file mode 100644
index 46aaaf9..0000000
--- a/tests/compiler/dart2js/inference/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/inference/inference_test_helper.dart
-prod:nnbd-off=tests/compiler/dart2js/inference/inference_test_helper.dart
-spec:nnbd-sdk=tests/compiler/dart2js/inference/inference_test_helper.dart
-prod:nnbd-sdk=tests/compiler/dart2js/inference/inference_test_helper.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inference/inference_data/marker.options b/tests/compiler/dart2js/inference/inference_data/marker.options
deleted file mode 100644
index 1ac262c..0000000
--- a/tests/compiler/dart2js/inference/inference_data/marker.options
+++ /dev/null
@@ -1,2 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/inference/inference_data_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/inference/inference_data_test.dart
diff --git a/tests/compiler/dart2js/inference/side_effects/marker.options b/tests/compiler/dart2js/inference/side_effects/marker.options
deleted file mode 100644
index 18f405c..0000000
--- a/tests/compiler/dart2js/inference/side_effects/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/inference/side_effects_test.dart
-prod:nnbd-off=tests/compiler/dart2js/inference/side_effects_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/inference/side_effects_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/inference/side_effects_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/inlining/data/marker.options b/tests/compiler/dart2js/inlining/data/marker.options
deleted file mode 100644
index 2dc3010..0000000
--- a/tests/compiler/dart2js/inlining/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/inlining/inlining_test.dart
-prod:nnbd-off=tests/compiler/dart2js/inlining/inlining_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/inlining/inlining_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/inlining/inlining_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/jumps/data/marker.options b/tests/compiler/dart2js/jumps/data/marker.options
deleted file mode 100644
index 6c8f0b4..0000000
--- a/tests/compiler/dart2js/jumps/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/jumps/jump_test.dart
-prod:nnbd-off=tests/compiler/dart2js/jumps/jump_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/jumps/jump_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/jumps/jump_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/member_usage/data/marker.options b/tests/compiler/dart2js/member_usage/data/marker.options
deleted file mode 100644
index 31de344..0000000
--- a/tests/compiler/dart2js/member_usage/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/member_usage/member_usage_test.dart
-prod:nnbd-off=tests/compiler/dart2js/member_usage/member_usage_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/member_usage/member_usage_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/member_usage/member_usage_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/optimization/data/marker.options b/tests/compiler/dart2js/optimization/data/marker.options
deleted file mode 100644
index 2c09b09..0000000
--- a/tests/compiler/dart2js/optimization/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/optimization/optimization_test.dart
-prod:nnbd-off=tests/compiler/dart2js/optimization/optimization_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/optimization/optimization_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/optimization/optimization_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/rti/data/marker.options b/tests/compiler/dart2js/rti/data/marker.options
deleted file mode 100644
index cef4600..0000000
--- a/tests/compiler/dart2js/rti/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/rti/rti_need_test_helper.dart
-prod:nnbd-off=tests/compiler/dart2js/rti/rti_need_test_helper.dart
-spec:nnbd-sdk=tests/compiler/dart2js/rti/rti_need_test_helper.dart
-prod:nnbd-sdk=tests/compiler/dart2js/rti/rti_need_test_helper.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/rti/emission/marker.options b/tests/compiler/dart2js/rti/emission/marker.options
deleted file mode 100644
index a072260..0000000
--- a/tests/compiler/dart2js/rti/emission/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/rti/rti_emission_test.dart
-prod:nnbd-off=tests/compiler/dart2js/rti/rti_emission_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/rti/rti_emission_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/rti/rti_emission_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/static_type/data/marker.options b/tests/compiler/dart2js/static_type/data/marker.options
deleted file mode 100644
index 12bfcee..0000000
--- a/tests/compiler/dart2js/static_type/data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/static_type/static_type_test.dart
-prod:nnbd-off=tests/compiler/dart2js/static_type/static_type_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/static_type/static_type_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/static_type/static_type_test.dart
\ No newline at end of file
diff --git a/tests/compiler/dart2js/static_type/type_promotion_data/marker.options b/tests/compiler/dart2js/static_type/type_promotion_data/marker.options
deleted file mode 100644
index d745ddd..0000000
--- a/tests/compiler/dart2js/static_type/type_promotion_data/marker.options
+++ /dev/null
@@ -1,4 +0,0 @@
-spec:nnbd-off=tests/compiler/dart2js/static_type/type_promotion_test.dart
-prod:nnbd-off=tests/compiler/dart2js/static_type/type_promotion_test.dart
-spec:nnbd-sdk=tests/compiler/dart2js/static_type/type_promotion_test.dart
-prod:nnbd-sdk=tests/compiler/dart2js/static_type/type_promotion_test.dart
\ No newline at end of file
diff --git a/tests/corelib/errors_test.dart b/tests/corelib/errors_test.dart
index 9d040c9..b96ffea 100644
--- a/tests/corelib/errors_test.dart
+++ b/tests/corelib/errors_test.dart
@@ -39,15 +39,14 @@
   Expect.equals("RangeError: message: 42",
       new RangeError.value(42, null, "message").toString());
 
-  Expect.equals("RangeError: Invalid value: Not in range 2..9, inclusive: 42",
+  Expect.equals("RangeError: Invalid value: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9).toString());
   Expect.equals(
-      "RangeError (foo): Invalid value: Not in range 2..9, "
-      "inclusive: 42",
+      "RangeError (foo): Invalid value: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9, "foo").toString());
-  Expect.equals("RangeError (foo): message: Not in range 2..9, inclusive: 42",
+  Expect.equals("RangeError (foo): message: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9, "foo", "message").toString());
-  Expect.equals("RangeError: message: Not in range 2..9, inclusive: 42",
+  Expect.equals("RangeError: message: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9, null, "message").toString());
 
   Expect.equals(
diff --git a/tests/corelib_2/errors_test.dart b/tests/corelib_2/errors_test.dart
index 9d040c9..b96ffea 100644
--- a/tests/corelib_2/errors_test.dart
+++ b/tests/corelib_2/errors_test.dart
@@ -39,15 +39,14 @@
   Expect.equals("RangeError: message: 42",
       new RangeError.value(42, null, "message").toString());
 
-  Expect.equals("RangeError: Invalid value: Not in range 2..9, inclusive: 42",
+  Expect.equals("RangeError: Invalid value: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9).toString());
   Expect.equals(
-      "RangeError (foo): Invalid value: Not in range 2..9, "
-      "inclusive: 42",
+      "RangeError (foo): Invalid value: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9, "foo").toString());
-  Expect.equals("RangeError (foo): message: Not in range 2..9, inclusive: 42",
+  Expect.equals("RangeError (foo): message: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9, "foo", "message").toString());
-  Expect.equals("RangeError: message: Not in range 2..9, inclusive: 42",
+  Expect.equals("RangeError: message: Not in inclusive range 2..9: 42",
       new RangeError.range(42, 2, 9, null, "message").toString());
 
   Expect.equals(
diff --git a/tests/language/implicit_downcast_during/assert_initializer_test.dart b/tests/language/implicit_downcast_during/assert_initializer_test.dart
new file mode 100644
index 0000000..dd8c975
--- /dev/null
+++ b/tests/language/implicit_downcast_during/assert_initializer_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class C {
+  C.oneArg(Object x) : assert(x);
+  //                          ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_EXPRESSION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+  C.twoArgs(Object x, Object y) : assert(x, y);
+  //                                     ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_EXPRESSION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
+
+void main() {
+  Object b = true;
+  new C.oneArg(b);
+  new C.twoArgs(false, b);
+}
diff --git a/tests/language/implicit_downcast_during/assert_statement_test.dart b/tests/language/implicit_downcast_during/assert_statement_test.dart
new file mode 100644
index 0000000..9f0aa75
--- /dev/null
+++ b/tests/language/implicit_downcast_during/assert_statement_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = true;
+  assert(b);
+  //     ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_EXPRESSION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+  assert(b, 'should not fail');
+  //     ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_EXPRESSION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+  assert(false, b);
+  // OK, the message can have any type.
+}
diff --git a/tests/language/implicit_downcast_during/assignment_test.dart b/tests/language/implicit_downcast_during/assignment_test.dart
new file mode 100644
index 0000000..fe9f1e4
--- /dev/null
+++ b/tests/language/implicit_downcast_during/assignment_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  B b;
+  A a = new B();
+  b = a;
+  //  ^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/combiner_test.dart b/tests/language/implicit_downcast_during/combiner_test.dart
new file mode 100644
index 0000000..840d2e8
--- /dev/null
+++ b/tests/language/implicit_downcast_during/combiner_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  C operator +(B b) => this;
+}
+
+void main() {
+  C c = new C();
+  A a = new B();
+  c += a;
+  //   ^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/compound_assignment_test.dart b/tests/language/implicit_downcast_during/compound_assignment_test.dart
new file mode 100644
index 0000000..a927b55
--- /dev/null
+++ b/tests/language/implicit_downcast_during/compound_assignment_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {
+  Object operator +(Object x) => x;
+}
+
+void main() {
+  B b = B();
+
+  b += 2;
+  //^
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'B'.
+  //   ^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+
+  ++b;
+//^^^
+// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'B'.
+
+  b++;
+//^^^
+// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+// ^
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/conditional_expression_test.dart b/tests/language/implicit_downcast_during/conditional_expression_test.dart
new file mode 100644
index 0000000..565f124
--- /dev/null
+++ b/tests/language/implicit_downcast_during/conditional_expression_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = true;
+  b ? 1 : 2;
+//^
+// [analyzer] STATIC_TYPE_WARNING.NON_BOOL_CONDITION
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
diff --git a/tests/language/implicit_downcast_during/constructor_initializer_test.dart b/tests/language/implicit_downcast_during/constructor_initializer_test.dart
new file mode 100644
index 0000000..2013e9f
--- /dev/null
+++ b/tests/language/implicit_downcast_during/constructor_initializer_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  B b;
+  C(A a) : b = a;
+  //           ^
+  // [analyzer] STATIC_WARNING.FIELD_INITIALIZER_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
+
+void main() {
+  A a = new B();
+  new C(a);
+}
diff --git a/tests/language/implicit_downcast_during/constructor_invocation_test.dart b/tests/language/implicit_downcast_during/constructor_invocation_test.dart
new file mode 100644
index 0000000..97de4ce
--- /dev/null
+++ b/tests/language/implicit_downcast_during/constructor_invocation_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  C(B b);
+}
+
+main() {
+  A a = new B();
+  new C(a);
+  //    ^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/do_test.dart b/tests/language/implicit_downcast_during/do_test.dart
new file mode 100644
index 0000000..f4bebde
--- /dev/null
+++ b/tests/language/implicit_downcast_during/do_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = false;
+  do {} while (b);
+  //           ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_CONDITION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
diff --git a/tests/language/implicit_downcast_during/factory_constructor_invocation_test.dart b/tests/language/implicit_downcast_during/factory_constructor_invocation_test.dart
new file mode 100644
index 0000000..8e889a2
--- /dev/null
+++ b/tests/language/implicit_downcast_during/factory_constructor_invocation_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  factory C(B b) => new C._();
+  C._();
+}
+
+main() {
+  A a = new B();
+  new C(a);
+  //    ^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/field_declaration_test.dart b/tests/language/implicit_downcast_during/field_declaration_test.dart
new file mode 100644
index 0000000..4f819a2
--- /dev/null
+++ b/tests/language/implicit_downcast_during/field_declaration_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+A a1 = new B();
+B b1 = a1;
+//     ^^
+// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+// [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+
+class C {
+  static B b3 = a1;
+  //            ^^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+
+  B b5 = a1;
+  //     ^^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
+
+void main() {
+  b1;
+  C.b3;
+  new C();
+}
diff --git a/tests/language/implicit_downcast_during/for_condition_test.dart b/tests/language/implicit_downcast_during/for_condition_test.dart
new file mode 100644
index 0000000..645b943
--- /dev/null
+++ b/tests/language/implicit_downcast_during/for_condition_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = false;
+  for (int i = 0; b; i++) {}
+  //              ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_CONDITION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
diff --git a/tests/language/implicit_downcast_during/for_in_element_test.dart b/tests/language/implicit_downcast_during/for_in_element_test.dart
new file mode 100644
index 0000000..30273be
--- /dev/null
+++ b/tests/language/implicit_downcast_during/for_in_element_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  List<A> listOfA = <A>[new B()];
+  Object o = listOfA;
+  for (B x in o) {}
+  //          ^
+  // [analyzer] STATIC_TYPE_WARNING.FOR_IN_OF_INVALID_TYPE
+  // [cfe] The type 'Object' used in the 'for' loop must implement 'Iterable<dynamic>'.
+  for (B x in listOfA) {}
+  //     ^
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  //          ^^^^^^^
+  // [analyzer] STATIC_TYPE_WARNING.FOR_IN_OF_INVALID_ELEMENT_TYPE
+  B y;
+  for (y in o) {}
+  //        ^
+  // [analyzer] STATIC_TYPE_WARNING.FOR_IN_OF_INVALID_TYPE
+  // [cfe] The type 'Object' used in the 'for' loop must implement 'Iterable<dynamic>'.
+  for (y in listOfA) {}
+  //     ^
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  //        ^^^^^^^
+  // [analyzer] STATIC_TYPE_WARNING.FOR_IN_OF_INVALID_ELEMENT_TYPE
+}
diff --git a/tests/language/implicit_downcast_during/for_in_iterable_test.dart b/tests/language/implicit_downcast_during/for_in_iterable_test.dart
new file mode 100644
index 0000000..09fd2cf
--- /dev/null
+++ b/tests/language/implicit_downcast_during/for_in_iterable_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  Object o = <A>[];
+  for (var x in o) {}
+  //            ^
+  // [analyzer] STATIC_TYPE_WARNING.FOR_IN_OF_INVALID_TYPE
+  // [cfe] The type 'Object' used in the 'for' loop must implement 'Iterable<dynamic>'.
+  for (B x in o) {}
+  //          ^
+  // [analyzer] STATIC_TYPE_WARNING.FOR_IN_OF_INVALID_TYPE
+  // [cfe] The type 'Object' used in the 'for' loop must implement 'Iterable<dynamic>'.
+  B y;
+  for (y in o) {}
+  //        ^
+  // [analyzer] STATIC_TYPE_WARNING.FOR_IN_OF_INVALID_TYPE
+  // [cfe] The type 'Object' used in the 'for' loop must implement 'Iterable<dynamic>'.
+}
diff --git a/tests/language/implicit_downcast_during/for_initializer_expression_test.dart b/tests/language/implicit_downcast_during/for_initializer_expression_test.dart
new file mode 100644
index 0000000..8c14537
--- /dev/null
+++ b/tests/language/implicit_downcast_during/for_initializer_expression_test.dart
@@ -0,0 +1,12 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = 0;
+  int i;
+  for (i = b; i < 1; i++) {}
+  //       ^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'int'.
+}
diff --git a/tests/language/implicit_downcast_during/for_initializer_var_test.dart b/tests/language/implicit_downcast_during/for_initializer_var_test.dart
new file mode 100644
index 0000000..958c111
--- /dev/null
+++ b/tests/language/implicit_downcast_during/for_initializer_var_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = 0;
+  for (int i = b; i < 1; i++) {}
+  //           ^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'int'.
+}
diff --git a/tests/language/implicit_downcast_during/function_literal_arrow_test.dart b/tests/language/implicit_downcast_during/function_literal_arrow_test.dart
new file mode 100644
index 0000000..3f5950e
--- /dev/null
+++ b/tests/language/implicit_downcast_during/function_literal_arrow_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  A a = new B();
+  B Function(A) f = (A a) => a;
+  //                         ^
+  // [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE_FROM_CLOSURE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/function_literal_return_test.dart b/tests/language/implicit_downcast_during/function_literal_return_test.dart
new file mode 100644
index 0000000..f7862a1
--- /dev/null
+++ b/tests/language/implicit_downcast_during/function_literal_return_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  A a = new B();
+  B Function(A) f = (A a) {
+    return a;
+    //     ^
+    // [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE_FROM_CLOSURE
+    // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  };
+}
diff --git a/tests/language/implicit_downcast_during/if_null_assignment_test.dart b/tests/language/implicit_downcast_during/if_null_assignment_test.dart
new file mode 100644
index 0000000..09f1e97
--- /dev/null
+++ b/tests/language/implicit_downcast_during/if_null_assignment_test.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  B? b;
+  A? a = new B();
+  b ??= a;
+//      ^
+// [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+// [cfe] A value of type 'A?' can't be assigned to a variable of type 'B?'.
+}
diff --git a/tests/language/implicit_downcast_during/if_statement_test.dart b/tests/language/implicit_downcast_during/if_statement_test.dart
new file mode 100644
index 0000000..fb46a9b
--- /dev/null
+++ b/tests/language/implicit_downcast_during/if_statement_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = true;
+  if (b) {}
+  //  ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_CONDITION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
diff --git a/tests/language/implicit_downcast_during/indexed_assignment_test.dart b/tests/language/implicit_downcast_during/indexed_assignment_test.dart
new file mode 100644
index 0000000..3f5ce05
--- /dev/null
+++ b/tests/language/implicit_downcast_during/indexed_assignment_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  void operator []=(B b, B b2) {}
+}
+
+void main() {
+  A a = new B();
+  C c = new C();
+  c[a] = a;
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  //     ^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/indexed_compound_assignment_test.dart b/tests/language/implicit_downcast_during/indexed_compound_assignment_test.dart
new file mode 100644
index 0000000..bf7a60b
--- /dev/null
+++ b/tests/language/implicit_downcast_during/indexed_compound_assignment_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  int operator [](A a) => 0;
+  void operator []=(B b, int o) {}
+}
+
+class D {
+  int operator [](B b) => 0;
+  void operator []=(A a, int o) {}
+}
+
+void main() {
+  A a = new B();
+  C c = new C();
+  D d = new D();
+  c[a] += 1;
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  d[a] += 1;
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/indexed_get_test.dart b/tests/language/implicit_downcast_during/indexed_get_test.dart
new file mode 100644
index 0000000..790cbd4
--- /dev/null
+++ b/tests/language/implicit_downcast_during/indexed_get_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  Object operator [](B b) => 0;
+}
+
+void main() {
+  A a = new B();
+  C c = new C();
+  c[a];
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/indexed_if_null_assignment_test.dart b/tests/language/implicit_downcast_during/indexed_if_null_assignment_test.dart
new file mode 100644
index 0000000..5b7d5f1
--- /dev/null
+++ b/tests/language/implicit_downcast_during/indexed_if_null_assignment_test.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  Object? operator [](A a) => 0;
+  void operator []=(B b, Object o) {}
+}
+
+class D {
+  Object? operator [](B b) => 0;
+  void operator []=(A a, Object o) {}
+}
+
+class E {
+  Object? operator [](A a) => null;
+  void operator []=(B b, Object o) {}
+}
+
+void main() {
+  A a = new A();
+  C c = new C();
+  D d = new D();
+  E e = new E();
+  c[a] ??= 1;
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  d[a] ??= 1;
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  e[a] ??= 1;
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  c[a] ??= 1;
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/invocation_test.dart b/tests/language/implicit_downcast_during/invocation_test.dart
new file mode 100644
index 0000000..ed265bc
--- /dev/null
+++ b/tests/language/implicit_downcast_during/invocation_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void f(B b) {}
+
+main() {
+  A a = new B();
+  f(a);
+  //^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/list_literal_test.dart b/tests/language/implicit_downcast_during/list_literal_test.dart
new file mode 100644
index 0000000..1edcd58
--- /dev/null
+++ b/tests/language/implicit_downcast_during/list_literal_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  A a = new B();
+  <B>[a];
+  //  ^
+  // [analyzer] STATIC_WARNING.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/logical_expression_test.dart b/tests/language/implicit_downcast_during/logical_expression_test.dart
new file mode 100644
index 0000000..8e73fa1
--- /dev/null
+++ b/tests/language/implicit_downcast_during/logical_expression_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object o = new Object();
+  o || o;
+//^
+// [analyzer] STATIC_TYPE_WARNING.NON_BOOL_OPERAND
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+//     ^
+// [analyzer] STATIC_TYPE_WARNING.NON_BOOL_OPERAND
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+
+  o && o;
+//^
+// [analyzer] STATIC_TYPE_WARNING.NON_BOOL_OPERAND
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+//     ^
+// [analyzer] STATIC_TYPE_WARNING.NON_BOOL_OPERAND
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
diff --git a/tests/language/implicit_downcast_during/map_literal_test.dart b/tests/language/implicit_downcast_during/map_literal_test.dart
new file mode 100644
index 0000000..e86fae3
--- /dev/null
+++ b/tests/language/implicit_downcast_during/map_literal_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  A a = new B();
+  <B, Object>{a: 1};
+  //          ^
+  // [analyzer] STATIC_WARNING.MAP_KEY_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+  <Object, B>{1: a};
+  //             ^
+  // [analyzer] STATIC_WARNING.MAP_VALUE_TYPE_NOT_ASSIGNABLE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/method_invocation_test.dart b/tests/language/implicit_downcast_during/method_invocation_test.dart
new file mode 100644
index 0000000..47e66ce
--- /dev/null
+++ b/tests/language/implicit_downcast_during/method_invocation_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  void f(B b) {}
+}
+
+main() {
+  C c = new C();
+  A a = new B();
+  c.f(a);
+  //  ^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/not_test.dart b/tests/language/implicit_downcast_during/not_test.dart
new file mode 100644
index 0000000..de8a43a
--- /dev/null
+++ b/tests/language/implicit_downcast_during/not_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = true;
+  !b;
+// ^
+// [analyzer] STATIC_TYPE_WARNING.NON_BOOL_NEGATION_EXPRESSION
+// [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
diff --git a/tests/language/implicit_downcast_during/null_aware_method_invocation_test.dart b/tests/language/implicit_downcast_during/null_aware_method_invocation_test.dart
new file mode 100644
index 0000000..0b1d404
--- /dev/null
+++ b/tests/language/implicit_downcast_during/null_aware_method_invocation_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  void f(B b) {}
+}
+
+main() {
+  C? c = new C();
+  A a = new B();
+  c?.f(a);
+//     ^
+// [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+// [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/redirecting_initializer_test.dart b/tests/language/implicit_downcast_during/redirecting_initializer_test.dart
new file mode 100644
index 0000000..bc6f7b3
--- /dev/null
+++ b/tests/language/implicit_downcast_during/redirecting_initializer_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  C(A a) : this._(a);
+  //              ^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+  C._(B b);
+}
+
+main() {
+  A a = new B();
+  new C(a);
+}
diff --git a/tests/language/implicit_downcast_during/return_async_test.dart b/tests/language/implicit_downcast_during/return_async_test.dart
new file mode 100644
index 0000000..aea8c61
--- /dev/null
+++ b/tests/language/implicit_downcast_during/return_async_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2017, 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 'dart:async';
+
+class A {}
+
+class B extends A {}
+
+Future<B> f1(A a) async {
+  return a as FutureOr<A>;
+  //     ^^^^^^^^^^^^^^^^
+  // [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE
+  //       ^
+  // [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'FutureOr<B>'.
+}
+
+Future<B> f2(A a) async => a as FutureOr<A>;
+//                         ^^^^^^^^^^^^^^^^
+// [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE
+//                           ^
+// [cfe] A value of type 'Future<A>' can't be assigned to a variable of type 'FutureOr<B>'.
+
+main() async {
+  Object b;
+  A a = new B();
+  b = await f1(a);
+  b = await f2(a);
+  a = new A();
+}
diff --git a/tests/language/implicit_downcast_during/return_test.dart b/tests/language/implicit_downcast_during/return_test.dart
new file mode 100644
index 0000000..3bbffe8
--- /dev/null
+++ b/tests/language/implicit_downcast_during/return_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+B f1(A a) {
+  return a;
+  //     ^
+  // [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
+
+B f2(A a) => a;
+//           ^
+// [analyzer] STATIC_TYPE_WARNING.RETURN_OF_INVALID_TYPE
+// [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+
+void main() {
+  Object b;
+  A a = new B();
+  b = f1(a);
+  b = f2(a);
+}
diff --git a/tests/language/implicit_downcast_during/static_method_invocation_test.dart b/tests/language/implicit_downcast_during/static_method_invocation_test.dart
new file mode 100644
index 0000000..4b6570c
--- /dev/null
+++ b/tests/language/implicit_downcast_during/static_method_invocation_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class C {
+  static void f(B b) {}
+}
+
+main() {
+  A a = new B();
+  C.f(a);
+  //  ^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/super_initializer_test.dart b/tests/language/implicit_downcast_during/super_initializer_test.dart
new file mode 100644
index 0000000..8931361
--- /dev/null
+++ b/tests/language/implicit_downcast_during/super_initializer_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class Base {
+  Base(B b);
+}
+
+class C extends Base {
+  C(A a) : super(a);
+  //             ^
+  // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+  // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+}
+
+main() {
+  A a = new B();
+  new C(a);
+}
diff --git a/tests/language/implicit_downcast_during/super_method_invocation_test.dart b/tests/language/implicit_downcast_during/super_method_invocation_test.dart
new file mode 100644
index 0000000..fe16df1
--- /dev/null
+++ b/tests/language/implicit_downcast_during/super_method_invocation_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+class Base {
+  void g(B b) {}
+}
+
+class C extends Base {
+  void f(A a) {
+    g(a);
+    //^
+    // [analyzer] STATIC_WARNING.ARGUMENT_TYPE_NOT_ASSIGNABLE
+    // [cfe] The argument type 'A' can't be assigned to the parameter type 'B'.
+  }
+}
+
+main() {
+  C c = new C();
+  A a = new B();
+  c.f(a);
+}
diff --git a/tests/language/implicit_downcast_during/variable_declaration_test.dart b/tests/language/implicit_downcast_during/variable_declaration_test.dart
new file mode 100644
index 0000000..a44f239
--- /dev/null
+++ b/tests/language/implicit_downcast_during/variable_declaration_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+void main() {
+  A a = new B();
+  B b = a;
+  //    ^
+  // [analyzer] STATIC_TYPE_WARNING.INVALID_ASSIGNMENT
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
diff --git a/tests/language/implicit_downcast_during/while_statement_test.dart b/tests/language/implicit_downcast_during/while_statement_test.dart
new file mode 100644
index 0000000..3aa386b
--- /dev/null
+++ b/tests/language/implicit_downcast_during/while_statement_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2017, 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.
+
+void main() {
+  Object b = false;
+  while (b) {}
+  //     ^
+  // [analyzer] STATIC_TYPE_WARNING.NON_BOOL_CONDITION
+  // [cfe] A value of type 'Object' can't be assigned to a variable of type 'bool'.
+}
diff --git a/tests/language/implicit_downcast_during/yield_star_test.dart b/tests/language/implicit_downcast_during/yield_star_test.dart
new file mode 100644
index 0000000..990ec66
--- /dev/null
+++ b/tests/language/implicit_downcast_during/yield_star_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+Iterable<B> f(Iterable<A> a) sync* {
+  yield* a;
+  //     ^
+  // [analyzer] STATIC_TYPE_WARNING.YIELD_OF_INVALID_TYPE
+  // [cfe] A value of type 'Iterable<A>' can't be assigned to a variable of type 'Iterable<B>'.
+}
+
+void main() {
+  B b = new B();
+  for (var x in f(<B>[b])) {}
+}
diff --git a/tests/language/implicit_downcast_during/yield_test.dart b/tests/language/implicit_downcast_during/yield_test.dart
new file mode 100644
index 0000000..8f98bd2
--- /dev/null
+++ b/tests/language/implicit_downcast_during/yield_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2017, 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.
+
+class A {}
+
+class B extends A {}
+
+Iterable<B> f(A a) sync* {
+  yield a;
+  //    ^
+  // [analyzer] STATIC_TYPE_WARNING.YIELD_OF_INVALID_TYPE
+  // [cfe] A value of type 'A' can't be assigned to a variable of type 'B'.
+}
+
+void main() {
+  A a = new B();
+  for (var x in f(a)) {}
+  a = new A();
+  var iterator = f(a).iterator;
+}
diff --git a/tests/language/interface/interface2_test.dart b/tests/language/interface/interface2_test.dart
index 7b8282c..6a0a762 100644
--- a/tests/language/interface/interface2_test.dart
+++ b/tests/language/interface/interface2_test.dart
@@ -8,8 +8,6 @@
 //                                      ^^^^^^
 // [analyzer] COMPILE_TIME_ERROR.IMPLEMENTS_NON_CLASS
 // [cfe] Type 'BooHoo' not found.
-//                                      ^^^^^^
-// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_CLASS
 
 main() {
   Interface2NegativeTest();
diff --git a/tests/language/invalid_returns/async_invalid_return_00_test.dart b/tests/language/invalid_returns/async_invalid_return_00_test.dart
index 1b2e03c..6df2790 100644
--- a/tests/language/invalid_returns/async_invalid_return_00_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_00_test.dart
@@ -22,18 +22,14 @@
 // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Null>`, no error.
 Object Function() test3 = () async {
   return;
-//^
-// [analyzer] unspecified
-// [cfe] unspecified
 };
 
+// Inferred return type of function literal is `Future<Null>`, no error.
 Object? Function() test4 = () async {
   return;
-//^
-// [analyzer] unspecified
-// [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_03_test.dart b/tests/language/invalid_returns/async_invalid_return_03_test.dart
index 40bb341..7845404 100644
--- a/tests/language/invalid_returns/async_invalid_return_03_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_03_test.dart
@@ -15,11 +15,9 @@
 // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Null>`, no error.
 Future<Object?> Function() test2 = () async {
   return;
-//^
-// [analyzer] unspecified
-// [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_04_test.dart b/tests/language/invalid_returns/async_invalid_return_04_test.dart
index f1e1ad3..4c0b193 100644
--- a/tests/language/invalid_returns/async_invalid_return_04_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_04_test.dart
@@ -15,11 +15,9 @@
 // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Null>`, no error.
 FutureOr<Object?> Function() test2 = () async {
   return;
-//^
-// [analyzer] unspecified
-// [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_05_test.dart b/tests/language/invalid_returns/async_invalid_return_05_test.dart
index aecbb45..d11a4b5 100644
--- a/tests/language/invalid_returns/async_invalid_return_05_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_05_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 void Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_08_test.dart b/tests/language/invalid_returns/async_invalid_return_08_test.dart
index 435742f..09950ac 100644
--- a/tests/language/invalid_returns/async_invalid_return_08_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_08_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Object>`, no error.
 void Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_11_test.dart b/tests/language/invalid_returns/async_invalid_return_11_test.dart
index dee2323..b85f731 100644
--- a/tests/language/invalid_returns/async_invalid_return_11_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_11_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int?>`, no error.
 void Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_14_test.dart b/tests/language/invalid_returns/async_invalid_return_14_test.dart
index e8014db..3eaa715 100644
--- a/tests/language/invalid_returns/async_invalid_return_14_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_14_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 void Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_17_test.dart b/tests/language/invalid_returns/async_invalid_return_17_test.dart
index 536a110..f347a21 100644
--- a/tests/language/invalid_returns/async_invalid_return_17_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_17_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Object>`, no error.
 void Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_20_test.dart b/tests/language/invalid_returns/async_invalid_return_20_test.dart
index 8a5be6d..5b54f78 100644
--- a/tests/language/invalid_returns/async_invalid_return_20_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_20_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Object>`, no error.
 void Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_23_test.dart b/tests/language/invalid_returns/async_invalid_return_23_test.dart
index 3ddefdc..f496a74 100644
--- a/tests/language/invalid_returns/async_invalid_return_23_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_23_test.dart
@@ -25,18 +25,14 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void>`, no error.
 Object Function() test3 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
+// Inferred return type of function literal is `Future<void>`, no error.
 Object? Function() test4 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_24_test.dart b/tests/language/invalid_returns/async_invalid_return_24_test.dart
index 6a23787..1ccbca7 100644
--- a/tests/language/invalid_returns/async_invalid_return_24_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_24_test.dart
@@ -25,18 +25,14 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void?>`, no error.
 Object Function() test3 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
+// Inferred return type of function literal is `Future<void?>`, no error.
 Object? Function() test4 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_25_test.dart b/tests/language/invalid_returns/async_invalid_return_25_test.dart
index 3bc637d..5991e70 100644
--- a/tests/language/invalid_returns/async_invalid_return_25_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_25_test.dart
@@ -25,18 +25,14 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void>`, no error.
 Object Function() test3 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
+// Inferred return type of function literal is `Future<void>`, no error.
 Object? Function() test4 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_32_test.dart b/tests/language/invalid_returns/async_invalid_return_32_test.dart
index f6d337c..eaac876 100644
--- a/tests/language/invalid_returns/async_invalid_return_32_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_32_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void>`, no error.
 Future<Object?> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_33_test.dart b/tests/language/invalid_returns/async_invalid_return_33_test.dart
index cd77320..971b4aa 100644
--- a/tests/language/invalid_returns/async_invalid_return_33_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_33_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void>`, no error.
 Future<Object?> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_34_test.dart b/tests/language/invalid_returns/async_invalid_return_34_test.dart
index 25969da..5815421 100644
--- a/tests/language/invalid_returns/async_invalid_return_34_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_34_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void>`, no error.
 Future<Object?> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_35_test.dart b/tests/language/invalid_returns/async_invalid_return_35_test.dart
index 79e6995..b9ddf70 100644
--- a/tests/language/invalid_returns/async_invalid_return_35_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_35_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void>`, no error.
 FutureOr<Object?> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_36_test.dart b/tests/language/invalid_returns/async_invalid_return_36_test.dart
index 6ba0c69..7586e9a 100644
--- a/tests/language/invalid_returns/async_invalid_return_36_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_36_test.dart
@@ -32,11 +32,9 @@
   // [cfe] unspecified
 };
 
+// Inferred return type of function literal is `Future<void>`, no error.
 FutureOr<Object?> Function() test4 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_37_test.dart b/tests/language/invalid_returns/async_invalid_return_37_test.dart
index 4a89515..6b0496d 100644
--- a/tests/language/invalid_returns/async_invalid_return_37_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_37_test.dart
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<void>`, no error.
 FutureOr<Object?> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_41_test.dart b/tests/language/invalid_returns/async_invalid_return_41_test.dart
index 6191c70..d68b8ef 100644
--- a/tests/language/invalid_returns/async_invalid_return_41_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_41_test.dart
@@ -9,7 +9,7 @@
  * `flatten(S)` is not a subtype of `Tv`.
  */
 
-Future<Future<String>> v = Future.value(Future.value(''));
+Future<Future<String>> v = Future.value(Future<String>.value(''));
 
 Future<String> test1() async {
   return v;
diff --git a/tests/language/invalid_returns/async_invalid_return_45_test.dart b/tests/language/invalid_returns/async_invalid_return_45_test.dart
index 60b916a..bf75dc2 100644
--- a/tests/language/invalid_returns/async_invalid_return_45_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_45_test.dart
@@ -9,7 +9,7 @@
  * `flatten(S)` is not a subtype of `Tv`.
  */
 
-Future<Future<String>> v = Future.value(Future.value(''));
+Future<Future<String>> v = Future.value(Future<String>.value(''));
 
 FutureOr<String> test1() async {
   return v;
diff --git a/tests/language/invalid_returns/async_invalid_return_47_test.dart b/tests/language/invalid_returns/async_invalid_return_47_test.dart
index 156c737..e39b36c 100644
--- a/tests/language/invalid_returns/async_invalid_return_47_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_47_test.dart
@@ -18,7 +18,8 @@
   // [cfe] unspecified
 }
 
-Future<Nullf> Function() test2 = () async {
+// Inferred return type of function literal is `Future<Null>`.
+Future<Null> Function() test2 = () async {
   return v;
   //     ^
   // [analyzer] unspecified
diff --git a/tests/language/invalid_returns/async_invalid_return_48_test.dart b/tests/language/invalid_returns/async_invalid_return_48_test.dart
index 58e9013..d60f948 100644
--- a/tests/language/invalid_returns/async_invalid_return_48_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_48_test.dart
@@ -18,6 +18,7 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Null>`.
 Future<Null> Function() test2 = () async {
   return v;
   //     ^
diff --git a/tests/language/invalid_returns/async_invalid_return_50_test.dart b/tests/language/invalid_returns/async_invalid_return_50_test.dart
index ae29187..236f512 100644
--- a/tests/language/invalid_returns/async_invalid_return_50_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_50_test.dart
@@ -9,7 +9,7 @@
  * and `flatten(S)` is `void` or `void*`.
  */
 
-Future<void> v = Future.value(null);
+Future<void> v = Future.value("Hello");
 
 FutureOr<Null> test1() async {
   return v;
@@ -18,6 +18,7 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Null>`.
 FutureOr<Null> Function() test2 = () async {
   return v;
   //     ^
diff --git a/tests/language/invalid_returns/async_invalid_return_51_test.dart b/tests/language/invalid_returns/async_invalid_return_51_test.dart
index 819a989..3448c14 100644
--- a/tests/language/invalid_returns/async_invalid_return_51_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_51_test.dart
@@ -9,7 +9,7 @@
  * and `flatten(S)` is `void` or `void*`.
  */
 
-FutureOr<void> v = null;
+FutureOr<void> v = 42;
 
 FutureOr<Null> test1() async {
   return v;
@@ -18,6 +18,7 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Null>`.
 FutureOr<Null> Function() test2 = () async {
   return v;
   //     ^
diff --git a/tests/language/invalid_returns/async_invalid_return_52_test.dart b/tests/language/invalid_returns/async_invalid_return_52_test.dart
index a665932..8f086b2 100644
--- a/tests/language/invalid_returns/async_invalid_return_52_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_52_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 int v = 0;
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 Future<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_53_test.dart b/tests/language/invalid_returns/async_invalid_return_53_test.dart
index 23dcce8..d51ae11 100644
--- a/tests/language/invalid_returns/async_invalid_return_53_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_53_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 Object v = true;
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Object>`, no error.
 Future<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_54_test.dart b/tests/language/invalid_returns/async_invalid_return_54_test.dart
index 66a536f..4dd661a 100644
--- a/tests/language/invalid_returns/async_invalid_return_54_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_54_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 FutureOr<int> v = 0;
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 Future<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_55_test.dart b/tests/language/invalid_returns/async_invalid_return_55_test.dart
index eb29648..72f9440 100644
--- a/tests/language/invalid_returns/async_invalid_return_55_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_55_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 Future<int> v = Future.value(0);
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 Future<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_56_test.dart b/tests/language/invalid_returns/async_invalid_return_56_test.dart
index 66460f9..9443436 100644
--- a/tests/language/invalid_returns/async_invalid_return_56_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_56_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 int v = 0;
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 FutureOr<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_57_test.dart b/tests/language/invalid_returns/async_invalid_return_57_test.dart
index f0c9284..633be93 100644
--- a/tests/language/invalid_returns/async_invalid_return_57_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_57_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 Object v = true;
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<Object>`, no error.
 FutureOr<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_58_test.dart b/tests/language/invalid_returns/async_invalid_return_58_test.dart
index ea3599c..4d508eb 100644
--- a/tests/language/invalid_returns/async_invalid_return_58_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_58_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 FutureOr<int> v = 0;
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 FutureOr<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/async_invalid_return_59_test.dart b/tests/language/invalid_returns/async_invalid_return_59_test.dart
index b24a015..95399b9 100644
--- a/tests/language/invalid_returns/async_invalid_return_59_test.dart
+++ b/tests/language/invalid_returns/async_invalid_return_59_test.dart
@@ -5,8 +5,8 @@
 import 'dart:async';
 
 /* `return exp;` where `exp` has static type `S` is an error if the future
- * value type of the function is neither `void` nor `dynamic`,
- * and `flatten(S)` is `void` or `void*`.
+ * value type of the function is `void` and `flatten(S)` is not
+ * `void`, `dynamic`, `Null`, `void*`, `dynamic*`, or `Null*`.
  */
 
 Future<int> v = Future.value(0);
@@ -18,11 +18,9 @@
   // [cfe] unspecified
 }
 
+// Inferred return type of function literal is `Future<int>`, no error.
 FutureOr<void> Function() test2 = () async {
   return v;
-  //     ^
-  // [analyzer] unspecified
-  // [cfe] unspecified
 };
 
 void main() {
diff --git a/tests/language/invalid_returns/sync_invalid_return_27_test.dart b/tests/language/invalid_returns/sync_invalid_return_27_test.dart
index 5a04adb..0361ee2 100644
--- a/tests/language/invalid_returns/sync_invalid_return_27_test.dart
+++ b/tests/language/invalid_returns/sync_invalid_return_27_test.dart
@@ -8,7 +8,8 @@
  * and `T` is not `void` or `dynamic`.
  */
 
-void v = null;
+void v = 42;
+
 Null test() {
   return v;
   //     ^
diff --git a/tests/language/nnbd/constant_null_safety_mode_test.dart b/tests/language/nnbd/constant_null_safety_mode_test.dart
new file mode 100644
index 0000000..1383449
--- /dev/null
+++ b/tests/language/nnbd/constant_null_safety_mode_test.dart
@@ -0,0 +1,10 @@
+// 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:expect/expect.dart';
+
+main() {
+  const trueInWeakMode = <Null>[] is List<int>;
+  Expect.equals(isWeakMode, trueInWeakMode);
+}
diff --git a/tests/lib/js/parameters_test.dart b/tests/lib/js/parameters_test.dart
new file mode 100644
index 0000000..9123efe
--- /dev/null
+++ b/tests/lib/js/parameters_test.dart
@@ -0,0 +1,86 @@
+// 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.
+
+// Tests positional and optional arguments for various JS objects.
+
+@JS()
+library js_parameters_test;
+
+import 'package:js/js.dart';
+import 'package:expect/expect.dart';
+
+@JS()
+external void eval(String code);
+
+@JS()
+class Foo {
+  external factory Foo();
+  external singleArg(a);
+  external singlePositionalArg([dynamic? a]);
+  external mixedPositionalArgs(a, [dynamic? b]);
+}
+
+@JS()
+class Bar {
+  external static singleArg(a);
+  external static singlePositionalArg([dynamic? a]);
+  external static mixedPositionalArgs(a, [dynamic? b]);
+}
+
+external singleArg(a);
+external singlePositionalArg([dynamic? a]);
+external mixedPositionalArgs(a, [dynamic? b]);
+
+main() {
+  eval(r"""
+    function Foo() {}
+    Foo.prototype.singleArg = function(a) {
+      return a;
+    }
+    Foo.prototype.singlePositionalArg = singleArg;
+    Foo.prototype.mixedPositionalArgs = function(a, b) {
+      if (arguments.length == 0) return a;
+      return arguments[arguments.length - 1];
+    }
+
+    var Bar = {
+      singleArg: function(a) {
+        return a;
+      },
+      singlePositionalArg: singleArg,
+      mixedPositionalArgs: function(a, b) {
+        if (arguments.length == 0) return a;
+        return arguments[arguments.length - 1];
+      },
+    };
+
+    function singleArg(a) {
+      return a;
+    }
+    var singlePositionalArg = singleArg;
+    function mixedPositionalArgs(a, b) {
+      if (arguments.length == 0) return a;
+      return arguments[arguments.length - 1];
+    }
+  """);
+
+  var foo = Foo();
+  Expect.equals(foo.singleArg(2), 2);
+  Expect.equals(foo.singlePositionalArg(2), 2);
+  Expect.equals(foo.singlePositionalArg(), null);
+  Expect.equals(foo.mixedPositionalArgs(3), 3);
+  Expect.equals(foo.mixedPositionalArgs(3, 4), 4);
+
+  Expect.equals(Bar.singleArg(2), 2);
+  Expect.equals(Bar.singlePositionalArg(2), 2);
+  Expect.equals(Bar.singlePositionalArg(), null);
+  Expect.equals(Bar.mixedPositionalArgs(3), 3);
+  Expect.equals(Bar.mixedPositionalArgs(3, 4), 4);
+
+  Expect.equals(singleArg(2), 2);
+  Expect.equals(singlePositionalArg(2), 2);
+  Expect.equals(singlePositionalArg(), null);
+  Expect.equals(mixedPositionalArgs(3), 3);
+  Expect.equals(mixedPositionalArgs(3, 4), 4);
+}
diff --git a/tests/lib_2/js/parameters_test.dart b/tests/lib_2/js/parameters_test.dart
new file mode 100644
index 0000000..4a65a6b
--- /dev/null
+++ b/tests/lib_2/js/parameters_test.dart
@@ -0,0 +1,86 @@
+// 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.
+
+// Tests positional and optional arguments for various JS objects.
+
+@JS()
+library js_parameters_test;
+
+import 'package:js/js.dart';
+import 'package:expect/expect.dart';
+
+@JS()
+external void eval(String code);
+
+@JS()
+class Foo {
+  external factory Foo();
+  external singleArg(a);
+  external singlePositionalArg([dynamic a]);
+  external mixedPositionalArgs(a, [dynamic b]);
+}
+
+@JS()
+class Bar {
+  external static singleArg(a);
+  external static singlePositionalArg([dynamic a]);
+  external static mixedPositionalArgs(a, [dynamic b]);
+}
+
+external singleArg(a);
+external singlePositionalArg([dynamic a]);
+external mixedPositionalArgs(a, [dynamic b]);
+
+main() {
+  eval(r"""
+    function Foo() {}
+    Foo.prototype.singleArg = function(a) {
+      return a;
+    }
+    Foo.prototype.singlePositionalArg = singleArg;
+    Foo.prototype.mixedPositionalArgs = function(a, b) {
+      if (arguments.length == 0) return a;
+      return arguments[arguments.length - 1];
+    }
+
+    var Bar = {
+      singleArg: function(a) {
+        return a;
+      },
+      singlePositionalArg: singleArg,
+      mixedPositionalArgs: function(a, b) {
+        if (arguments.length == 0) return a;
+        return arguments[arguments.length - 1];
+      },
+    };
+
+    function singleArg(a) {
+      return a;
+    }
+    var singlePositionalArg = singleArg;
+    function mixedPositionalArgs(a, b) {
+      if (arguments.length == 0) return a;
+      return arguments[arguments.length - 1];
+    }
+  """);
+
+  var foo = Foo();
+  Expect.equals(foo.singleArg(2), 2);
+  Expect.equals(foo.singlePositionalArg(2), 2);
+  Expect.equals(foo.singlePositionalArg(), null);
+  Expect.equals(foo.mixedPositionalArgs(3), 3);
+  Expect.equals(foo.mixedPositionalArgs(3, 4), 4);
+
+  Expect.equals(Bar.singleArg(2), 2);
+  Expect.equals(Bar.singlePositionalArg(2), 2);
+  Expect.equals(Bar.singlePositionalArg(), null);
+  Expect.equals(Bar.mixedPositionalArgs(3), 3);
+  Expect.equals(Bar.mixedPositionalArgs(3, 4), 4);
+
+  Expect.equals(singleArg(2), 2);
+  Expect.equals(singlePositionalArg(2), 2);
+  Expect.equals(singlePositionalArg(), null);
+  Expect.equals(mixedPositionalArgs(3), 3);
+  Expect.equals(mixedPositionalArgs(3, 4), 4);
+}
diff --git a/tests/modular/extension_methods/modules.yaml b/tests/modular/extension_methods/modules.yaml
index f58c895..93a290b 100644
--- a/tests/modular/extension_methods/modules.yaml
+++ b/tests/modular/extension_methods/modules.yaml
@@ -4,6 +4,4 @@
 #
 dependencies:
   def2: [def]
-  main: [def2, expect]
-flags: 
-  - extension-methods
\ No newline at end of file
+  main: [def2, expect]
\ No newline at end of file
diff --git a/tools/VERSION b/tools/VERSION
index 996e1e0..9898fae 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -33,7 +33,7 @@
 MAJOR 2
 MINOR 9
 PATCH 0
-PRERELEASE 12
+PRERELEASE 13
 PRERELEASE_PATCH 0
 ABI_VERSION 34
 OLDEST_SUPPORTED_ABI_VERSION 34
diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py
index 2bfc0b9..94fe2ea 100755
--- a/tools/bots/dart_sdk.py
+++ b/tools/bots/dart_sdk.py
@@ -47,7 +47,8 @@
     with bot.BuildStep('Build API docs by dartdoc'):
         bot_utils.run([
             dart_exe, dartdoc_dart, '--sdk-docs', '--output', dirname,
-            '--footer', footer_file, '--rel-canonical-prefix=' + url
+            '--enable-experiment', 'non-nullable', '--footer', footer_file,
+            '--rel-canonical-prefix=' + url
         ])
 
 
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 6b762c2..a5a6b0b 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -11,7 +11,6 @@
       ".packages",
       ".dart_tool/package_config.json",
       "pkg/",
-      "tests/compiler/dart2js/",
       "third_party/pkg/",
       "third_party/pkg_tested/",
       "tools/",
@@ -1208,7 +1207,7 @@
           "name": "weak co19 tests",
           "arguments": [
             "-ncfe-weak-${system}",
-            "co19/LanguageFeatures/nnbd"
+            "co19"
           ]
         },
         {
@@ -1225,7 +1224,7 @@
           "name": "strong co19 tests",
           "arguments": [
             "-ncfe-strong-${system}",
-            "co19/LanguageFeatures/nnbd"
+            "co19"
           ]
         }
       ]
@@ -1442,6 +1441,24 @@
           ]
         },
         {
+          "name": "co19 nnbd tests in weak mode with asserts",
+          "arguments": [
+            "-ndartkp-weak-asserts-${system}-${mode}-${arch}",
+            "co19"
+          ],
+          "fileset": "vm-kernel",
+          "shards": 1
+        },
+        {
+          "name": "co19 nnbd tests in strong mode",
+          "arguments": [
+            "-ndartkp-strong-${system}-${mode}-${arch}",
+            "co19"
+          ],
+          "fileset": "vm-kernel",
+          "shards": 1
+        },
+        {
           "name": "vm nnbd tests in weak mode with asserts",
           "arguments": [
             "-ndartkp-weak-asserts-${system}-${mode}-${arch}",
@@ -1449,7 +1466,6 @@
             "ffi",
             "language",
             "lib",
-	    "co19/LanguageFeatures/nnbd",
             "standalone/io"
           ]
         },
@@ -1461,7 +1477,6 @@
             "ffi",
             "language",
             "lib",
-	    "co19/LanguageFeatures/nnbd",
             "standalone/io"
           ]
         }
@@ -1825,7 +1840,7 @@
             "ffi",
             "language",
             "lib",
-	    "co19/LanguageFeatures/nnbd",
+            "co19",
             "standalone/io"
           ]
         },
@@ -1837,7 +1852,7 @@
             "ffi",
             "language",
             "lib",
-	    "co19/LanguageFeatures/nnbd",
+            "co19",
             "standalone/io"
           ]
         }
@@ -2159,7 +2174,7 @@
           "name": "ddc nnbd weak co19 tests",
           "arguments": [
             "-ndartdevk-weak-linux-release-chrome",
-            "co19/LanguageFeatures/nnbd"
+            "co19"
           ],
           "shards": 2,
           "fileset": "dart2js_nnbd"
@@ -2178,7 +2193,7 @@
           "name": "ddc nnbd strong co19 tests",
           "arguments": [
             "-ndartdevk-strong-linux-release-chrome",
-            "co19/LanguageFeatures/nnbd"
+            "co19"
           ]
         }
       ]
@@ -2366,7 +2381,6 @@
           "name": "dart2js unit tests",
           "arguments": [
             "-nunittest-asserts-no-sdk-linux",
-            "dart2js",
             "pkg//compiler/"
           ]
         }
@@ -2755,7 +2769,7 @@
           "arguments": [
             "-ndart2js-hostasserts-strong-linux-x64-chrome",
             "--dart2js-batch",
-            "co19/LanguageFeatures/nnbd"
+            "co19"
           ],
           "shards": 6,
           "fileset": "dart2js_hostasserts_nnbd"
@@ -3108,14 +3122,14 @@
           "name": "analyze nnbd strong co19 tests",
           "arguments": [
             "-nanalyzer-asserts-strong-${system}",
-            "co19/LanguageFeatures/nnbd"
+            "co19"
           ]
         },
         {
           "name": "analyze nnbd weak co19 tests",
           "arguments": [
             "-nanalyzer-asserts-weak-${system}",
-            "co19/LanguageFeatures/nnbd"
+            "co19"
           ]
         }
       ]
@@ -3412,7 +3426,7 @@
           "name": "package unit tests",
           "arguments": [
             "-nunittest-asserts-${mode}-${system}",
-            "pkg/pkg/(?!(analyzer*|analysis_server|front_end|kernel|nnbd_migration)/)"
+            "pkg/pkg/(?!(analyzer*|analysis_server|compiler|front_end|kernel|nnbd_migration)/)"
           ]
         },
         {
@@ -3450,7 +3464,7 @@
           "name": "package unit tests",
           "arguments": [
             "-nunittest-asserts-${mode}-${system}",
-            "pkg/pkg/(?!(analyzer*|analysis_server|front_end|kernel|nnbd_migration)/)"
+            "pkg/pkg/(?!(analyzer*|analysis_server|compiler|front_end|kernel|nnbd_migration)/)"
           ]
         },
         {
diff --git a/tools/migration/bin/test.dart b/tools/migration/bin/test.dart
index d165634..9c7aba5 100644
--- a/tools/migration/bin/test.dart
+++ b/tools/migration/bin/test.dart
@@ -98,7 +98,7 @@
       "--mode=release",
       if (!isLegacy) ...[
         "--enable-experiment=non-nullable",
-        "--nnbd=strong",
+        "--nnbd=${isStrong ? 'strong' : 'weak'}",
       ],
       "--compiler=${compilerNames[compiler]}",
       testDir,
diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn
index bc553a8..060279d 100644
--- a/utils/compiler/BUILD.gn
+++ b/utils/compiler/BUILD.gn
@@ -47,15 +47,15 @@
 }
 
 if (dont_use_nnbd) {
-  libraries_specification_path = "sdk/lib/libraries.json"
+  sdk_root = "../../sdk"
 } else {
-  libraries_specification_path = "sdk_nnbd/lib/libraries.json"
+  sdk_root = "../../sdk_nnbd"
 }
 
 application_snapshot("dart2js") {
   deps = [
-    ":compile_dart2js_platform",
     ":compile_dart2js_nnbd_strong_platform",
+    ":compile_dart2js_platform",
     ":dart2js_create_snapshot_entry",
   ]
   inputs = [
@@ -68,7 +68,7 @@
   main_dart = "$target_gen_dir/dart2js.dart"
   training_args = [
     "--packages=" + rebase_path("../../.packages"),
-    "--libraries-spec=" + rebase_path("../../$libraries_specification_path"),
+    "--libraries-spec=" + rebase_path("$sdk_root/lib/libraries.json"),
 
     # Specifying the platform explicitly elides running the CFE on the sdk
     # sources.
@@ -79,9 +79,8 @@
 
 compile_platform("compile_dart2js_platform") {
   single_root_scheme = "org-dartlang-sdk"
-  single_root_base = rebase_path("../../")
-  libraries_specification_uri =
-      "org-dartlang-sdk:///$libraries_specification_path"
+  single_root_base = rebase_path("$sdk_root/")
+  libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
 
   outputs = [
     "$root_out_dir/dart2js_platform.dill",
@@ -100,9 +99,8 @@
 }
 compile_platform("compile_dart2js_nnbd_strong_platform") {
   single_root_scheme = "org-dartlang-sdk"
-  single_root_base = rebase_path("../../")
-  libraries_specification_uri =
-      "org-dartlang-sdk:///$libraries_specification_path"
+  single_root_base = rebase_path("$sdk_root/")
+  libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
 
   outputs = [
     "$root_out_dir/dart2js_nnbd_strong_platform.dill",
@@ -124,9 +122,8 @@
 }
 compile_platform("compile_dart2js_server_platform") {
   single_root_scheme = "org-dartlang-sdk"
-  single_root_base = rebase_path("../../")
-  libraries_specification_uri =
-      "org-dartlang-sdk:///$libraries_specification_path"
+  single_root_base = rebase_path("$sdk_root/")
+  libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
 
   outputs = [
     "$root_out_dir/dart2js_server_platform.dill",
@@ -145,9 +142,8 @@
 }
 compile_platform("compile_dart2js_server_nnbd_strong_platform") {
   single_root_scheme = "org-dartlang-sdk"
-  single_root_base = rebase_path("../../")
-  libraries_specification_uri =
-      "org-dartlang-sdk:///$libraries_specification_path"
+  single_root_base = rebase_path("$sdk_root/")
+  libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
 
   outputs = [
     "$root_out_dir/dart2js_server_nnbd_strong_platform.dill",
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index 219c48e..d1a1fb4 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -11,16 +11,10 @@
 patched_sdk_dir = "$target_gen_dir/patched_sdk"
 sdk_summary = "$target_gen_dir/ddc_sdk.sum"
 
-# TODO(sigmund): rename to ddc_outline.dill to be consistent with the naming
-# convention from other tools.
-sdk_outline_dill = "$root_out_dir/ddc_sdk.dill"
+sdk_outline_dill = "$root_out_dir/ddc_outline.dill"
 sdk_full_dill = "$root_out_dir/ddc_platform.dill"
-
-if (dont_use_nnbd) {
-  libraries_specification_path = "sdk/lib/libraries.json"
-} else {
-  libraries_specification_path = "sdk_nnbd/lib/libraries.json"
-}
+sdk_outline_sound_dill = "$root_out_dir/ddc_outline_sound.dill"
+sdk_full_sound_dill = "$root_out_dir/ddc_platform_sound.dill"
 
 application_snapshot("dartdevc") {
   main_dart = "../../pkg/dev_compiler/bin/dartdevc.dart"
@@ -47,10 +41,8 @@
 # TODO(#38701) Cleanup after merging the forked SDK into mainline.
 if (dont_use_nnbd) {
   sdk_root = "../../sdk"
-  libraries_specification_path = "sdk/lib/libraries.json"
 } else {
   sdk_root = "../../sdk_nnbd"
-  libraries_specification_path = "sdk_nnbd/lib/libraries.json"
 }
 
 sdk_lib_files = exec_script("../../tools/list_dart_files.py",
@@ -151,8 +143,13 @@
   deps = [
     ":dartdevc",
     ":dartdevc_kernel_sdk",
+    ":dartdevc_sound_sdk",
     ":dartdevc_test_kernel_pkg",
     "../..:create_sdk",
+
+    # TODO(nshahan) Temporarily here until we decide if we are going to include
+    # in the create_sdk target.
+    "../../sdk_nnbd:copy_dev_compiler_outline_sound",
   ]
 }
 
@@ -182,15 +179,31 @@
 group("dartdevc_test_kernel_pkg") {
   deps = [
     ":async_helper_js",
+    ":async_helper_sound_js",
     ":expect_js",
+    ":expect_sound_js",
     ":js_js",
+    ":js_sound_js",
     ":meta_js",
+    ":meta_sound_js",
   ]
 }
 
 template("dartdevc_kernel_compile") {
   assert(defined(invoker.package),
          "Need 'package' in $target_name (the name of the package)")
+  assert(defined(invoker.sound_null_safety),
+         "Need 'sound_null_safety' in $target_name.")
+
+  if (invoker.sound_null_safety) {
+    platform_dep = ":dartdevc_platform_sound"
+    sdk_outline = sdk_outline_sound_dill
+    js_gen_dir = "$target_gen_dir/pkg_sound"
+  } else {
+    platform_dep = ":dartdevc_platform"
+    sdk_outline = sdk_outline_dill
+    js_gen_dir = "$target_gen_dir/pkg_kernel"
+  }
 
   # Other optional invoker parameters:
   #   * extra_libraries: entrypoints to include in the module as
@@ -204,12 +217,12 @@
   prebuilt_dart_action(target_name) {
     script = "../../pkg/dev_compiler/bin/dartdevc.dart"
     module = invoker.package
-    outdir = rebase_path("$target_gen_dir")
-    sdk_path = rebase_path(sdk_outline_dill)
+    out_dir = rebase_path("$js_gen_dir")
+    sdk_path = rebase_path(sdk_outline)
 
     deps = [
       ":dartdevc_files_stamp",
-      ":dartdevc_platform",
+      platform_dep,
 
       # TODO(sigmund): depend only on the compiler and the actual files in the
       # package
@@ -217,20 +230,20 @@
     ]
 
     inputs = [
-      sdk_outline_dill,
+      sdk_outline,
       "$target_gen_dir/dartdevc_files.stamp",
       "$root_gen_dir/pkg_files.stamp",
     ]
 
     outputs = [
-      "$target_gen_dir/pkg_kernel/$module.dill",
-      "$target_gen_dir/pkg_kernel/$module.js",
+      "$js_gen_dir/$module.dill",
+      "$js_gen_dir/$module.js",
     ]
 
     args = [
       "-k",
       "--dart-sdk-summary=$sdk_path",
-      "-o$outdir/pkg_kernel/$module.js",
+      "-o$out_dir/$module.js",
       "package:$module/$module.dart",
     ]
 
@@ -243,7 +256,7 @@
     if (defined(invoker.package_dependencies)) {
       foreach(dep, invoker.package_dependencies) {
         deps += [ ":${dep}_js" ]
-        args += [ "-s$outdir/pkg_kernel/$dep.dill" ]
+        args += [ "-s$out_dir/$dep.dill" ]
       }
     }
 
@@ -251,106 +264,189 @@
       args += invoker.args
     }
 
-    # TODO(38701): Cleanup after merging the forked SDK into mainline.
-    if (!dont_use_nnbd) {
+    # TODO(38701): Cleanup don't_use_nnbd clause after merging the forked SDK
+    # into mainline.
+    if (invoker.sound_null_safety || !dont_use_nnbd) {
       args += [ "--enable-experiment=non-nullable" ]
     }
+
+    if (invoker.sound_null_safety) {
+      args += [ "--sound-null-safety" ]
+    }
   }
 }
 
 dartdevc_kernel_compile("async_helper_js") {
   package = "async_helper"
+  sound_null_safety = false
+}
+
+dartdevc_kernel_compile("async_helper_sound_js") {
+  package = "async_helper"
+  sound_null_safety = true
 }
 
 dartdevc_kernel_compile("expect_js") {
   package = "expect"
   extra_libraries = [ "minitest" ]
+  sound_null_safety = false
+}
+
+dartdevc_kernel_compile("expect_sound_js") {
+  package = "expect"
+  extra_libraries = [ "minitest" ]
+  sound_null_safety = true
 }
 
 dartdevc_kernel_compile("js_js") {
   package = "js"
   extra_libraries = [ "js_util" ]
+  sound_null_safety = false
+}
+
+dartdevc_kernel_compile("js_sound_js") {
+  package = "js"
+  extra_libraries = [ "js_util" ]
+  sound_null_safety = true
 }
 
 dartdevc_kernel_compile("meta_js") {
   package = "meta"
+  sound_null_safety = false
 }
 
-compile_platform("dartdevc_platform") {
-  single_root_scheme = "org-dartlang-sdk"
-  single_root_base = rebase_path("../../")
-  libraries_specification_uri =
-      "org-dartlang-sdk:///$libraries_specification_path"
+dartdevc_kernel_compile("meta_sound_js") {
+  package = "meta"
+  sound_null_safety = true
+}
 
-  outputs = [
-    sdk_full_dill,
-    sdk_outline_dill,
-  ]
+template("compile_dartdevc_platform") {
+  assert(defined(invoker.sound_null_safety),
+         "Need 'sound_null_safety' in $target_name.")
 
-  args = [
-    "--target=dartdevc",
-    "dart:core",
-  ]
+  compile_platform(target_name) {
+    single_root_scheme = "org-dartlang-sdk"
+    single_root_base = rebase_path("$sdk_root/")
+    libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
 
-  # TODO(38701): Cleanup after merging the forked SDK into mainline.
-  if (!dont_use_nnbd) {
-    args += [ "--enable-experiment=non-nullable" ]
+    args = [
+      "--target=dartdevc",
+      "dart:core",
+    ]
+
+    if (invoker.sound_null_safety) {
+      args += [
+        "--enable-experiment=non-nullable",
+        "--nnbd-strong",
+      ]
+
+      outputs = [
+        sdk_full_sound_dill,
+        sdk_outline_sound_dill,
+      ]
+    } else {
+      # TODO(38701): Cleanup after merging the forked SDK into mainline.
+      if (!dont_use_nnbd) {
+        args += [ "--enable-experiment=non-nullable" ]
+      }
+
+      outputs = [
+        sdk_full_dill,
+        sdk_outline_dill,
+      ]
+    }
   }
 }
 
-# Compiles the DDC SDK's kernel summary and JS code.
-prebuilt_dart_action("dartdevc_kernel_sdk") {
-  deps = [
-    ":dartdevc_files_stamp",
-    ":dartdevc_platform",
-    "../../pkg:pkg_files_stamp",
-  ]
+compile_dartdevc_platform("dartdevc_platform") {
+  sound_null_safety = false
+}
 
-  inputs = [
-    "$target_gen_dir/dartdevc_files.stamp",
-    "$root_gen_dir/pkg_files.stamp",
-    sdk_full_dill,
-  ]
+compile_dartdevc_platform("dartdevc_platform_sound") {
+  sound_null_safety = true
+}
 
-  outputs = [
-    "$target_gen_dir/kernel/amd/dart_sdk.js",
-    "$target_gen_dir/kernel/amd/dart_sdk.js.map",
-    "$target_gen_dir/kernel/common/dart_sdk.js",
-    "$target_gen_dir/kernel/common/dart_sdk.js.map",
-    "$target_gen_dir/kernel/es6/dart_sdk.js",
-    "$target_gen_dir/kernel/es6/dart_sdk.js.map",
-    "$target_gen_dir/kernel/legacy/dart_sdk.js",
-    "$target_gen_dir/kernel/legacy/dart_sdk.js.map",
-  ]
+# Compiles the DDC SDK's JS code from the platform .dill.
+template("dartdevc_sdk_js") {
+  assert(defined(invoker.sound_null_safety),
+         "Need 'sound_null_safety' in $target_name.")
 
-  script = "../../pkg/dev_compiler/tool/compile_dartdevc_sdk.dart"
-
-  args = [
-    "--multi-root-scheme",
-    "org-dartlang-sdk",
-    "--multi-root-output-path",
-    rebase_path("$target_gen_dir/../../../"),
-    "--modules",
-    "amd",
-    "-o",
-    rebase_path("$target_gen_dir/kernel/amd/dart_sdk.js"),
-    "--modules",
-    "common",
-    "-o",
-    rebase_path("$target_gen_dir/kernel/common/dart_sdk.js"),
-    "--modules",
-    "es6",
-    "-o",
-    rebase_path("$target_gen_dir/kernel/es6/dart_sdk.js"),
-    "--modules",
-    "legacy",
-    "-o",
-    rebase_path("$target_gen_dir/kernel/legacy/dart_sdk.js"),
-    rebase_path("$sdk_full_dill"),
-  ]
-
-  # TODO(38701): Cleanup after merging the forked SDK into mainline.
-  if (!dont_use_nnbd) {
-    args += [ "--enable-experiment=non-nullable" ]
+  if (invoker.sound_null_safety) {
+    platform_dep = ":dartdevc_platform_sound"
+    platform_input = sdk_full_sound_dill
+    js_gen_dir = "$target_gen_dir/sound"
+  } else {
+    platform_dep = ":dartdevc_platform"
+    platform_input = sdk_full_dill
+    js_gen_dir = "$target_gen_dir/kernel"
   }
+
+  prebuilt_dart_action(target_name) {
+    deps = [
+      ":dartdevc_files_stamp",
+      "../../pkg:pkg_files_stamp",
+      platform_dep,
+    ]
+
+    inputs = [
+      "$target_gen_dir/dartdevc_files.stamp",
+      "$root_gen_dir/pkg_files.stamp",
+      platform_input,
+    ]
+
+    outputs = [
+      "$js_gen_dir/amd/dart_sdk.js",
+      "$js_gen_dir/amd/dart_sdk.js.map",
+      "$js_gen_dir/common/dart_sdk.js",
+      "$js_gen_dir/common/dart_sdk.js.map",
+      "$js_gen_dir/es6/dart_sdk.js",
+      "$js_gen_dir/es6/dart_sdk.js.map",
+      "$js_gen_dir/legacy/dart_sdk.js",
+      "$js_gen_dir/legacy/dart_sdk.js.map",
+    ]
+
+    script = "../../pkg/dev_compiler/tool/compile_dartdevc_sdk.dart"
+
+    args = [
+      "--multi-root-scheme",
+      "org-dartlang-sdk",
+      "--multi-root-output-path",
+      rebase_path("$target_gen_dir/../../"),
+      "--modules",
+      "amd",
+      "-o",
+      rebase_path("$js_gen_dir/amd/dart_sdk.js"),
+      "--modules",
+      "common",
+      "-o",
+      rebase_path("$js_gen_dir/common/dart_sdk.js"),
+      "--modules",
+      "es6",
+      "-o",
+      rebase_path("$js_gen_dir/es6/dart_sdk.js"),
+      "--modules",
+      "legacy",
+      "-o",
+      rebase_path("$js_gen_dir/legacy/dart_sdk.js"),
+      rebase_path("$platform_input"),
+    ]
+
+    # TODO(38701): Cleanup don't_use_nnbd clause after merging the forked SDK
+    # into mainline.
+    if (invoker.sound_null_safety || !dont_use_nnbd) {
+      args += [ "--enable-experiment=non-nullable" ]
+    }
+
+    if (invoker.sound_null_safety) {
+      args += [ "--sound-null-safety" ]
+    }
+  }
+}
+
+dartdevc_sdk_js("dartdevc_kernel_sdk") {
+  sound_null_safety = false
+}
+
+dartdevc_sdk_js("dartdevc_sound_sdk") {
+  sound_null_safety = true
 }