Program: 27881
Project: 27881
Buggy source:
/** 
 * Determines whether a qualified name is inferred. NOTE(nicksantos): Determining whether a property is declared or not is really really obnoxious. The problem is that there are two (equally valid) coding styles: (function() { /* The authoritative definition of goog.bar. / goog.bar = function() {}; })(); function f() { goog.bar(); /* Reset goog.bar to a no-op. / goog.bar = function() {}; } In a dynamic language with first-class functions, it's very difficult to know which one the user intended without looking at lots of contextual information (the second example demonstrates a small case of this, but there are some really pathological cases as well). The current algorithm checks if either the declaration has JsDoc type information, or @const with a known type, or a function literal with a name we haven't seen before.
 */
private boolean isQualifiedNameInferred(String qName,Node n,JSDocInfo info,Node rhsValue,JSType valueType){
  if (valueType == null) {
    return true;
  }
  boolean inferred=true;
  if (info != null) {
    inferred=!(info.hasType() || info.hasEnumParameterType() || (isConstantSymbol(info,n) && valueType != null && !valueType.isUnknownType())|| FunctionTypeBuilder.isFunctionTypeDeclaration(info));
  }
  if (inferred && rhsValue != null && rhsValue.isFunction()) {
    if (info != null) {
      return false;
    }
 else     if (!scope.isDeclared(qName,false) && n.isUnscopedQualifiedName()) {
      for (Node current=n.getParent(); !(current.isScript() || current.isFunction()); current=current.getParent()) {
        if (NodeUtil.isControlStructure(current)) {
          return true;
        }
      }
      AstFunctionContents contents=getFunctionAnalysisResults(scope.getRootNode());
      if (contents == null || !contents.getEscapedQualifiedNames().contains(qName)) {
        return false;
      }
    }
  }
  return inferred;
}

Fixed version (ground truth):
/** 
 * Determines whether a qualified name is inferred. NOTE(nicksantos): Determining whether a property is declared or not is really really obnoxious. The problem is that there are two (equally valid) coding styles: (function() { /* The authoritative definition of goog.bar. / goog.bar = function() {}; })(); function f() { goog.bar(); /* Reset goog.bar to a no-op. / goog.bar = function() {}; } In a dynamic language with first-class functions, it's very difficult to know which one the user intended without looking at lots of contextual information (the second example demonstrates a small case of this, but there are some really pathological cases as well). The current algorithm checks if either the declaration has JsDoc type information, or @const with a known type, or a function literal with a name we haven't seen before.
 */
private boolean isQualifiedNameInferred(String qName,Node n,JSDocInfo info,Node rhsValue,JSType valueType){
  if (valueType == null) {
    return true;
  }
  if (qName != null && qName.endsWith("String_Node_Str")) {
    return false;
  }
  boolean inferred=true;
  if (info != null) {
    inferred=!(info.hasType() || info.hasEnumParameterType() || (isConstantSymbol(info,n) && valueType != null && !valueType.isUnknownType())|| FunctionTypeBuilder.isFunctionTypeDeclaration(info));
  }
  if (inferred && rhsValue != null && rhsValue.isFunction()) {
    if (info != null) {
      return false;
    }
 else     if (!scope.isDeclared(qName,false) && n.isUnscopedQualifiedName()) {
      for (Node current=n.getParent(); !(current.isScript() || current.isFunction()); current=current.getParent()) {
        if (NodeUtil.isControlStructure(current)) {
          return true;
        }
      }
      AstFunctionContents contents=getFunctionAnalysisResults(scope.getRootNode());
      if (contents == null || !contents.getEscapedQualifiedNames().contains(qName)) {
        return false;
      }
    }
  }
  return inferred;
}