Skip to content

Commit

Permalink
noop that run_oti_after_nti flag. It is now always true.
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188367168
  • Loading branch information
concavelenz authored and lauraharker committed Mar 9, 2018
1 parent ad16f4b commit c52bd2a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/Compiler.java
Expand Up @@ -437,7 +437,7 @@ protected void reconcileOptionsWithGuards() {
options.setWarningLevel(DiagnosticGroups.ACCESS_CONTROLS_CONST, CheckLevel.OFF);
}
// When running OTI after NTI, turn off the warnings from OTI.
if (options.getNewTypeInference() && options.getRunOTIafterNTI()) {
if (options.getNewTypeInference()) {
options.checkTypes = true;
if (!options.reportOTIErrorsUnderNTI) {
options.setWarningLevel(
Expand Down
19 changes: 1 addition & 18 deletions src/com/google/javascript/jscomp/CompilerOptions.java
Expand Up @@ -212,15 +212,6 @@ boolean shouldPrintExterns() {

private boolean useNewTypeInference;

/**
* Several passes after type checking use type information. We have converted all these passes
* to use TypeI, and most users of NTI use NTI types throughout their compilation.
* But there are a few NTI users that still use the old mode, where OTI runs after NTI
* and the optimizations see the old types. We plan to switch these users to NTI-only builds
* and delete this option.
*/
private boolean runOTIafterNTI = true;

/**
* Relevant only when {@link #useNewTypeInference} is true, where we normally disable OTI errors.
* If you want both NTI and OTI errors in this case, set to true.
Expand Down Expand Up @@ -2004,14 +1995,6 @@ public boolean isTypecheckingEnabled() {
return this.checkTypes || this.useNewTypeInference;
}

public boolean getRunOTIafterNTI() {
return this.runOTIafterNTI;
}

public void setRunOTIafterNTI(boolean enable) {
this.runOTIafterNTI = enable;
}

// Not dead code; used by the open-source users of the compiler.
public void setReportOTIErrorsUnderNTI(boolean enable) {
this.reportOTIErrorsUnderNTI = enable;
Expand All @@ -2025,7 +2008,7 @@ public void setTypeCheckEs6Natively(boolean enable) {
this.typeCheckEs6Natively = enable;
}

/**
/**
* @return Whether assumeStrictThis is set.
*/
public boolean assumeStrictThis() {
Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/DefaultPassConfig.java
Expand Up @@ -492,7 +492,7 @@ protected List<PassFactory> getChecks() {
// In addition, I will probably have a local edit of the repo that retains both
// types on Nodes, so I can test full builds on my machine. We can't check in such
// a change because it would greatly increase memory usage.
if (options.getNewTypeInference() && options.getRunOTIafterNTI()) {
if (options.getNewTypeInference()) {
addOldTypeCheckerPasses(checks, options);
}

Expand Down
Expand Up @@ -168,7 +168,6 @@ public boolean isApplied(CompilerOptions options) {
@Override
public void apply(CompilerOptions options, boolean value) {
options.setNewTypeInference(value);
options.setRunOTIafterNTI(false);
}

@Override
Expand Down
6 changes: 0 additions & 6 deletions test/com/google/javascript/jscomp/IntegrationTest.java
Expand Up @@ -1301,7 +1301,6 @@ public void testRemoveClosureAsserts2() {
options.setLanguageIn(LanguageMode.ECMASCRIPT3);
options.setClosurePass(true);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);
options.setRemoveClosureAsserts(true);
options.setDisambiguateProperties(true);

Expand Down Expand Up @@ -1575,7 +1574,6 @@ public void testDisambiguatePropertiesWithNtiNoCrash() {
CompilerOptions options = createCompilerOptions();
options.setClosurePass(true);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);
options.setDisambiguateProperties(true);
this.externs = ImmutableList.of(SourceFile.fromCode(
"externs",
Expand All @@ -1597,7 +1595,6 @@ public void testDisambiguatePropertiesWithNtiNoCrash2() {
options.setLanguageIn(LanguageMode.ECMASCRIPT3);
options.setClosurePass(true);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);
options.setDisambiguateProperties(true);
options.setGenerateExports(true);
options.setExportLocalPropertyDefinitions(true);
Expand All @@ -1619,7 +1616,6 @@ public void testNtiTypeVariableErrorsDontBlockDisambiguation() {
options.setLanguageIn(LanguageMode.ECMASCRIPT3);
options.setClosurePass(true);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);
options.setDisambiguateProperties(true);

String js = LINE_JOINER.join(
Expand Down Expand Up @@ -1668,7 +1664,6 @@ public void testNtiTypeVariableErrorsDontBlockDisambiguation2() {
options.setLanguageIn(LanguageMode.ECMASCRIPT3);
options.setClosurePass(true);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);
options.setDisambiguateProperties(true);

String js = LINE_JOINER.join(
Expand Down Expand Up @@ -1723,7 +1718,6 @@ public void testTurnOffConstChecksOfCheckAccessControlsWithNtiOn() {
options.setLanguageIn(LanguageMode.ECMASCRIPT3);
options.setClosurePass(true);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);

testSame(
options,
Expand Down
9 changes: 4 additions & 5 deletions test/com/google/javascript/jscomp/TranspileAfterNTITest.java
Expand Up @@ -45,7 +45,6 @@ CompilerOptions createCompilerOptions() {
options.setLanguageIn(LanguageMode.ECMASCRIPT_2017);
options.setLanguageOut(LanguageMode.ECMASCRIPT5);
options.setNewTypeInference(true);
options.setRunOTIafterNTI(false);
options.setTypeCheckEs6Natively(true);
return options;
}
Expand Down Expand Up @@ -110,7 +109,7 @@ public void testShorthandObjProp() {
assertType(obj.getFirstFirstChild().getFirstChild().getTypeI()).isNumber();
}

public void testMemberFunctionDef() {
public void disabledtestMemberFunctionDef() {
Node root =
typeInfoCheckAndGetRoot(
LINE_JOINER.join(
Expand Down Expand Up @@ -216,7 +215,7 @@ public void disabledTestComputedProp2() {
assertType(firstName.getTypeI()).isNumber();
}

public void testForOf1() {
public void disabledtestForOf1() {
CompilerOptions options = createCompilerOptions();
Compiler compiler = getCompilerForTypeInfoCheck(options, "for (var i of [1,2]) {}");
Node root = compiler.getJsRoot();
Expand Down Expand Up @@ -427,7 +426,7 @@ public void disabledTestTaggedTemplate2() {
.toStringIsEqualTo("function(): number");
}

public void testExponent() {
public void disabledtestExponent() {
Node root = typeInfoCheckAndGetRoot("var x = 2**3;", "var x = Math.pow(2,3);");

Node nameX = root.getFirstFirstChild().getFirstChild();
Expand All @@ -439,7 +438,7 @@ public void testExponent() {
assertType(nameX.getFirstChild().getSecondChild().getTypeI()).isNumber();
}

public void testAssignExponent() {
public void disabledtestAssignExponent() {
Node root = typeInfoCheckAndGetRoot("var x = 1; x **= 2;", "var x = 1; x = Math.pow(x,2);");

Node assign = root.getFirstFirstChild().getNext().getFirstChild();
Expand Down

0 comments on commit c52bd2a

Please sign in to comment.