Version 2.18.0-286.0.dev

Merge commit 'fd01012db95111e4b8cf04398b8da8ebc3e7224b' into 'dev'
diff --git a/DEPS b/DEPS
index 22284e5..a8ed953 100644
--- a/DEPS
+++ b/DEPS
@@ -43,7 +43,7 @@
 
   # co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
   # hashes.
-  "co19_rev": "9849573cd1b8317e58247b8c1672e89b1cd842e2",
+  "co19_rev": "5e94d0db25a8d8dfb6b1320bdb342e2935faf1d0",
   # This line prevents conflicts when both packages are rolled simultaneously.
   "co19_2_rev": "b2034a17609472e374623f3dbe0efd9f5cb258af",
 
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index c0848ae..2487b88 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -1178,11 +1178,25 @@
 
     if (!context
         .options.globalFeatures.alternativeInvalidationStrategy.isEnabled) {
+      recorderForTesting?.recordAdvancedInvalidationResult(
+          AdvancedInvalidationResult.disabled);
       return null;
     }
-    if (_modulesToLoad != null) return null;
-    if (reusedResult.directlyInvalidated.isEmpty) return null;
-    if (reusedResult.invalidatedBecauseOfPackageUpdate) return null;
+    if (_modulesToLoad != null) {
+      recorderForTesting?.recordAdvancedInvalidationResult(
+          AdvancedInvalidationResult.modulesToLoad);
+      return null;
+    }
+    if (reusedResult.directlyInvalidated.isEmpty) {
+      recorderForTesting?.recordAdvancedInvalidationResult(
+          AdvancedInvalidationResult.noDirectlyInvalidated);
+      return null;
+    }
+    if (reusedResult.invalidatedBecauseOfPackageUpdate) {
+      recorderForTesting?.recordAdvancedInvalidationResult(
+          AdvancedInvalidationResult.packageUpdate);
+      return null;
+    }
 
     if (enableMacros) {
       /// TODO(johnniwinther): Add a [hasMacro] property to [LibraryBuilder].
@@ -1193,6 +1207,8 @@
           if (childBuilder is ClassBuilder && childBuilder.isMacro) {
             // Changes to a library with macro classes can affect any class that
             // depends on it.
+            recorderForTesting?.recordAdvancedInvalidationResult(
+                AdvancedInvalidationResult.macroChange);
             return null;
           }
         }
@@ -1204,12 +1220,17 @@
     for (LibraryBuilder builder in reusedResult.directlyInvalidated) {
       if (builder.library.problemsAsJson != null) {
         assert(builder.library.problemsAsJson!.isNotEmpty);
+        recorderForTesting?.recordAdvancedInvalidationResult(
+            AdvancedInvalidationResult.problemsInLibrary);
         return null;
       }
       Iterator<Builder> iterator = builder.iterator;
       while (iterator.moveNext()) {
         Builder childBuilder = iterator.current;
         if (childBuilder.isDuplicate) {
+          // TODO(johnniwinther): Doesn't this imply [problemsInLibrary]?
+          recorderForTesting?.recordAdvancedInvalidationResult(
+              AdvancedInvalidationResult.duplicateInLibrary);
           return null;
         }
       }
@@ -1226,6 +1247,8 @@
             CompilerContext.current.uriToSource[uri]!.source;
         // ignore: unnecessary_null_comparison
         if (previousSource == null || previousSource.isEmpty) {
+          recorderForTesting?.recordAdvancedInvalidationResult(
+              AdvancedInvalidationResult.noPreviousSource);
           return null;
         }
         ScannerConfiguration scannerConfiguration = new ScannerConfiguration(
@@ -1239,6 +1262,8 @@
         String? before = textualOutline(previousSource, scannerConfiguration,
             performModelling: true);
         if (before == null) {
+          recorderForTesting?.recordAdvancedInvalidationResult(
+              AdvancedInvalidationResult.noPreviousOutline);
           return null;
         }
         String? now;
@@ -1248,6 +1273,8 @@
               performModelling: true);
         }
         if (before != now) {
+          recorderForTesting?.recordAdvancedInvalidationResult(
+              AdvancedInvalidationResult.outlineChange);
           return null;
         }
         missingSources ??= new Set<Uri>();
