Program: 19272
Project: 19272
Buggy source:
/** 
 * This method processes a single variable declaration in a VAR statement, in the forward phase of the analysis.
 */
private TypeEnv analyzeVarDeclFwd(Node nameNode,TypeEnv inEnv){
  String varName=nameNode.getString();
  JSType declType=this.currentScope.getDeclaredTypeOf(varName);
  if (this.currentScope.isLocalFunDef(varName)) {
    return inEnv;
  }
  Node rhs=nameNode.getFirstChild();
  if (NodeUtil.isNamespaceDecl(nameNode) || (GlobalTypeInfoCollector.isCtorDefinedByCall(nameNode) && !isFunctionBind(rhs.getFirstChild(),inEnv,true)) || nameNode.getParent().getBooleanProp(Node.ANALYZED_DURING_GTI)) {
    Preconditions.checkNotNull(declType,"String_Node_Str",nameNode);
    maybeSetTypeI(nameNode,declType);
    return envPutType(inEnv,varName,declType);
  }
  TypeEnv outEnv=inEnv;
  JSType rhsType=null;
  if (rhs != null) {
    EnvTypePair pair=analyzeExprFwd(rhs,inEnv,firstNonNull(declType,UNKNOWN));
    outEnv=pair.env;
    rhsType=pair.type;
    if (declType != null) {
      if (rhsType.isSubtypeOf(declType)) {
        registerImplicitUses(rhs,rhsType,declType);
      }
 else {
        registerMismatchAndWarn(JSError.make(rhs,MISTYPED_ASSIGN_RHS,errorMsgWithTypeDiff(declType,rhsType)),rhsType,declType);
      }
    }
  }
  JSType varType=rhsType;
  if (rhs == null) {
    varType=UNDEFINED;
  }
 else   if (declType != null) {
    JSDocInfo jsdoc=NodeUtil.getBestJSDocInfo(nameNode);
    if (jsdoc != null && (!jsdoc.hasConstAnnotation() || jsdoc.hasType())) {
      varType=declType;
    }
  }
  maybeSetTypeI(nameNode,varType);
  return envPutType(outEnv,varName,varType);
}

Fixed version (ground truth):
/** 
 * This method processes a single variable declaration in a VAR statement, in the forward phase of the analysis.
 */
private TypeEnv analyzeVarDeclFwd(Node nameNode,TypeEnv inEnv){
  String varName=nameNode.getString();
  JSType declType=this.currentScope.getDeclaredTypeOf(varName);
  if (this.currentScope.isLocalFunDef(varName)) {
    return inEnv;
  }
  Node rhs=nameNode.getFirstChild();
  if (NodeUtil.isNamespaceDecl(nameNode) || (GlobalTypeInfoCollector.isCtorDefinedByCall(nameNode) && !isFunctionBind(rhs.getFirstChild(),inEnv,true)) || nameNode.getParent().getBooleanProp(Node.ANALYZED_DURING_GTI)) {
    Preconditions.checkNotNull(declType,"String_Node_Str",nameNode);
    maybeSetTypeI(nameNode,declType);
    maybeSetTypeI(rhs,declType);
    return envPutType(inEnv,varName,declType);
  }
  TypeEnv outEnv=inEnv;
  JSType rhsType=null;
  if (rhs != null) {
    EnvTypePair pair=analyzeExprFwd(rhs,inEnv,firstNonNull(declType,UNKNOWN));
    outEnv=pair.env;
    rhsType=pair.type;
    if (declType != null) {
      if (rhsType.isSubtypeOf(declType)) {
        registerImplicitUses(rhs,rhsType,declType);
      }
 else {
        registerMismatchAndWarn(JSError.make(rhs,MISTYPED_ASSIGN_RHS,errorMsgWithTypeDiff(declType,rhsType)),rhsType,declType);
      }
    }
  }
  JSType varType=rhsType;
  if (rhs == null) {
    varType=UNDEFINED;
  }
 else   if (declType != null) {
    JSDocInfo jsdoc=NodeUtil.getBestJSDocInfo(nameNode);
    if (jsdoc != null && (!jsdoc.hasConstAnnotation() || jsdoc.hasType())) {
      varType=declType;
    }
  }
  maybeSetTypeI(nameNode,varType);
  return envPutType(outEnv,varName,varType);
}