Skip to content

Commit

Permalink
Turn on missing properties checks by default.
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128799888
  • Loading branch information
blickly committed Jul 29, 2016
1 parent ee79ac5 commit f6bc1df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/com/google/javascript/jscomp/PassConfig.java
Expand Up @@ -21,7 +21,6 @@
import com.google.javascript.jscomp.graph.GraphvizGraph;
import com.google.javascript.jscomp.graph.LinkedDirectedGraph;
import com.google.javascript.rhino.Node;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -187,7 +186,7 @@ final TypeCheck makeTypeCheck(AbstractCompiler compiler) {
topScope,
typedScopeCreator,
options.reportMissingOverride)
.reportMissingProperties(options.enables(
.reportMissingProperties(!options.disables(
DiagnosticGroup.forType(TypeCheck.INEXISTENT_PROPERTY)));
}

Expand Down
6 changes: 6 additions & 0 deletions test/com/google/javascript/jscomp/IntegrationTest.java
Expand Up @@ -284,6 +284,7 @@ public void testWindowIsTypedEs6() {
options.setLanguageIn(LanguageMode.ECMASCRIPT6_STRICT);
options.setLanguageOut(LanguageMode.ECMASCRIPT5);
options.setCheckTypes(true);
options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF);
test(
options,
LINE_JOINER.join(
Expand Down Expand Up @@ -1107,6 +1108,7 @@ public void testDisambiguateProperties2() {
test(options,
LINE_JOINER.join(
"/** @const */ var goog = {};",
"goog.abstractMethod = function() {};",
"/** @interface */ function I() {}",
"I.prototype.a = function(x) {};",
"/** @constructor @implements {I} */ function Foo() {}",
Expand All @@ -1115,6 +1117,7 @@ public void testDisambiguateProperties2() {
"/** @override */ Bar.prototype.a = function(x) {};"),
LINE_JOINER.join(
"var goog={};",
"goog.abstractMethod = function() {};",
"function I(){}",
"I.prototype.a=function(x){};",
"function Foo(){}",
Expand Down Expand Up @@ -1525,6 +1528,7 @@ public void testSmartNamePassBug11163486() {
options.setRemoveUnusedPrototypeProperties(true);
options.setSmartNameRemoval(true);
options.extraSmartNameRemoval = true;
options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF);

String code = "/** @constructor */ function A() {} " +
"A.prototype.foo = function() { " +
Expand Down Expand Up @@ -1571,6 +1575,7 @@ public void testDeadCodeHasNoDisambiguationSideEffects() {
options.extraSmartNameRemoval = true;
options.setFoldConstants(true);
options.setInlineVariables(true);
options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF);

String code =
"/** @constructor */ function A() {} "
Expand Down Expand Up @@ -2112,6 +2117,7 @@ public void testFoldLocals2() {

options.setFoldConstants(true);
options.setCheckTypes(true);
options.setWarningLevel(DiagnosticGroups.MISSING_PROPERTIES, CheckLevel.OFF);

// An external function that returns a local object that the
// method "go" that only modifies the object.
Expand Down
Expand Up @@ -20,4 +20,7 @@
var goog = goog || {};

/** @param {string} name */
goog.provide = function(name) {}
goog.provide = function(name) {};

/** @param {string} name */
goog.require = function(name) {};

0 comments on commit f6bc1df

Please sign in to comment.