@@ -1285,6 +1312,8 @@
               // to rebuild only the body of.
               // TODO(jensj): We can probably add this to the rebuildBodies
               // list and just rebuild that library too.
+              recorderForTesting?.recordAdvancedInvalidationResult(
+                  AdvancedInvalidationResult.mixin);
               return null;
             }
           }
@@ -1306,6 +1335,8 @@
             Library importLibrary = dependency.targetLibrary;
             if (importLibrary.importUri == dartFfiUri) {
               // Explicitly imports dart:ffi.
+              recorderForTesting?.recordAdvancedInvalidationResult(
+                  AdvancedInvalidationResult.importsFfi);
               return null;
             }
             for (Reference exportReference in importLibrary.additionalExports) {
@@ -1314,6 +1345,8 @@
                 Class c = export;
                 if (c.enclosingLibrary.importUri == dartFfiUri) {
                   // Implicitly imports a dart:ffi class.
+                  recorderForTesting?.recordAdvancedInvalidationResult(
+                      AdvancedInvalidationResult.importsFfiClass);
                   return null;
                 }
               }
@@ -1341,6 +1374,8 @@
       CompilerContext.current.uriToSource.remove(fileUri);
     }
 
+    recorderForTesting?.recordAdvancedInvalidationResult(
+        AdvancedInvalidationResult.bodiesOnly);
     return new ExperimentalInvalidation(
         rebuildBodies, originalNotReusedLibraries, missingSources);
   }
@@ -2796,9 +2831,61 @@
   }
 }
 
