[NTI] Teach TypeICompilerTestCase to run testExternChanges in both OTI and NTI.
@@ -88,6 +88,20 @@ public abstract class TypeICompilerTestCase extends CompilerTestCase {
}
}
+ @Override
+ protected void testExternChanges(String extern, String input, String expectedExtern,
+ DiagnosticType... warnings) {
+ if (this.mode.runsOTI()) {
+ testExternChangesOTI(extern, input, expectedExtern, warnings);
+ }
+ if (this.mode.runsNTI()) {
+ testExternChangesNTI(extern, input, expectedExtern, warnings);
+ }
+ if (this.mode.runsNeither()) {
+ super.testExternChanges(extern, input, expectedExtern, warnings);
+ }
+ }
+
// Note: may be overridden to allow different externs if necessary.
void checkMinimalExterns(Iterable<SourceFile> externs) {
try {
@@ -134,6 +148,26 @@ public abstract class TypeICompilerTestCase extends CompilerTestCase {
this.mode = saved;
}
+ private void testExternChangesOTI(String extern, String input, String expectedExtern,
+ DiagnosticType... warnings) {
+ TypeInferenceMode saved = this.mode;
+ this.mode = TypeInferenceMode.OTI_ONLY;
+ enableTypeCheck();
+ super.testExternChanges(extern, input, expectedExtern, warnings);
+ disableTypeCheck();
+ this.mode = saved;
+ }
+
+ private void testExternChangesNTI(String extern, String input, String expectedExtern,
+ DiagnosticType... warnings) {
+ TypeInferenceMode saved = this.mode;
+ this.mode = TypeInferenceMode.NTI_ONLY;
+ enableNewTypeInference();
+ super.testExternChanges(extern, input, expectedExtern, warnings);
+ disableNewTypeInference();
+ this.mode = saved;
+ }
+
void testWarningOtiNti(
String js, DiagnosticType otiWarning, DiagnosticType ntiWarning) {
TypeInferenceMode saved = this.mode;
