[cfe] Update incremental tests for advanced invalidation coverage
This updates the incremental test to cover all naturally occuring
advanced invalidation results.
Removes duplicateInLibrary since it was surpassed by problemsInLibrary.
Change-Id: I1669bd93220b83a911328629de92bb6d8a0ec826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251551
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 2487b88..d6687f9 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -1224,16 +1224,6 @@
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;
- }
- }
List<Uri> builderUris = [builder.fileUri];
for (LibraryPart part in builder.library.parts) {
@@ -2852,10 +2842,6 @@
/// 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,
diff --git a/pkg/front_end/testcases/incremental/crash_05.yaml b/pkg/front_end/testcases/incremental/crash_05.yaml
index 609fa82..3b6028d 100644
--- a/pkg/front_end/testcases/incremental/crash_05.yaml
+++ b/pkg/front_end/testcases/incremental/crash_05.yaml
@@ -7,6 +7,7 @@
type: newworld
worlds:
- entry: main.dart
+ experiments: alternative-invalidation-strategy
sources:
main.dart: |
import 'dart:ffi';
@@ -23,9 +24,10 @@
expectedLibraryCount: 2
- entry: main.dart
+ experiments: alternative-invalidation-strategy
worldType: updated
expectInitializeFromDill: false
invalidate:
- main.dart
expectedLibraryCount: 2
- advancedInvalidation: disabled
+ advancedInvalidation: importsFfi
diff --git a/pkg/front_end/testcases/incremental/crash_06.yaml b/pkg/front_end/testcases/incremental/crash_06.yaml
index 6a7fdea..2d3b4d6 100644
--- a/pkg/front_end/testcases/incremental/crash_06.yaml
+++ b/pkg/front_end/testcases/incremental/crash_06.yaml
@@ -7,6 +7,7 @@
type: newworld
worlds:
- entry: structs.dart
+ experiments: alternative-invalidation-strategy
errors: true
sources:
structs.dart: |
@@ -20,11 +21,12 @@
expectedLibraryCount: 1
- entry: structs.dart
+ experiments: alternative-invalidation-strategy
errors: true
worldType: updated
expectInitializeFromDill: false
invalidate:
- structs.dart
expectedLibraryCount: 1
- advancedInvalidation: disabled
+ advancedInvalidation: problemsInLibrary
diff --git a/pkg/front_end/testcases/incremental/dart2js_late.yaml b/pkg/front_end/testcases/incremental/dart2js_late.yaml
index 8ee5644..5e502a5 100644
--- a/pkg/front_end/testcases/incremental/dart2js_late.yaml
+++ b/pkg/front_end/testcases/incremental/dart2js_late.yaml
@@ -9,6 +9,7 @@
target: dart2js
worlds:
- entry: late_statics.dart
+ experiments: alternative-invalidation-strategy
sources:
late_statics.dart: |
import 'late_statics_lib.dart' as lib;
@@ -22,10 +23,11 @@
expectedLibraryCount: 2
- entry: late_statics.dart
+ experiments: alternative-invalidation-strategy
worldType: updated
expectInitializeFromDill: false
invalidate:
- late_statics.dart
expectedLibraryCount: 2
- advancedInvalidation: disabled
+ advancedInvalidation: bodiesOnly
diff --git a/pkg/front_end/testcases/incremental/issue_46666.yaml b/pkg/front_end/testcases/incremental/issue_46666.yaml
index 9365b13..ca0ab2c 100644
--- a/pkg/front_end/testcases/incremental/issue_46666.yaml
+++ b/pkg/front_end/testcases/incremental/issue_46666.yaml
@@ -7,6 +7,7 @@
type: newworld
worlds:
- entry: b.dart
+ experiments: alternative-invalidation-strategy
sources:
a.dart: |
import 'dart:ffi';
@@ -44,9 +45,10 @@
expectedLibraryCount: 2
- entry: b.dart
+ experiments: alternative-invalidation-strategy
worldType: updated
expectInitializeFromDill: false
invalidate:
- b.dart
expectedLibraryCount: 2
- advancedInvalidation: disabled
+ advancedInvalidation: importsFfi
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml b/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml
new file mode 100644
index 0000000..fb6f560
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml
@@ -0,0 +1,55 @@
+# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE.md file.
+
+# Copy of no_outline_change_1 with the advanced invalidation disabled.
+
+type: newworld
+worlds:
+ - entry: actualMain.dart
+ experiments: no-alternative-invalidation-strategy
+ sources:
+ actualMain.dart: |
+ import 'main.dart' as m;
+ main() {
+ m.main();
+ }
+ main.dart: |
+ import 'libA.dart';
+
+ main() {
+ whatever();
+ }
+ mainHello() {}
+ libA.dart: |
+ import 'main.dart';
+ import 'libB.dart';
+ class Foo {}
+ whatever() {
+ Bar bar = new Bar(new Foo());
+ mainHello();
+ }
+ libB.dart: |
+ import 'libA.dart';
+ class Bar {
+ Foo foo;
+ Bar(this.foo);
+ }
+ expectedLibraryCount: 4
+ - entry: actualMain.dart
+ experiments: no-alternative-invalidation-strategy
+ worldType: updated
+ expectInitializeFromDill: false
+ invalidate:
+ - main.dart
+ sources:
+ main.dart: |
+ import 'libA.dart';
+
+ main() {
+ whatever();
+ mainHello();
+ }
+ mainHello() {}
+ expectedLibraryCount: 4
+ advancedInvalidation: disabled
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml.world.1.expect b/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml.world.1.expect
new file mode 100644
index 0000000..644fc90
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml.world.1.expect
@@ -0,0 +1,44 @@
+main = act::main;
+library from "org-dartlang-test:///actualMain.dart" as act {
+
+ import "org-dartlang-test:///main.dart" as m;
+
+ static method main() → dynamic {
+ main::main();
+ }
+}
+library from "org-dartlang-test:///libA.dart" as libA {
+
+ import "org-dartlang-test:///main.dart";
+ import "org-dartlang-test:///libB.dart";
+
+ class Foo extends dart.core::Object {
+ synthetic constructor •() → libA::Foo
+ : super dart.core::Object::•()
+ ;
+ }
+ static method whatever() → dynamic {
+ libB::Bar bar = new libB::Bar::•(new libA::Foo::•());
+ main::mainHello();
+ }
+}
+library from "org-dartlang-test:///libB.dart" as libB {
+
+ import "org-dartlang-test:///libA.dart";
+
+ class Bar extends dart.core::Object {
+ field libA::Foo foo;
+ constructor •(libA::Foo foo) → libB::Bar
+ : libB::Bar::foo = foo, super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///libA.dart";
+
+ static method main() → dynamic {
+ libA::whatever();
+ }
+ static method mainHello() → dynamic {}
+}
diff --git a/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml.world.2.expect b/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml.world.2.expect
new file mode 100644
index 0000000..7fa866e
--- /dev/null
+++ b/pkg/front_end/testcases/incremental/no_outline_change_1_disabled.yaml.world.2.expect
@@ -0,0 +1,45 @@
+main = act::main;
+library from "org-dartlang-test:///actualMain.dart" as act {
+
+ import "org-dartlang-test:///main.dart" as m;
+
+ static method main() → dynamic {
+ main::main();
+ }
+}
+library from "org-dartlang-test:///libA.dart" as libA {
+
+ import "org-dartlang-test:///main.dart";
+ import "org-dartlang-test:///libB.dart";
+
+ class Foo extends dart.core::Object {
+ synthetic constructor •() → libA::Foo
+ : super dart.core::Object::•()
+ ;
+ }
+ static method whatever() → dynamic {
+ libB::Bar bar = new libB::Bar::•(new libA::Foo::•());
+ main::mainHello();
+ }
+}
+library from "org-dartlang-test:///libB.dart" as libB {
+
+ import "org-dartlang-test:///libA.dart";
+
+ class Bar extends dart.core::Object {
+ field libA::Foo foo;
+ constructor •(libA::Foo foo) → libB::Bar
+ : libB::Bar::foo = foo, super dart.core::Object::•()
+ ;
+ }
+}
+library from "org-dartlang-test:///main.dart" as main {
+
+ import "org-dartlang-test:///libA.dart";
+
+ static method main() → dynamic {
+ libA::whatever();
+ main::mainHello();
+ }
+ static method mainHello() → dynamic {}
+}
diff --git a/pkg/front_end/testcases/incremental/regress_46004.yaml b/pkg/front_end/testcases/incremental/regress_46004.yaml
index 109562e..3e3217d 100644
--- a/pkg/front_end/testcases/incremental/regress_46004.yaml
+++ b/pkg/front_end/testcases/incremental/regress_46004.yaml
@@ -5,6 +5,7 @@
type: newworld
worlds:
- entry: main.dart
+ experiments: alternative-invalidation-strategy
sources:
main.dart: |
import 'dart:ffi';
@@ -25,9 +26,10 @@
expectedLibraryCount: 2
- entry: main.dart
+ experiments: alternative-invalidation-strategy
worldType: updated
expectInitializeFromDill: false
invalidate:
- main.dart
expectedLibraryCount: 2
- advancedInvalidation: disabled
+ advancedInvalidation: importsFfi
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 ae6a958..127a8c8 100644
--- a/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml
+++ b/pkg/front_end/testcases/incremental/type_change_on_recompile.yaml
@@ -23,6 +23,7 @@
type: newworld
worlds:
- entry: main.dart
+ experiments: alternative-invalidation-strategy
sources:
main.dart: |
import 'lib.dart';
@@ -40,9 +41,10 @@
expectedLibraryCount: 2
- entry: main.dart
+ experiments: alternative-invalidation-strategy
worldType: updated
expectInitializeFromDill: false
invalidate:
- main.dart
expectedLibraryCount: 2
- advancedInvalidation: disabled
+ advancedInvalidation: bodiesOnly