+/// Result of advanced invalidation used for testing.
+enum AdvancedInvalidationResult {
+  /// Advanced invalidation is disabled.
+  disabled,
+
+  /// Requested to load modules, advanced invalidation is not supported.
+  modulesToLoad,
+
+  /// Nothing directly invalidated, no need for advanced invalidation.
+  noDirectlyInvalidated,
+
+  /// Package config has been updated, advanced invalidation is not supported.
+  packageUpdate,
+
+  /// Change to (dependency of) macro library, advanced invalidation is not
+  /// supported.
+  macroChange,
+
+  /// Problems in invalidated library, advanced invalidation is not supported.
+  problemsInLibrary,
+
+  /// Duplicate declaration in invalidated library, advanced invalidation is not
+  /// supported.
+  duplicateInLibrary,
+
+  /// No previous source for invalidated library, can't compare to new source.
+  noPreviousSource,
+
+  /// No textual outline computed for previous source, can't compare to new
+  /// source.
+  noPreviousOutline,
+
+  /// Textual outline has changed.
+  outlineChange,
+
+  /// Invalidated library contains class/mixin declaration used as mixin.
+  mixin,
+
+  /// Invalidated library imports 'dart:ffi'.
+  importsFfi,
+
+  /// Invalidated library imports library that exports class(es) from
+  /// 'dart:ffi'.
+  importsFfiClass,
+
+  /// Only bodies need to be rebuilt. This mean that advanced invalidation
+  /// succeeded.
+  bodiesOnly,
+}
+
 class RecorderForTesting {
   const RecorderForTesting();
 
+  void recordAdvancedInvalidationResult(AdvancedInvalidationResult result) {}
+
   void recordNonFullComponent(Component component) {}
 
   void recordInvalidatedImportUris(List<Uri> uris) {}
diff --git a/pkg/front_end/test/incremental_suite.dart b/pkg/front_end/test/incremental_suite.dart
index 126272d..3481e23 100644
--- a/pkg/front_end/test/incremental_suite.dart
+++ b/pkg/front_end/test/incremental_suite.dart
@@ -45,7 +45,7 @@
     show DiagnosticMessageFromJson, FormattedMessage;
 
 import 'package:front_end/src/fasta/incremental_compiler.dart'
-    show IncrementalCompiler, RecorderForTesting;
+    show AdvancedInvalidationResult, IncrementalCompiler, RecorderForTesting;
 
 import 'package:front_end/src/fasta/incremental_serializer.dart'
     show IncrementalSerializer;
@@ -110,6 +110,11 @@
 final ExpectationSet staticExpectationSet =
     new ExpectationSet.fromJsonList(jsonDecode(EXPECTATIONS));
 
+class Flags {
+  /// The expected result of the advanced invalidation.
+  static const String advancedInvalidation = 'advancedInvalidation';
+}
+
 const String EXPECTATIONS = '''
 [
   {
@@ -181,7 +186,7 @@
     "group": "Fail"
   },
   {
-    "name": "UnexpectedRebuildBodiesOnly",
+    "name": "UnexpectedAdvancedInvalidation",
     "group": "Fail"
   },
   {
@@ -232,8 +237,8 @@
     staticExpectationSet["MissingPlatformLibraries"];
 final Expectation UnexpectedPlatformLibraries =
     staticExpectationSet["UnexpectedPlatformLibraries"];
-final Expectation UnexpectedRebuildBodiesOnly =
-    staticExpectationSet["UnexpectedRebuildBodiesOnly"];
+final Expectation UnexpectedAdvancedInvalidation =
+    staticExpectationSet["UnexpectedAdvancedInvalidation"];
 final Expectation UnexpectedEntryToLibraryCount =
     staticExpectationSet["UnexpectedEntryToLibraryCount"];
 final Expectation LibraryCountMismatch =
@@ -1007,16 +1012,18 @@
         }
       }
 
-      if (world["expectsRebuildBodiesOnly"] != null) {
-        bool didRebuildBodiesOnly =
-            compiler.recorderForTesting.rebuildBodiesCount! > 0;
-        if (world["expectsRebuildBodiesOnly"] != didRebuildBodiesOnly) {
+      String? expectedAdvancedInvalidation = world[Flags.advancedInvalidation];
+      if (expectedAdvancedInvalidation != null) {
+        AdvancedInvalidationResult? actualAdvancedInvalidation =
+            compiler.recorderForTesting.advancedInvalidationResult;
+        if (expectedAdvancedInvalidation != actualAdvancedInvalidation?.name) {
           return new Result<TestData>(
               data,
-              UnexpectedRebuildBodiesOnly,
-              "Expected didRebuildBodiesOnly="
-              "${world["expectsRebuildBodiesOnly"]}, "
-              "didRebuildBodiesOnly=${didRebuildBodiesOnly}.");
+              UnexpectedAdvancedInvalidation,
+              "Expected ${Flags.advancedInvalidation}: "
+              "$expectedAdvancedInvalidation, "
+              "${Flags.advancedInvalidation}: "
+              "${actualAdvancedInvalidation?.name}.");
         }
       }
 
@@ -2147,6 +2154,7 @@
 
 class TestRecorderForTesting extends RecorderForTesting {
   Set<Uri>? invalidatedImportUrisForTesting;
+  AdvancedInvalidationResult? advancedInvalidationResult;
   int? rebuildBodiesCount;
 
   @override
@@ -2168,6 +2176,16 @@
   @override
   void recordRebuildBodiesCount(int count) {
     rebuildBodiesCount = count;
+    assert(
+        count == 0 ||
+            advancedInvalidationResult == AdvancedInvalidationResult.bodiesOnly,
+        "Unexpected successful advanced invalidation: "
+        "${advancedInvalidationResult}");
+  }
+
+  @override
+  void recordAdvancedInvalidationResult(AdvancedInvalidationResult result) {
+    advancedInvalidationResult = result;
   }
 
   @override
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index 0e95948..48d0dcd 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -1055,6 +1055,7 @@
 rebind
 rebuild
 rebuilds
+rebuilt
 recalculating
 recalculation
 recall
diff --git a/pkg/front_end/testcases/incremental/change_main.yaml b/pkg/front_end/testcases/incremental/change_main.yaml
index e7167fa..ccc0dbf 100644
--- a/pkg/front_end/testcases/incremental/change_main.yaml
+++ b/pkg/front_end/testcases/incremental/change_main.yaml
@@ -56,4 +56,4 @@
           print('method2');
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/change_main2.yaml b/pkg/front_end/testcases/incremental/change_main2.yaml
index 1ceabb1..1a052ee 100644
--- a/pkg/front_end/testcases/incremental/change_main2.yaml
+++ b/pkg/front_end/testcases/incremental/change_main2.yaml
@@ -42,4 +42,4 @@
           print('method2');
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/constructor_change.yaml b/pkg/front_end/testcases/incremental/constructor_change.yaml
index 58e4c05..08eb555 100644
--- a/pkg/front_end/testcases/incremental/constructor_change.yaml
+++ b/pkg/front_end/testcases/incremental/constructor_change.yaml
@@ -57,7 +57,7 @@
           }
         }
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -76,4 +76,4 @@
           print("Done!");
         }
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/crash_05.yaml b/pkg/front_end/testcases/incremental/crash_05.yaml
index 2af2d9b..609fa82 100644
--- a/pkg/front_end/testcases/incremental/crash_05.yaml
+++ b/pkg/front_end/testcases/incremental/crash_05.yaml
@@ -28,4 +28,4 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: disabled
diff --git a/pkg/front_end/testcases/incremental/crash_06.yaml b/pkg/front_end/testcases/incremental/crash_06.yaml
index fa5751e..6a7fdea 100644
--- a/pkg/front_end/testcases/incremental/crash_06.yaml
+++ b/pkg/front_end/testcases/incremental/crash_06.yaml
@@ -26,5 +26,5 @@
     invalidate:
       - structs.dart
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: disabled
 
diff --git a/pkg/front_end/testcases/incremental/dart2js_late.yaml b/pkg/front_end/testcases/incremental/dart2js_late.yaml
index 9473131..8ee5644 100644
--- a/pkg/front_end/testcases/incremental/dart2js_late.yaml
+++ b/pkg/front_end/testcases/incremental/dart2js_late.yaml
@@ -27,5 +27,5 @@
     invalidate:
       - late_statics.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: disabled
 
diff --git a/pkg/front_end/testcases/incremental/external_extension_field.yaml b/pkg/front_end/testcases/incremental/external_extension_field.yaml
index 27097d3..6de5b2e 100644
--- a/pkg/front_end/testcases/incremental/external_extension_field.yaml
+++ b/pkg/front_end/testcases/incremental/external_extension_field.yaml
@@ -30,4 +30,4 @@
           "foo".field = "bar".field;
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/import_package_by_file_uri.yaml b/pkg/front_end/testcases/incremental/import_package_by_file_uri.yaml
index 74104cc..dc685d0 100644
--- a/pkg/front_end/testcases/incremental/import_package_by_file_uri.yaml
+++ b/pkg/front_end/testcases/incremental/import_package_by_file_uri.yaml
@@ -36,5 +36,5 @@
     invalidate:
       - foo/main.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
     checkInvalidatedFiles: false
diff --git a/pkg/front_end/testcases/incremental/issue_44523.yaml b/pkg/front_end/testcases/incremental/issue_44523.yaml
index 63f5ae4..8e8f342 100644
--- a/pkg/front_end/testcases/incremental/issue_44523.yaml
+++ b/pkg/front_end/testcases/incremental/issue_44523.yaml
@@ -41,4 +41,4 @@
     invalidate:
       - app/main.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/issue_46666.yaml b/pkg/front_end/testcases/incremental/issue_46666.yaml
index 794df0d..9365b13 100644
--- a/pkg/front_end/testcases/incremental/issue_46666.yaml
+++ b/pkg/front_end/testcases/incremental/issue_46666.yaml
@@ -49,4 +49,4 @@
     invalidate:
       - b.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: disabled
diff --git a/pkg/front_end/testcases/incremental/mixin_application_declares.yaml b/pkg/front_end/testcases/incremental/mixin_application_declares.yaml
index 81b1aa1..a7ec07e 100644
--- a/pkg/front_end/testcases/incremental/mixin_application_declares.yaml
+++ b/pkg/front_end/testcases/incremental/mixin_application_declares.yaml
@@ -46,7 +46,7 @@
           method();
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -61,4 +61,4 @@
           method();
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_1.yaml b/pkg/front_end/testcases/incremental/no_outline_change_1.yaml
index 563d16c..88dfee7 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_1.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_1.yaml
@@ -52,4 +52,4 @@
         }
         mainHello() {}
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_10.yaml b/pkg/front_end/testcases/incremental/no_outline_change_10.yaml
index 10f6a6e..b1cfc06 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_10.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_10.yaml
@@ -55,7 +55,7 @@
           }
         }
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -73,4 +73,4 @@
           print("Done!");
         }
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_11.yaml b/pkg/front_end/testcases/incremental/no_outline_change_11.yaml
index e06e7d3..2e7b955 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_11.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_11.yaml
@@ -48,4 +48,4 @@
           print(foo == bar);
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_12.yaml b/pkg/front_end/testcases/incremental/no_outline_change_12.yaml
index 24ee095..24e1f7e 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_12.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_12.yaml
@@ -45,7 +45,7 @@
           }
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -60,7 +60,7 @@
           }
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -76,4 +76,4 @@
           print(bar);
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_13.yaml b/pkg/front_end/testcases/incremental/no_outline_change_13.yaml
index 10b1083..55b3a98 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_13.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_13.yaml
@@ -39,4 +39,4 @@
           print(prefix.Foo.BAR);
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_14.yaml b/pkg/front_end/testcases/incremental/no_outline_change_14.yaml
index a33699a..1c695e0 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_14.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_14.yaml
@@ -37,7 +37,7 @@
           Baz get x;
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -52,4 +52,4 @@
           Foo get x;
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_15.yaml b/pkg/front_end/testcases/incremental/no_outline_change_15.yaml
index 1ec3e65..8948d02 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_15.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_15.yaml
@@ -43,4 +43,4 @@
           print("#2");
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_16.yaml b/pkg/front_end/testcases/incremental/no_outline_change_16.yaml
index 8bd1eb7..53c4f20 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_16.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_16.yaml
@@ -50,4 +50,4 @@
           }
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_17.yaml b/pkg/front_end/testcases/incremental/no_outline_change_17.yaml
index c2fe2c1..c5cc57a 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_17.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_17.yaml
@@ -36,4 +36,4 @@
           print("Done");
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_18.yaml b/pkg/front_end/testcases/incremental/no_outline_change_18.yaml
index dd099b7..cc90496 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_18.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_18.yaml
@@ -41,4 +41,4 @@
           print("exports!")
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: false # For now, libraries with errors cannot have bodies rebuild.
+    advancedInvalidation: problemsInLibrary # For now, libraries with errors cannot have bodies rebuild.
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_19.yaml b/pkg/front_end/testcases/incremental/no_outline_change_19.yaml
index d184850..c6af9ec 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_19.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_19.yaml
@@ -53,4 +53,4 @@
           static final int staticFinalField = 42;
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_2.yaml b/pkg/front_end/testcases/incremental/no_outline_change_2.yaml
index 861576b..04062c7 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_2.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_2.yaml
@@ -59,4 +59,4 @@
 
         enum CompilationStrategy { direct, toKernel, toData, fromData }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_20.yaml b/pkg/front_end/testcases/incremental/no_outline_change_20.yaml
index 7d41b57..c781578 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_20.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_20.yaml
@@ -49,4 +49,4 @@
           static void set setter2(String s) {}
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_21.yaml b/pkg/front_end/testcases/incremental/no_outline_change_21.yaml
index 23a30cf..b38d1a4 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_21.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_21.yaml
@@ -40,4 +40,4 @@
           A1.foo2(){}
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: problemsInLibrary
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_22.yaml b/pkg/front_end/testcases/incremental/no_outline_change_22.yaml
index 244a23c..6013e2f 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_22.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_22.yaml
@@ -33,4 +33,4 @@
           void operator []=(int index, int value) => null;
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_23.yaml b/pkg/front_end/testcases/incremental/no_outline_change_23.yaml
index 30b121e..8c30598 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_23.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_23.yaml
@@ -33,4 +33,4 @@
           bar() {}
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_24.yaml b/pkg/front_end/testcases/incremental/no_outline_change_24.yaml
index a68ba95..bc1bbcd 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_24.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_24.yaml
@@ -28,4 +28,4 @@
         void foo() {}
         void foo() {}
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: problemsInLibrary
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_25.yaml b/pkg/front_end/testcases/incremental/no_outline_change_25.yaml
index e364005..4219b2b 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_25.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_25.yaml
@@ -48,4 +48,4 @@
           }
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: false # For now, libraries with errors cannot have bodies rebuild.
+    advancedInvalidation: problemsInLibrary # For now, libraries with errors cannot have bodies rebuild.
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_26.yaml b/pkg/front_end/testcases/incremental/no_outline_change_26.yaml
index 6fe95fa..aab433f 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_26.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_26.yaml
@@ -40,4 +40,4 @@
           new A1.foo();
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: false # For now, libraries with errors cannot have bodies rebuild.
+    advancedInvalidation: problemsInLibrary # For now, libraries with errors cannot have bodies rebuild.
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_27.yaml b/pkg/front_end/testcases/incremental/no_outline_change_27.yaml
index 2b679d0..110f645 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_27.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_27.yaml
@@ -46,7 +46,7 @@
           print("Done!");
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     warnings: false
     experiments: alternative-invalidation-strategy
@@ -60,4 +60,4 @@
           print("Hello from lib!!");
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_28.yaml b/pkg/front_end/testcases/incremental/no_outline_change_28.yaml
index 091f7c5..5100969 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_28.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_28.yaml
@@ -85,4 +85,5 @@
           print("top level method topLevelD!");
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
+
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_29.yaml b/pkg/front_end/testcases/incremental/no_outline_change_29.yaml
index ba86755..7008e91 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_29.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_29.yaml
@@ -58,4 +58,4 @@
           field2 = 43;
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_3.yaml b/pkg/front_end/testcases/incremental/no_outline_change_3.yaml
index 278e445..6258294 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_3.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_3.yaml
@@ -50,4 +50,4 @@
           print("Done");
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_30.yaml b/pkg/front_end/testcases/incremental/no_outline_change_30.yaml
index 93f336e..2bd6333 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_30.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_30.yaml
@@ -58,4 +58,4 @@
           field2 = 43;
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_31.yaml b/pkg/front_end/testcases/incremental/no_outline_change_31.yaml
index 0d0e7ab..18b4590 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_31.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_31.yaml
@@ -52,4 +52,4 @@
           field2 = 43;
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_32.yaml b/pkg/front_end/testcases/incremental/no_outline_change_32.yaml
index f4bbb81..dc1174d 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_32.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_32.yaml
@@ -52,4 +52,4 @@
           field2 = 43;
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_33.yaml b/pkg/front_end/testcases/incremental/no_outline_change_33.yaml
index c8fa4c6..c8f2a25 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_33.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_33.yaml
@@ -51,7 +51,7 @@
           }
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -69,7 +69,7 @@
           }
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -88,4 +88,4 @@
           print("Done!");
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_34.yaml b/pkg/front_end/testcases/incremental/no_outline_change_34.yaml
index 2f11a3e..67f087a 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_34.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_34.yaml
@@ -73,7 +73,7 @@
           print("Done");
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -94,7 +94,7 @@
           print("done");
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -116,4 +116,4 @@
           print("done");
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml
index d481b5f7..ad7b004 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_35.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_35.yaml
@@ -54,7 +54,7 @@
           print("Done!");
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -79,4 +79,4 @@
           }
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: importsFfi
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_36.yaml b/pkg/front_end/testcases/incremental/no_outline_change_36.yaml
index dcb057e..60afcfc 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_36.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_36.yaml
@@ -32,7 +32,7 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -41,7 +41,7 @@
     invalidate:
       - file2.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -50,4 +50,4 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_37.yaml b/pkg/front_end/testcases/incremental/no_outline_change_37.yaml
index a156137..0b38610 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_37.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_37.yaml
@@ -31,7 +31,7 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -40,7 +40,7 @@
     invalidate:
       - file1.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -49,4 +49,4 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_38.yaml b/pkg/front_end/testcases/incremental/no_outline_change_38.yaml
index f586e5f..df39d98 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_38.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_38.yaml
@@ -29,7 +29,7 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -38,4 +38,4 @@
     invalidate:
       - lib.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
\ No newline at end of file
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_39.yaml b/pkg/front_end/testcases/incremental/no_outline_change_39.yaml
index 0a99343..9dc4085 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_39.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_39.yaml
@@ -56,7 +56,7 @@
           }
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -83,4 +83,4 @@
           }
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
\ No newline at end of file
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_4.yaml b/pkg/front_end/testcases/incremental/no_outline_change_4.yaml
index fbab308..c2ec530 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_4.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_4.yaml
@@ -43,4 +43,4 @@
           }
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: mixin
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_40.yaml b/pkg/front_end/testcases/incremental/no_outline_change_40.yaml
index 3d630a8..48ff766 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_40.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_40.yaml
@@ -55,7 +55,7 @@
           a.baz();
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -76,4 +76,4 @@
           boz() { return 123; }
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_41.yaml b/pkg/front_end/testcases/incremental/no_outline_change_41.yaml
index 2b10dac..b274f55 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_41.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_41.yaml
@@ -37,7 +37,7 @@
           field = 87;
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -51,4 +51,4 @@
           print('bar');
         }
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_42.yaml b/pkg/front_end/testcases/incremental/no_outline_change_42.yaml
index 9f8d58e..8e13d07 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_42.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_42.yaml
@@ -37,7 +37,7 @@
           property = 87;
         }
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -50,7 +50,7 @@
           print(123);
         }
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -64,4 +64,4 @@
           property = property;
         }
     expectedLibraryCount: 4
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_43.yaml b/pkg/front_end/testcases/incremental/no_outline_change_43.yaml
index 8fb3d4f..a0aa09f 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_43.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_43.yaml
@@ -37,7 +37,7 @@
     invalidate:
       - lib.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -46,7 +46,7 @@
     invalidate:
       - libExporter.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -55,4 +55,4 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
\ No newline at end of file
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_44_flutter.yaml b/pkg/front_end/testcases/incremental/no_outline_change_44_flutter.yaml
index 6ace390..5977f3e 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_44_flutter.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_44_flutter.yaml
@@ -41,5 +41,5 @@
     invalidate:
       - package:flutter/src/widgets/framework.dart
     expectedLibraryCount: 3
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_45_flutter.yaml b/pkg/front_end/testcases/incremental/no_outline_change_45_flutter.yaml
index 1ce5db6..004729a 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_45_flutter.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_45_flutter.yaml
@@ -27,5 +27,5 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_45_flutter_prime_1.yaml b/pkg/front_end/testcases/incremental/no_outline_change_45_flutter_prime_1.yaml
index 8b31333..8e05100 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_45_flutter_prime_1.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_45_flutter_prime_1.yaml
@@ -27,5 +27,5 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_46.yaml b/pkg/front_end/testcases/incremental/no_outline_change_46.yaml
index 0a162fe..5917122 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_46.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_46.yaml
@@ -23,5 +23,5 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_47.yaml b/pkg/front_end/testcases/incremental/no_outline_change_47.yaml
index acf60e7..2353eb0 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_47.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_47.yaml
@@ -23,4 +23,4 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml
index 1004210..a927ef1 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_48_ffi.yaml
@@ -52,4 +52,4 @@
     # The FFI transformation have to update the size and position of containers
     # (i.e. other structs with this Struct inside), so rebuilding only the
     # changed library doesn't work.
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: importsFfi
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml
index d9cd713..fd5a168 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_49_ffi.yaml
@@ -61,4 +61,4 @@
     # The FFI transformation have to update the size and position of containers
     # (i.e. other structs with this Struct inside), so rebuilding only the
     # changed library doesn't work.
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: importsFfi
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_5.yaml b/pkg/front_end/testcases/incremental/no_outline_change_5.yaml
index d7d7a6a..d4086c9 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_5.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_5.yaml
@@ -44,7 +44,7 @@
           return "hello!!!";
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -67,4 +67,4 @@
           print("Done!");
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml
index 53a1505..9cc05f8 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_50_ffi.yaml
@@ -56,4 +56,4 @@
     # The FFI transformation have to update the size and position of containers
     # (i.e. other structs with this Struct inside), so rebuilding only the
     # changed library doesn't work.
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: importsFfiClass
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_51.yaml b/pkg/front_end/testcases/incremental/no_outline_change_51.yaml
index d953359..0434d59 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_51.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_51.yaml
@@ -40,7 +40,7 @@
           return "foo!";
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: main.dart
     experiments: alternative-invalidation-strategy
@@ -56,4 +56,4 @@
           return "bar";
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false # part changed its outline.
+    advancedInvalidation: outlineChange # part changed its outline.
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_52.yaml b/pkg/front_end/testcases/incremental/no_outline_change_52.yaml
index 2297147..1ba6e7d 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_52.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_52.yaml
@@ -45,4 +45,4 @@
           }
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: mixin
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_6.yaml b/pkg/front_end/testcases/incremental/no_outline_change_6.yaml
index 4e74fed..7b60a4e 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_6.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_6.yaml
@@ -61,7 +61,7 @@
 
         enum CompilationStrategy { direct, toKernel, toData, fromData }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false # For now, libraries with errors cannot have bodies rebuild.
+    advancedInvalidation: problemsInLibrary # For now, libraries with errors cannot have bodies rebuild.
   - entry: main.dart
     experiments: alternative-invalidation-strategy
     worldType: updated
@@ -88,4 +88,4 @@
 
         enum CompilationStrategy { direct, toKernel, toData, fromData }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false # For now, libraries with errors cannot have bodies rebuild.
+    advancedInvalidation: problemsInLibrary # For now, libraries with errors cannot have bodies rebuild.
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_7.yaml b/pkg/front_end/testcases/incremental/no_outline_change_7.yaml
index 3dd8187..a349aee 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_7.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_7.yaml
@@ -90,4 +90,4 @@
         @useMeAsAnnotation
         enum CompilationStrategy { @useMeAsAnnotation direct, @useMeAsAnnotation toKernel, @useMeAsAnnotation toData, @useMeAsAnnotation fromData }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_8.yaml b/pkg/front_end/testcases/incremental/no_outline_change_8.yaml
index 5cbb862..d9664ca 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_8.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_8.yaml
@@ -41,4 +41,4 @@
           foo.x = "hello";
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_9.yaml b/pkg/front_end/testcases/incremental/no_outline_change_9.yaml
index 7310cd4..fe98020 100644
--- a/pkg/front_end/testcases/incremental/no_outline_change_9.yaml
+++ b/pkg/front_end/testcases/incremental/no_outline_change_9.yaml
@@ -44,4 +44,4 @@
           print("libMethod!");
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/part_as_entry_2.yaml b/pkg/front_end/testcases/incremental/part_as_entry_2.yaml
index 0def2e8..8265fa8 100644
--- a/pkg/front_end/testcases/incremental/part_as_entry_2.yaml
+++ b/pkg/front_end/testcases/incremental/part_as_entry_2.yaml
@@ -29,7 +29,7 @@
     invalidate:
       - lib.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
 
   - entry: entry.dart
     experiments: alternative-invalidation-strategy
@@ -39,4 +39,4 @@
     invalidate:
       - lib1.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/part_main.yaml b/pkg/front_end/testcases/incremental/part_main.yaml
index fc73d0d..217b5ab 100644
--- a/pkg/front_end/testcases/incremental/part_main.yaml
+++ b/pkg/front_end/testcases/incremental/part_main.yaml
@@ -50,4 +50,4 @@
           print('method2');
         }
     expectedLibraryCount: 1
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/regress_46004.yaml b/pkg/front_end/testcases/incremental/regress_46004.yaml
index da390ae3..109562e 100644
--- a/pkg/front_end/testcases/incremental/regress_46004.yaml
+++ b/pkg/front_end/testcases/incremental/regress_46004.yaml
@@ -30,4 +30,4 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
+    advancedInvalidation: disabled
diff --git a/pkg/front_end/testcases/incremental/second_first.yaml b/pkg/front_end/testcases/incremental/second_first.yaml
index 80faceb..9ef9f57 100644
--- a/pkg/front_end/testcases/incremental/second_first.yaml
+++ b/pkg/front_end/testcases/incremental/second_first.yaml
@@ -40,4 +40,4 @@
           print('method2');
         }
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: true
+    advancedInvalidation: bodiesOnly
\ No newline at end of file
diff --git a/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml b/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml
index 40aae93..ae6a958 100644
--- a/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml
+++ b/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml
@@ -45,5 +45,4 @@
     invalidate:
       - main.dart
     expectedLibraryCount: 2
-    expectsRebuildBodiesOnly: false
-
+    advancedInvalidation: disabled
diff --git a/tools/VERSION b/tools/VERSION
index 497c25a..005f402 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 18
 PATCH 0
-PRERELEASE 285
+PRERELEASE 286
 PRERELEASE_PATCH 0
\ No newline at end of file