Skip to content

Commit

Permalink
[NTI] Don't silence NTI warnings in CheckConformanceTest, plus replac…
Browse files Browse the repository at this point in the history
…e isLoose with isSomeUnknownType.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130452183
  • Loading branch information
aravind-pg authored and dimvar committed Aug 17, 2016
1 parent a1467ce commit 265a100
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 53 deletions.
5 changes: 2 additions & 3 deletions src/com/google/javascript/jscomp/ConformanceRules.java
Expand Up @@ -485,8 +485,7 @@ private ConformanceResult checkConformance(NodeTraversal t, Node n, Property pro
Node lhs = n.getFirstChild();
if (methodClassType != null && lhs.getTypeI() != null) {
TypeI targetType = lhs.getTypeI().restrictByNotNullOrUndefined();
if (targetType.isUnknownType()
|| targetType.isLooseType()
if (targetType.isSomeUnknownType()
|| targetType.isTypeVariable()
|| targetType.isBottom()
|| targetType.isTop()
Expand Down Expand Up @@ -1233,7 +1232,7 @@ protected ConformanceResult checkConformance(NodeTraversal t, Node n) {
}

if (n.isGetProp()
&& isUnknown(n)
&& n.getTypeI().isSomeUnknownType()
&& isUsed(n) // skip most assignments, etc
&& !isTypeImmediatelyTightened(n)
&& isCheckablePropertySource(n.getFirstChild()) // not a cascading unknown
Expand Down
7 changes: 5 additions & 2 deletions src/com/google/javascript/jscomp/newtypes/JSType.java
Expand Up @@ -1547,8 +1547,11 @@ public boolean isUnknownType() {
}

@Override
public boolean isLooseType() {
return isInstanceofObject() && isLoose();
public boolean isSomeUnknownType() {
FunctionType ft = this.getFunTypeIfSingletonObj();
return isUnknown()
|| (isInstanceofObject() && isLoose())
|| (ft != null && ft.isTopFunction());
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/rhino/TypeI.java
Expand Up @@ -74,7 +74,7 @@ public interface TypeI {

boolean isUnknownType();

boolean isLooseType();
boolean isSomeUnknownType();

boolean isUnionType();

Expand Down
2 changes: 1 addition & 1 deletion src/com/google/javascript/rhino/jstype/JSType.java
Expand Up @@ -272,7 +272,7 @@ public boolean isUnknownType() {
}

@Override
public final boolean isLooseType() {
public final boolean isSomeUnknownType() {
// OTI's notion of isUnknownType already accounts for looseness (see override in ObjectType).
return isUnknownType();
}
Expand Down

0 comments on commit 265a100

Please sign in to comment.