nus-yam/ex-repair huggingface dataset:
Program: 27661
Project: 27661
Buggy source:
@Override public List<SuggestedFix> processMatch(Match match){
  SuggestedFix.Builder fix=new SuggestedFix.Builder();
  Node newNode=transformNode(matchedTemplate.afterTemplate.getLastChild(),matchedTemplate.matcher.getTemplateNodeToMatchMap());
  Node nodeToReplace=match.getNode();
  if (nodeToReplace.getParent().isExprResult()) {
    nodeToReplace=nodeToReplace.getParent();
  }
  fix.replace(nodeToReplace,newNode,match.getMetadata().getCompiler());
  Node n=match.getNode().getNext();
  for (int i=1; i < matchedTemplate.beforeTemplate.getLastChild().getChildCount(); i++) {
    Preconditions.checkNotNull(n,"String_Node_Str" + "String_Node_Str",matchedTemplate.beforeTemplate.getLastChild(),match.getNode());
    fix.delete(n);
    n=n.getNext();
  }
  for (  String require : matchedTemplate.getGoogRequiresToAdd()) {
    fix.addGoogRequire(match,require);
  }
  for (  String require : matchedTemplate.getGoogRequiresToRemove()) {
    fix.removeGoogRequire(match,require);
  }
  return ImmutableList.of(fix.build());
}

Fixed version (ground truth):
@Override public List<SuggestedFix> processMatch(Match match){
  SuggestedFix.Builder fix=new SuggestedFix.Builder();
  Node newNode=transformNode(matchedTemplate.afterTemplate.getLastChild(),matchedTemplate.matcher.getTemplateNodeToMatchMap());
  Node nodeToReplace=match.getNode();
  fix.replace(nodeToReplace,newNode,match.getMetadata().getCompiler());
  Node n=match.getNode().getNext();
  for (int i=1; i < matchedTemplate.beforeTemplate.getLastChild().getChildCount(); i++) {
    Preconditions.checkNotNull(n,"String_Node_Str" + "String_Node_Str",matchedTemplate.beforeTemplate.getLastChild(),match.getNode());
    fix.delete(n);
    n=n.getNext();
  }
  for (  String require : matchedTemplate.getGoogRequiresToAdd()) {
    fix.addGoogRequire(match,require);
  }
  for (  String require : matchedTemplate.getGoogRequiresToRemove()) {
    fix.removeGoogRequire(match,require);
  }
  return ImmutableList.of(fix.build());
}
Program: 27662
Project: 27662
Buggy source:
/** 
 * Replaces the provided node with new node in the source file.
 */
public Builder replace(Node original,Node newNode,AbstractCompiler compiler){
  replacements.put(original.getSourceFileName(),new CodeReplacement(original.getSourceOffset(),original.getLength(),generateCode(compiler,newNode)));
  return this;
}

Fixed version (ground truth):
/** 
 * Replaces the provided node with new node in the source file.
 */
public Builder replace(Node original,Node newNode,AbstractCompiler compiler){
  Node parent=original.getParent();
  if (original.getParent().isExprResult()) {
    original=original.getParent();
  }
  String newCode=generateCode(compiler,newNode);
  if (newCode.endsWith("String_Node_Str")) {
    newCode=newCode.substring(0,newCode.length() - 1);
  }
  boolean needsSemicolon=parent.isExprResult() || parent.isBlock() || parent.isScript();
  if (newCode.endsWith("String_Node_Str") && !needsSemicolon) {
    newCode=newCode.substring(0,newCode.length() - 1);
  }
  replacements.put(original.getSourceFileName(),new CodeReplacement(original.getSourceOffset(),original.getLength(),newCode));
  return this;
}
Program: 27665
Project: 27665
Buggy source:
private EnvTypePair mayWarnAboutNullableReferenceAndTighten(Node obj,JSType recvType,TypeEnv inEnv){
  if (!recvType.isUnknown() && (JSType.NULL.isSubtypeOf(recvType) || JSType.UNDEFINED.isSubtypeOf(recvType))) {
    JSType minusNull=recvType.removeType(JSType.NULL_OR_UNDEF);
    if (!minusNull.isBottom() && minusNull != recvType && minusNull.isSubtypeOf(JSType.TOP_OBJECT)) {
      warnings.add(JSError.make(obj,NULLABLE_DEREFERENCE,recvType.toString()));
      EnvTypePair pair=analyzeExprFwd(obj,inEnv,minusNull);
      pair.type=minusNull;
      return pair;
    }
  }
  return new EnvTypePair(inEnv,recvType);
}

Fixed version (ground truth):
private EnvTypePair mayWarnAboutNullableReferenceAndTighten(Node obj,JSType recvType,TypeEnv inEnv){
  if (!recvType.isUnknown() && (JSType.NULL.isSubtypeOf(recvType) || JSType.UNDEFINED.isSubtypeOf(recvType))) {
    JSType minusNull=recvType.removeType(JSType.NULL_OR_UNDEF);
    if (!minusNull.isBottom() && !minusNull.equals(recvType) && minusNull.isSubtypeOf(JSType.TOP_OBJECT)) {
      warnings.add(JSError.make(obj,NULLABLE_DEREFERENCE,recvType.toString()));
      TypeEnv outEnv=inEnv;
      if (obj.isQualifiedName()) {
        QualifiedName qname=QualifiedName.fromNode(obj);
        outEnv=updateLvalueTypeInEnv(inEnv,obj,qname,minusNull);
      }
      return new EnvTypePair(outEnv,minusNull);
    }
  }
  return new EnvTypePair(inEnv,recvType);
}
Program: 27666
Project: 27666
Buggy source:
void addNumber(double x){
  char prev=getLastChar();
  boolean negativeZero=isNegativeZero(x);
  if ((x < 0 || negativeZero) && prev == '-') {
    add("String_Node_Str");
  }
  if (negativeZero) {
    addConstant("String_Node_Str");
  }
 else   if ((long)x == x) {
    long value=(long)x;
    long mantissa=value;
    int exp=0;
    if (Math.abs(x) >= 100) {
      while (mantissa / 10 * Math.pow(10,exp + 1) == value) {
        mantissa/=10;
        exp++;
      }
    }
    if (exp > 2) {
      addConstant(Long.toString(mantissa) + "String_Node_Str" + Integer.toString(exp));
    }
 else {
      long valueAbs=Math.abs(value);
      if (valueAbs > 1000000000000L && Long.toHexString(valueAbs).length() + 2 < Long.toString(valueAbs).length()) {
        addConstant((value < 0 ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + Long.toHexString(valueAbs));
      }
 else {
        addConstant(Long.toString(value));
      }
    }
  }
 else {
    addConstant(String.valueOf(x).replace("String_Node_Str","String_Node_Str").replaceFirst("String_Node_Str","String_Node_Str"));
  }
}

Fixed version (ground truth):
void addNumber(double x){
  char prev=getLastChar();
  boolean negativeZero=isNegativeZero(x);
  if ((x < 0 || negativeZero) && prev == '-') {
    add("String_Node_Str");
  }
  if (negativeZero) {
    addConstant("String_Node_Str");
  }
 else   if ((long)x == x) {
    long value=(long)x;
    long mantissa=value;
    int exp=0;
    if (Math.abs(x) >= 100) {
      while (mantissa / 10 * ((long)Math.pow(10,exp + 1)) == value) {
        mantissa/=10;
        exp++;
      }
    }
    if (exp > 2) {
      addConstant(Long.toString(mantissa) + "String_Node_Str" + Integer.toString(exp));
    }
 else {
      long valueAbs=Math.abs(value);
      if (valueAbs > 1000000000000L && Long.toHexString(valueAbs).length() + 2 < Long.toString(valueAbs).length()) {
        addConstant((value < 0 ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + Long.toHexString(valueAbs));
      }
 else {
        addConstant(Long.toString(value));
      }
    }
  }
 else {
    addConstant(String.valueOf(x).replace("String_Node_Str","String_Node_Str").replaceFirst("String_Node_Str","String_Node_Str"));
  }
}
Program: 27668
Project: 27668
Buggy source:
public void testExponents(){
  assertPrintNumber("String_Node_Str",1);
  assertPrintNumber("String_Node_Str",10);
  assertPrintNumber("String_Node_Str",100);
  assertPrintNumber("String_Node_Str",1000);
  assertPrintNumber("String_Node_Str",10000);
  assertPrintNumber("String_Node_Str",100000);
  assertPrintNumber("String_Node_Str",-1);
  assertPrintNumber("String_Node_Str",-10);
  assertPrintNumber("String_Node_Str",-100);
  assertPrintNumber("String_Node_Str",-1000);
  assertPrintNumber("String_Node_Str",-123412340000L);
  assertPrintNumber("String_Node_Str",1000000000000000000L);
  assertPrintNumber("String_Node_Str",100000.0);
  assertPrintNumber("String_Node_Str",100000.1);
  assertPrintNumber("String_Node_Str",0.000001);
  assertPrintNumber("String_Node_Str",-0x38d7ea4c68001L);
  assertPrintNumber("String_Node_Str",0x38d7ea4c68001L);
  assertPrintNumber("String_Node_Str",-1.01);
  assertPrintNumber("String_Node_Str",-0.01);
  assertPrintNumber("String_Node_Str",0.01);
  assertPrintNumber("String_Node_Str",1.01);
}

Fixed version (ground truth):
public void testExponents(){
  assertPrintNumber("String_Node_Str",1);
  assertPrintNumber("String_Node_Str",10);
  assertPrintNumber("String_Node_Str",100);
  assertPrintNumber("String_Node_Str",1000);
  assertPrintNumber("String_Node_Str",10000);
  assertPrintNumber("String_Node_Str",100000);
  assertPrintNumber("String_Node_Str",-1);
  assertPrintNumber("String_Node_Str",-10);
  assertPrintNumber("String_Node_Str",-100);
  assertPrintNumber("String_Node_Str",-1000);
  assertPrintNumber("String_Node_Str",-123412340000L);
  assertPrintNumber("String_Node_Str",1000000000000000000L);
  assertPrintNumber("String_Node_Str",100000.0);
  assertPrintNumber("String_Node_Str",100000.1);
  assertPrintNumber("String_Node_Str",0.000001);
  assertPrintNumber("String_Node_Str",-0x38d7ea4c68001L);
  assertPrintNumber("String_Node_Str",0x38d7ea4c68001L);
  assertPrintNumber("String_Node_Str",0x7fffffffffffffffL);
  assertPrintNumber("String_Node_Str",-1.01);
  assertPrintNumber("String_Node_Str",-0.01);
  assertPrintNumber("String_Node_Str",0.01);
  assertPrintNumber("String_Node_Str",1.01);
}
Program: 27669
Project: 27669
Buggy source:
private static JSType pickReqObjType(Node expr){
  int exprKind=expr.getType();
switch (exprKind) {
case Token.GETELEM:
case Token.IN:
    return JSType.TOP_DICT;
case Token.FOR:
  Preconditions.checkState(NodeUtil.isForIn(expr));
return JSType.TOP_DICT;
case Token.OBJECTLIT:
{
JSDocInfo jsdoc=expr.getJSDocInfo();
if (jsdoc != null && jsdoc.makesStructs()) {
  return JSType.TOP_STRUCT;
}
if (jsdoc != null && jsdoc.makesDicts()) {
  return JSType.TOP_DICT;
}
return JSType.TOP_OBJECT;
}
default :
{
Node parent=expr.getParent();
if (parent.isGetProp()) {
return JSType.TOP_STRUCT;
}
if (parent.isGetElem()) {
return JSType.TOP_DICT;
}
throw new RuntimeException("String_Node_Str" + Token.name(exprKind));
}
}
}

Fixed version (ground truth):
private static JSType pickReqObjType(Node expr){
  int exprKind=expr.getType();
switch (exprKind) {
case Token.GETPROP:
    return JSType.TOP_STRUCT;
case Token.GETELEM:
case Token.IN:
  return JSType.TOP_DICT;
case Token.FOR:
Preconditions.checkState(NodeUtil.isForIn(expr));
return JSType.TOP_DICT;
case Token.OBJECTLIT:
{
JSDocInfo jsdoc=expr.getJSDocInfo();
if (jsdoc != null && jsdoc.makesStructs()) {
return JSType.TOP_STRUCT;
}
if (jsdoc != null && jsdoc.makesDicts()) {
return JSType.TOP_DICT;
}
return JSType.TOP_OBJECT;
}
default :
throw new RuntimeException("String_Node_Str" + Token.name(exprKind));
}
}
Program: 27671
Project: 27671
Buggy source:
private EnvTypePair analyzePropAccessBwd(Node receiver,String pname,TypeEnv outEnv,JSType requiredType){
  QualifiedName qname=new QualifiedName(pname);
  EnvTypePair pair=analyzeExprBwd(receiver,outEnv,pickReqObjType(receiver).withLoose().withProperty(qname,requiredType));
  JSType receiverType=pair.type;
  JSType propAccessType=receiverType.mayHaveProp(qname) ? receiverType.getProp(qname) : requiredType;
  pair.type=propAccessType;
  return pair;
}

Fixed version (ground truth):
private EnvTypePair analyzePropAccessBwd(Node receiver,String pname,TypeEnv outEnv,JSType requiredType){
  QualifiedName qname=new QualifiedName(pname);
  EnvTypePair pair=analyzeExprBwd(receiver,outEnv,pickReqObjType(receiver.getParent()).withLoose().withProperty(qname,requiredType));
  JSType receiverType=pair.type;
  JSType propAccessType=receiverType.mayHaveProp(qname) ? receiverType.getProp(qname) : requiredType;
  pair.type=propAccessType;
  return pair;
}
Program: 27673
Project: 27673
Buggy source:
private LValueResultBwd analyzePropLValBwd(Node obj,QualifiedName pname,TypeEnv outEnv,JSType type,boolean doSlicing){
  Preconditions.checkArgument(pname.isIdentifier());
  JSType reqObjType=pickReqObjType(obj).withLoose().withProperty(pname,type);
  LValueResultBwd lvalue=analyzeLValueBwd(obj,outEnv,reqObjType,false,true);
  if (lvalue.ptr != null) {
    lvalue.ptr=QualifiedName.join(lvalue.ptr,pname);
    if (doSlicing) {
      String objName=lvalue.ptr.getLeftmostName();
      QualifiedName props=lvalue.ptr.getAllButLeftmost();
      JSType objType=envGetType(lvalue.env,objName);
      JSType slicedObjType=objType.withoutProperty(props);
      lvalue.env=envPutType(lvalue.env,objName,slicedObjType);
    }
  }
  lvalue.type=lvalue.type.mayHaveProp(pname) ? lvalue.type.getProp(pname) : JSType.UNKNOWN;
  return lvalue;
}

Fixed version (ground truth):
private LValueResultBwd analyzePropLValBwd(Node obj,QualifiedName pname,TypeEnv outEnv,JSType type,boolean doSlicing){
  Preconditions.checkArgument(pname.isIdentifier());
  JSType reqObjType=pickReqObjType(obj.getParent()).withLoose().withProperty(pname,type);
  LValueResultBwd lvalue=analyzeLValueBwd(obj,outEnv,reqObjType,false,true);
  if (lvalue.ptr != null) {
    lvalue.ptr=QualifiedName.join(lvalue.ptr,pname);
    if (doSlicing) {
      String objName=lvalue.ptr.getLeftmostName();
      QualifiedName props=lvalue.ptr.getAllButLeftmost();
      JSType objType=envGetType(lvalue.env,objName);
      JSType slicedObjType=objType.withoutProperty(props);
      lvalue.env=envPutType(lvalue.env,objName,slicedObjType);
    }
  }
  lvalue.type=lvalue.type.mayHaveProp(pname) ? lvalue.type.getProp(pname) : JSType.UNKNOWN;
  return lvalue;
}
Program: 27674
Project: 27674
Buggy source:
public void testGetElem(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
public void testGetElem(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  checkNoWarnings("String_Node_Str");
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 27675
Project: 27675
Buggy source:
/** 
 * Translates an Ant Path into the file list format that the compiler expects.
 */
private List<SourceFile> findJavaScriptFiles(Path path){
  List<SourceFile> files=Lists.newArrayList();
  for (  String included : path.list()) {
    files.add(SourceFile.fromFile(new File(included),Charset.forName(encoding)));
  }
  return files;
}

Fixed version (ground truth):
/** 
 * Translates an Ant resource collection into the file list format that  the compiler expects.
 */
private List<SourceFile> findJavaScriptFiles(ResourceCollection rc){
  List<SourceFile> files=Lists.newLinkedList();
  Iterator<Resource> iter=rc.iterator();
  while (iter.hasNext()) {
    FileResource fr=iter.next().as(FileResource.class);
    File file=Paths.get("String_Node_Str").toAbsolutePath().relativize(fr.getFile().toPath()).toFile();
    files.add(SourceFile.fromFile(file,Charset.forName(encoding)));
  }
  return files;
}
Program: 27677
Project: 27677
Buggy source:
private JSType getTypeAtPropDeclNode(Node declNode,JSDocInfo jsdoc){
  Node initializer=NodeUtil.getInitializer(declNode);
  if (initializer != null && initializer.isFunction()) {
    return JSType.fromFunctionType(currentScope.getScope(getFunInternalName(initializer)).getDeclaredType().toFunctionType());
  }
  EnumType et=currentScope.getEnum(declNode.getQualifiedName());
  if (et != null) {
    return et.toJSType();
  }
  return getTypeDeclarationFromJsdoc(jsdoc,currentScope);
}

Fixed version (ground truth):
private JSType getTypeAtPropDeclNode(Node declNode,JSDocInfo jsdoc){
  Preconditions.checkArgument(!currentScope.isNamespace(declNode));
  Node initializer=NodeUtil.getInitializer(declNode);
  if (initializer != null && initializer.isFunction()) {
    return JSType.fromFunctionType(currentScope.getScope(getFunInternalName(initializer)).getDeclaredType().toFunctionType());
  }
  return getTypeDeclarationFromJsdoc(jsdoc,currentScope);
}
Program: 27678
Project: 27678
Buggy source:
private void visitConstructorPropertyDeclaration(Node getProp){
  Preconditions.checkArgument(getProp.isGetProp());
  String ctorName=getProp.getFirstChild().getQualifiedName();
  QualifiedName ctorQname=QualifiedName.fromNode(getProp.getFirstChild());
  Preconditions.checkState(currentScope.isLocalFunDef(ctorName));
  RawNominalType classType=currentScope.getNominalType(ctorQname);
  String pname=getProp.getLastChild().getString();
  JSDocInfo jsdoc=NodeUtil.getBestJSDocInfo(getProp);
  JSType propDeclType=getTypeAtPropDeclNode(getProp,jsdoc);
  boolean isConst=isConst(getProp);
  if (propDeclType != null || isConst) {
    JSType previousPropType=classType.getCtorPropDeclaredType(pname);
    if (classType.hasCtorProp(pname) && previousPropType != null && !suppressDupPropWarning(jsdoc,propDeclType,previousPropType)) {
      warnings.add(JSError.make(getProp,REDECLARED_PROPERTY,pname,classType.toString()));
      return;
    }
    if (isConst && !mayWarnAboutNoInit(getProp) && propDeclType == null) {
      propDeclType=inferConstTypeFromRhs(getProp);
    }
    classType.addCtorProperty(pname,propDeclType,isConst);
    getProp.putBooleanProp(Node.ANALYZED_DURING_GTI,true);
    if (isConst) {
      getProp.putBooleanProp(Node.CONSTANT_PROPERTY_DEF,true);
    }
  }
 else {
    classType.addUndeclaredCtorProperty(pname);
  }
}

Fixed version (ground truth):
private void visitConstructorPropertyDeclaration(Node getProp){
  Preconditions.checkArgument(getProp.isGetProp());
  if (isNamedType(getProp)) {
    return;
  }
  String ctorName=getProp.getFirstChild().getQualifiedName();
  QualifiedName ctorQname=QualifiedName.fromNode(getProp.getFirstChild());
  Preconditions.checkState(currentScope.isLocalFunDef(ctorName));
  RawNominalType classType=currentScope.getNominalType(ctorQname);
  String pname=getProp.getLastChild().getString();
  JSDocInfo jsdoc=NodeUtil.getBestJSDocInfo(getProp);
  JSType propDeclType=getTypeAtPropDeclNode(getProp,jsdoc);
  boolean isConst=isConst(getProp);
  if (propDeclType != null || isConst) {
    JSType previousPropType=classType.getCtorPropDeclaredType(pname);
    if (classType.hasCtorProp(pname) && previousPropType != null && !suppressDupPropWarning(jsdoc,propDeclType,previousPropType)) {
      warnings.add(JSError.make(getProp,REDECLARED_PROPERTY,pname,classType.toString()));
      return;
    }
    if (isConst && !mayWarnAboutNoInit(getProp) && propDeclType == null) {
      propDeclType=inferConstTypeFromRhs(getProp);
    }
    classType.addCtorProperty(pname,propDeclType,isConst);
    getProp.putBooleanProp(Node.ANALYZED_DURING_GTI,true);
    if (isConst) {
      getProp.putBooleanProp(Node.CONSTANT_PROPERTY_DEF,true);
    }
  }
 else {
    classType.addUndeclaredCtorProperty(pname);
  }
}
Program: 27679
Project: 27679
Buggy source:
public void testEnumsAsNamespaces(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OBJLIT_PROPERTY_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OBJLIT_PROPERTY_TYPE);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
public void testEnumsAsNamespaces(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OBJLIT_PROPERTY_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OBJLIT_PROPERTY_TYPE);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeCheck.CONSTRUCTOR_NOT_CALLABLE);
}
Program: 27683
Project: 27683
Buggy source:
static FunctionType meet(FunctionType f1,FunctionType f2){
  if (f1 == null || f2 == null) {
    return null;
  }
 else   if (f2.isTopFunction() || f1.equals(f2)) {
    return f1;
  }
 else   if (f1.isTopFunction()) {
    return f2;
  }
  if (f1.isLoose() || f2.isLoose()) {
    return FunctionType.looseJoin(f1,f2);
  }
  FunctionTypeBuilder builder=new FunctionTypeBuilder();
  int minRequiredArity=Math.min(f1.requiredFormals.size(),f2.requiredFormals.size());
  for (int i=0; i < minRequiredArity; i++) {
    builder.addReqFormal(JSType.nullAcceptingJoin(f1.getFormalType(i),f2.getFormalType(i)));
  }
  int maxTotalArity=Math.max(f1.requiredFormals.size() + f1.optionalFormals.size(),f2.requiredFormals.size() + f2.optionalFormals.size());
  for (int i=minRequiredArity; i < maxTotalArity; i++) {
    builder.addOptFormal(JSType.nullAcceptingJoin(f1.getFormalType(i),f2.getFormalType(i)));
  }
  if (f1.restFormals != null || f2.restFormals != null) {
    builder.addRestFormals(JSType.nullAcceptingJoin(f1.restFormals,f2.restFormals));
  }
  builder.addRetType(JSType.meet(f1.returnType,f2.returnType));
  builder.addNominalType(NominalType.pickSubclass(f1.nominalType,f2.nominalType));
  builder.addReceiverType(NominalType.pickSubclass(f1.receiverType,f2.receiverType));
  return builder.buildFunction();
}

Fixed version (ground truth):
static FunctionType meet(FunctionType f1,FunctionType f2){
  if (f1 == null || f2 == null) {
    return null;
  }
 else   if (f2.isTopFunction() || f1.equals(f2)) {
    return f1;
  }
 else   if (f1.isTopFunction()) {
    return f2;
  }
  if (f1.isLoose() || f2.isLoose()) {
    return FunctionType.looseJoin(f1,f2);
  }
  if (f1.isGeneric() && f1.isSubtypeOf(f2)) {
    return f1;
  }
 else   if (f2.isGeneric() && f2.isSubtypeOf(f1)) {
    return f2;
  }
  Preconditions.checkState(!f1.isGeneric());
  Preconditions.checkState(!f2.isGeneric());
  FunctionTypeBuilder builder=new FunctionTypeBuilder();
  int minRequiredArity=Math.min(f1.requiredFormals.size(),f2.requiredFormals.size());
  for (int i=0; i < minRequiredArity; i++) {
    builder.addReqFormal(JSType.nullAcceptingJoin(f1.getFormalType(i),f2.getFormalType(i)));
  }
  int maxTotalArity=Math.max(f1.requiredFormals.size() + f1.optionalFormals.size(),f2.requiredFormals.size() + f2.optionalFormals.size());
  for (int i=minRequiredArity; i < maxTotalArity; i++) {
    builder.addOptFormal(JSType.nullAcceptingJoin(f1.getFormalType(i),f2.getFormalType(i)));
  }
  if (f1.restFormals != null || f2.restFormals != null) {
    builder.addRestFormals(JSType.nullAcceptingJoin(f1.restFormals,f2.restFormals));
  }
  builder.addRetType(JSType.meet(f1.returnType,f2.returnType));
  builder.addNominalType(NominalType.pickSubclass(f1.nominalType,f2.nominalType));
  builder.addReceiverType(NominalType.pickSubclass(f1.receiverType,f2.receiverType));
  return builder.buildFunction();
}
Program: 27684
Project: 27684
Buggy source:
FunctionType specialize(FunctionType other){
  if (other == null || !this.isLoose() && other.isLoose()) {
    return this;
  }
 else {
    FunctionType result=FunctionType.meet(this,other);
    if (this.isLoose && !result.isLoose()) {
      result=result.withLoose();
    }
    return result;
  }
}

Fixed version (ground truth):
FunctionType specialize(FunctionType other){
  if (other == null || !this.isLoose() && other.isLoose()) {
    return this;
  }
  FunctionType result=FunctionType.meet(this,other);
  if (this.isLoose && !result.isLoose()) {
    result=result.withLoose();
  }
  return result;
}
Program: 27685
Project: 27685
Buggy source:
public void testInferConstTypeFromGenerics(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",GlobalTypeInfo.COULD_NOT_INFER_CONST_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",ImmutableList.of(GlobalTypeInfo.COULD_NOT_INFER_CONST_TYPE,NewTypeInference.NOT_UNIQUE_INSTANTIATION));
}

Fixed version (ground truth):
public void testInferConstTypeFromGenerics(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",GlobalTypeInfo.COULD_NOT_INFER_CONST_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",ImmutableList.of(GlobalTypeInfo.COULD_NOT_INFER_CONST_TYPE,NewTypeInference.NOT_UNIQUE_INSTANTIATION));
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",ImmutableList.of(GlobalTypeInfo.COULD_NOT_INFER_CONST_TYPE,TypeCheck.WRONG_ARGUMENT_COUNT));
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",ImmutableList.of(GlobalTypeInfo.COULD_NOT_INFER_CONST_TYPE,TypeCheck.WRONG_ARGUMENT_COUNT));
}
Program: 27686
Project: 27686
Buggy source:
public void testArrayLiteralUsedGenericallyDoesntCrash(){
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testArrayLiteralUsedGenericallyDoesntCrash(){
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 27687
Project: 27687
Buggy source:
/** 
 * Declares a variable.
 * @param s The scope to declare the variable in.
 * @param n The node corresponding to the variable name.
 */
private void declareVar(Scope s,Node n){
  Preconditions.checkState(n.isName() || n.isRest() || n.isStringKey());
  String name=n.getString();
  if (s.getVar(name) != null && s.getVar(name).getNode() == n) {
    return;
  }
  CompilerInput input=compiler.getInput(inputId);
  if (s.isDeclared(name,false) || (s.isLocal() && name.equals(ARGUMENTS))) {
    redeclarationHandler.onRedeclaration(s,name,n,input);
  }
 else {
    s.declare(name,n,null,input);
  }
}

Fixed version (ground truth):
/** 
 * Declares a variable.
 * @param s The scope to declare the variable in.
 * @param n The node corresponding to the variable name.
 */
private void declareVar(Scope s,Node n){
  Preconditions.checkState(n.isName() || n.isRest() || n.isStringKey(),"String_Node_Str",n);
  String name=n.getString();
  if (s.getVar(name) != null && s.getVar(name).getNode() == n) {
    return;
  }
  CompilerInput input=compiler.getInput(inputId);
  if (s.isDeclared(name,false) || (s.isLocal() && name.equals(ARGUMENTS))) {
    redeclarationHandler.onRedeclaration(s,name,n,input);
  }
 else {
    s.declare(name,n,null,input);
  }
}
Program: 27688
Project: 27688
Buggy source:
private void declareLHS(Scope declarationScope,Node lhs){
  if (lhs.isStringKey()) {
    if (lhs.hasChildren()) {
      declareLHS(declarationScope,lhs.getFirstChild());
    }
 else {
      declareVar(declarationScope,lhs);
    }
  }
 else   if (lhs.isName() || lhs.isRest()) {
    declareVar(declarationScope,lhs);
  }
 else   if (lhs.isDefaultValue()) {
    declareVar(declarationScope,lhs.getFirstChild());
  }
 else   if (lhs.isArrayPattern() || lhs.isObjectPattern()) {
    for (Node child=lhs.getFirstChild(); child != null; child=child.getNext()) {
      if (NodeUtil.isNameDeclaration(lhs.getParent()) && child.getNext() == null) {
        return;
      }
      declareLHS(declarationScope,child);
    }
  }
 else {
    Preconditions.checkState(lhs.isEmpty(),"String_Node_Str",lhs);
  }
}

Fixed version (ground truth):
private void declareLHS(Scope declarationScope,Node lhs){
  if (lhs.isStringKey()) {
    if (lhs.hasChildren()) {
      declareLHS(declarationScope,lhs.getFirstChild());
    }
 else {
      declareVar(declarationScope,lhs);
    }
  }
 else   if (lhs.isName() || lhs.isRest()) {
    declareVar(declarationScope,lhs);
  }
 else   if (lhs.isDefaultValue()) {
    declareLHS(declarationScope,lhs.getFirstChild());
  }
 else   if (lhs.isArrayPattern() || lhs.isObjectPattern()) {
    for (Node child=lhs.getFirstChild(); child != null; child=child.getNext()) {
      if (NodeUtil.isNameDeclaration(lhs.getParent()) && child.getNext() == null) {
        return;
      }
      declareLHS(declarationScope,child);
    }
  }
 else {
    Preconditions.checkState(lhs.isEmpty(),"String_Node_Str",lhs);
  }
}
Program: 27689
Project: 27689
Buggy source:
/** 
 * For each node, update the block stack and reference collection as appropriate.
 */
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName()) {
    Var v;
    if (n.getString().equals("String_Node_Str")) {
      v=t.getScope().getArgumentsVar();
    }
 else {
      v=t.getScope().getVar(n.getString());
    }
    if (v != null) {
      if (varFilter.apply(v)) {
        addReference(v,new Reference(n,t,peek(blockStack)));
      }
      if (v.getParentNode() != null && NodeUtil.isHoistedFunctionDeclaration(v.getParentNode()) && (narrowScope == null || narrowScope.getDepth() <= v.getScope().getDepth())) {
        outOfBandTraversal(v);
      }
    }
  }
  if (isBlockBoundary(n,parent)) {
    pop(blockStack);
  }
}

Fixed version (ground truth):
/** 
 * For each node, update the block stack and reference collection as appropriate.
 */
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName() || (n.isStringKey() && parent.isObjectPattern() && !n.hasChildren())) {
    Var v;
    if (n.getString().equals("String_Node_Str")) {
      v=t.getScope().getArgumentsVar();
    }
 else {
      v=t.getScope().getVar(n.getString());
    }
    if (v != null) {
      if (varFilter.apply(v)) {
        addReference(v,new Reference(n,t,peek(blockStack)));
      }
      if (v.getParentNode() != null && NodeUtil.isHoistedFunctionDeclaration(v.getParentNode()) && (narrowScope == null || narrowScope.getDepth() <= v.getScope().getDepth())) {
        outOfBandTraversal(v);
      }
    }
  }
  if (isBlockBoundary(n,parent)) {
    pop(blockStack);
  }
}
Program: 27690
Project: 27690
Buggy source:
boolean isDeclaration(){
  Node parent=getParent();
  if (parent.isClass() && nameNode != parent.getFirstChild()) {
    return false;
  }
  while (parent.isArrayPattern()) {
    parent=parent.getParent();
  }
  if (parent.isDefaultValue() && nameNode == parent.getFirstChild()) {
    return true;
  }
  return DECLARATION_PARENTS.contains(parent.getType());
}

Fixed version (ground truth):
boolean isDeclaration(){
  return isDeclarationHelper(nameNode);
}
Program: 27691
Project: 27691
Buggy source:
/** 
 * @param n The name node to check.
 * @param origVar The associated Var.
 * @return Whether duplicated declarations warnings should be suppressedfor the given node.
 */
static boolean hasDuplicateDeclarationSuppression(Node n,Scope.Var origVar){
  Preconditions.checkState(n.isName());
  Node parent=n.getParent();
  Node origParent=origVar.getParentNode();
  JSDocInfo info=n.getJSDocInfo();
  if (info == null) {
    info=parent.getJSDocInfo();
  }
  if (info != null && info.getSuppressions().contains("String_Node_Str")) {
    return true;
  }
  info=origVar.nameNode.getJSDocInfo();
  if (info == null) {
    info=origParent.getJSDocInfo();
  }
  return (info != null && info.getSuppressions().contains("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * @param n The name node to check.
 * @param origVar The associated Var.
 * @return Whether duplicated declarations warnings should be suppressedfor the given node.
 */
static boolean hasDuplicateDeclarationSuppression(Node n,Scope.Var origVar){
  Preconditions.checkState(n.isName() || n.isStringKey());
  Node parent=n.getParent();
  Node origParent=origVar.getParentNode();
  JSDocInfo info=n.getJSDocInfo();
  if (info == null) {
    info=parent.getJSDocInfo();
  }
  if (info != null && info.getSuppressions().contains("String_Node_Str")) {
    return true;
  }
  info=origVar.nameNode.getJSDocInfo();
  if (info == null) {
    info=origParent.getJSDocInfo();
  }
  return (info != null && info.getSuppressions().contains("String_Node_Str"));
}
Program: 27692
Project: 27692
Buggy source:
@Override Node processDefaultParameter(DefaultParameterTree tree){
  maybeWarnEs6Feature(tree,"String_Node_Str");
  Node lhs=transform(tree.lhs);
  if (tree.lhs instanceof ArrayLiteralExpressionTree) {
    lhs.setType(Token.ARRAY_PATTERN);
  }
  return newNode(Token.DEFAULT_VALUE,lhs,transform(tree.defaultValue));
}

Fixed version (ground truth):
@Override Node processDefaultParameter(DefaultParameterTree tree){
  maybeWarnEs6Feature(tree,"String_Node_Str");
  Node lhs=transform(tree.lhs);
  if (tree.lhs instanceof ArrayLiteralExpressionTree) {
    lhs.setType(Token.ARRAY_PATTERN);
  }
 else   if (tree.lhs instanceof ObjectLiteralExpressionTree) {
    lhs.setType(Token.OBJECT_PATTERN);
  }
  return newNode(Token.DEFAULT_VALUE,lhs,transform(tree.defaultValue));
}
Program: 27693
Project: 27693
Buggy source:
private ParseTree parsePatternElement(PatternKind kind,EnumSet<TokenType> follow){
  if (peekParenPattern(kind,follow)) {
    return parseParenPattern(kind);
  }
  boolean rest=false;
  SourcePosition start=getTreeStartLocation();
  if (peek(TokenType.SPREAD)) {
    eat(TokenType.SPREAD);
    rest=true;
  }
  ParseTree lvalue=parseLeftHandSideExpression();
  if ((rest || kind == PatternKind.INITIALIZER) && lvalue.type != ParseTreeType.IDENTIFIER_EXPRESSION) {
    reportError("String_Node_Str");
    return lvalue;
  }
  if (rest) {
    return new AssignmentRestElementTree(getTreeLocation(start),lvalue.asIdentifierExpression().identifierToken);
  }
  Token eq=eatOpt(TokenType.EQUAL);
  if (eq != null) {
    ParseTree defaultValue=parseAssignmentExpression();
    return new DefaultParameterTree(getTreeLocation(start),lvalue,defaultValue);
  }
  return lvalue;
}

Fixed version (ground truth):
private ParseTree parsePatternElement(PatternKind kind,EnumSet<TokenType> follow){
  if (peekParenPattern(kind,follow)) {
    return parseParenPattern(kind);
  }
  boolean rest=false;
  SourcePosition start=getTreeStartLocation();
  if (peek(TokenType.SPREAD)) {
    eat(TokenType.SPREAD);
    rest=true;
  }
  ParseTree lvalue=parseLeftHandSideExpression();
  if (rest && lvalue.type != ParseTreeType.IDENTIFIER_EXPRESSION) {
    reportError("String_Node_Str");
    return lvalue;
  }
  if (rest) {
    return new AssignmentRestElementTree(getTreeLocation(start),lvalue.asIdentifierExpression().identifierToken);
  }
  Token eq=eatOpt(TokenType.EQUAL);
  if (eq != null) {
    ParseTree defaultValue=parseAssignmentExpression();
    return new DefaultParameterTree(getTreeLocation(start),lvalue,defaultValue);
  }
  return lvalue;
}
Program: 27697
Project: 27697
Buggy source:
public void testParam(){
  builder.recordParameter("String_Node_Str",new JSTypeExpression(IR.string("String_Node_Str"),"String_Node_Str"));
  builder.recordParameter("String_Node_Str",new JSTypeExpression(IR.string("String_Node_Str"),"String_Node_Str"));
  JSDocInfo info=builder.build(null);
  assertEquals("String_Node_Str",JSDocInfoPrinter.print(info));
}

Fixed version (ground truth):
public void testParam(){
  builder.recordParameter("String_Node_Str",new JSTypeExpression(JsDocInfoParser.parseTypeString("String_Node_Str"),"String_Node_Str"));
  builder.recordParameter("String_Node_Str",new JSTypeExpression(JsDocInfoParser.parseTypeString("String_Node_Str"),"String_Node_Str"));
  JSDocInfo info=builder.build(null);
  assertEquals("String_Node_Str",JSDocInfoPrinter.print(info));
  builder.recordParameter("String_Node_Str",new JSTypeExpression(new Node(Token.EQUALS,IR.string("String_Node_Str")),"String_Node_Str"));
  info=builder.build(null);
  assertEquals("String_Node_Str",JSDocInfoPrinter.print(info));
  builder.recordParameter("String_Node_Str",new JSTypeExpression(new Node(Token.ELLIPSIS,IR.string("String_Node_Str")),"String_Node_Str"));
  info=builder.build(null);
  assertEquals("String_Node_Str",JSDocInfoPrinter.print(info));
}
Program: 27700
Project: 27700
Buggy source:
@Override public void process(Node externs,Node root){
  if (addExtern) {
    addExternForGlobalSymbolNamespace();
  }
  NodeTraversal.traverse(compiler,root,new RewriteGlobalFunctionStatementsToVarAssignmentsCallback());
  List<Callback> nonMutatingPasses=new ArrayList<>();
  nonMutatingPasses.add(new FindCrossModuleNamesCallback());
  nonMutatingPasses.add(new FindNamesReferencingThis());
  CombinedCompilerPass.traverse(compiler,root,nonMutatingPasses);
  NodeTraversal.traverse(compiler,root,new RewriteScopeCallback());
  NodeTraversal.traverse(compiler,root,new RemoveGlobalVarCallback());
  NodeTraversal.traverse(compiler,root,new MakeExternsReferenceWindowExplicitly());
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  if (addExtern) {
    addExternForGlobalSymbolNamespace();
  }
  NodeTraversal.traverse(compiler,root,new RewriteGlobalFunctionStatementsToVarAssignmentsCallback());
  List<Callback> nonMutatingPasses=new ArrayList<>();
  nonMutatingPasses.add(new FindCrossModuleNamesCallback());
  nonMutatingPasses.add(new FindNamesReferencingThis());
  CombinedCompilerPass.traverse(compiler,root,nonMutatingPasses);
  RewriteScopeCallback rewriteScope=new RewriteScopeCallback();
  NodeTraversal.traverse(compiler,root,rewriteScope);
  NodeTraversal.traverse(compiler,root,new RemoveGlobalVarCallback());
  rewriteScope.declareModuleGlobals();
  NodeTraversal.traverse(compiler,root,new MakeExternsReferenceWindowExplicitly());
}
Program: 27701
Project: 27701
Buggy source:
private void replaceSymbol(Node node,String name,CompilerInput input){
  Node parent=node.getParent();
  boolean isCrossModule=isCrossModuleName(name);
  if (!isCrossModule) {
    if (!parent.isVar()) {
      return;
    }
    boolean hasCrossModuleChildren=false;
    for (    Node c : parent.children()) {
      if (!c.isName() || isCrossModuleName(c.getString())) {
        hasCrossModuleChildren=true;
        break;
      }
    }
    if (!hasCrossModuleChildren) {
      return;
    }
  }
  Node replacement=isCrossModule ? IR.getprop(IR.name(globalSymbolNamespace).srcref(node),IR.string(name).srcref(node)) : IR.name(name).srcref(node);
  replacement.srcref(node);
  if (node.hasChildren()) {
    Node assign=IR.assign(replacement,node.removeFirstChild());
    parent.replaceChild(node,assign);
  }
 else   if (isCrossModule) {
    parent.replaceChild(node,replacement);
    if (parent.isCall() && !maybeReferencesThis.contains(name)) {
      parent.putBooleanProp(Node.FREE_CALL,false);
    }
  }
  if (!isCrossModule && parent.isVar()) {
    input.getAstRoot(compiler).addChildToFront(IR.var(IR.name(name).srcref(node)).srcref(node));
  }
  compiler.reportCodeChange();
}

Fixed version (ground truth):
private void replaceSymbol(Node node,String name,CompilerInput input){
  Node parent=node.getParent();
  boolean isCrossModule=isCrossModuleName(name);
  if (!isCrossModule) {
    if (!parent.isVar()) {
      return;
    }
    boolean hasCrossModuleChildren=false;
    for (    Node c : parent.children()) {
      if (!c.isName() || isCrossModuleName(c.getString())) {
        hasCrossModuleChildren=true;
        break;
      }
    }
    if (!hasCrossModuleChildren) {
      return;
    }
  }
  Node replacement=isCrossModule ? IR.getprop(IR.name(globalSymbolNamespace).srcref(node),IR.string(name).srcref(node)) : IR.name(name).srcref(node);
  replacement.srcref(node);
  if (node.hasChildren()) {
    Node assign=IR.assign(replacement,node.removeFirstChild());
    parent.replaceChild(node,assign);
  }
 else   if (isCrossModule) {
    parent.replaceChild(node,replacement);
    if (parent.isCall() && !maybeReferencesThis.contains(name)) {
      parent.putBooleanProp(Node.FREE_CALL,false);
    }
  }
  if (!isCrossModule && parent.isVar()) {
    preDeclarations.add(new ModuleGlobal(input.getAstRoot(compiler),IR.name(name).srcref(node)));
  }
  compiler.reportCodeChange();
}
Program: 27702
Project: 27702
Buggy source:
public void testVarDeclarations_acrossModules(){
  assumeCrossModuleNames=false;
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
}

Fixed version (ground truth):
public void testVarDeclarations_acrossModules(){
  assumeCrossModuleNames=false;
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
  test(createModules("String_Node_Str","String_Node_Str"),new String[]{"String_Node_Str","String_Node_Str"});
}
Program: 27703
Project: 27703
Buggy source:
private void resolveTypedefs(JSTypeCreatorFromJSDoc typeParser){
  for (  Map.Entry<String,Typedef> entry : localTypedefs.entrySet()) {
    String name=entry.getKey();
    Typedef td=entry.getValue();
    if (!td.isResolved()) {
      typeParser.resolveTypedef(name,this);
    }
  }
}

Fixed version (ground truth):
private void resolveTypedefs(JSTypeCreatorFromJSDoc typeParser){
  for (  Typedef td : localTypedefs.values()) {
    if (!td.isResolved()) {
      typeParser.resolveTypedef(td,this);
    }
  }
}
Program: 27704
Project: 27704
Buggy source:
private void addEnum(Node qnameNode,EnumType e){
  if (qnameNode.isName()) {
    Preconditions.checkState(!localEnums.containsKey(qnameNode.getString()));
    localEnums.put(qnameNode.getString(),e);
  }
 else {
    Preconditions.checkState(!isDefined(qnameNode));
    QualifiedName qname=QualifiedName.fromGetprop(qnameNode);
    Namespace ns=getNamespace(qname.getLeftmostName());
    ns.addEnum(qname.getAllButLeftmost(),e);
  }
}

Fixed version (ground truth):
private void addEnum(Node qnameNode,EnumType e){
  if (qnameNode.isName()) {
    Preconditions.checkState(!localEnums.containsKey(qnameNode.getString()));
    localEnums.put(qnameNode.getString(),e);
  }
 else {
    Preconditions.checkState(!isDefined(qnameNode));
    QualifiedName qname=QualifiedName.fromGetprop(qnameNode);
    Namespace ns=getNamespace(qname.getLeftmostName());
    ns.addEnum(qname.getAllButLeftmost(),e);
    qualifiedEnums.add(e);
  }
}
Program: 27705
Project: 27705
Buggy source:
private void removeTmpData(){
  Iterator<String> it=localFunDefs.keySet().iterator();
  while (it.hasNext()) {
    String name=it.next();
    if (name.contains("String_Node_Str")) {
      it.remove();
    }
  }
  for (  Map.Entry<String,NamespaceLit> entry : localNamespaces.entrySet()) {
    locals.put(entry.getKey(),entry.getValue().toJSType());
  }
  localNamespaces=null;
  localClassDefs=null;
  localTypedefs=null;
}

Fixed version (ground truth):
private void removeTmpData(){
  Iterator<String> it=localFunDefs.keySet().iterator();
  while (it.hasNext()) {
    String name=it.next();
    if (name.contains("String_Node_Str")) {
      it.remove();
    }
  }
  for (  Map.Entry<String,NamespaceLit> entry : localNamespaces.entrySet()) {
    locals.put(entry.getKey(),entry.getValue().toJSType());
  }
  for (  Map.Entry<String,EnumType> entry : localEnums.entrySet()) {
    locals.put(entry.getKey(),entry.getValue().toJSType());
  }
  localNamespaces=null;
  localClassDefs=null;
  localTypedefs=null;
  localEnums=null;
}
Program: 27706
Project: 27706
Buggy source:
private void resolveEnums(JSTypeCreatorFromJSDoc typeParser){
  for (  Map.Entry<String,EnumType> entry : localEnums.entrySet()) {
    String name=entry.getKey();
    EnumType e=entry.getValue();
    if (!e.isResolved()) {
      typeParser.resolveEnum(name,this);
    }
    locals.put(name,e.getObjLitType());
  }
}

Fixed version (ground truth):
private void resolveEnums(JSTypeCreatorFromJSDoc typeParser){
  for (  EnumType e : localEnums.values()) {
    if (!e.isResolved()) {
      typeParser.resolveEnum(e,this);
    }
  }
  for (  EnumType e : qualifiedEnums) {
    if (!e.isResolved()) {
      typeParser.resolveEnum(e,this);
    }
  }
  qualifiedEnums=null;
}
Program: 27707
Project: 27707
Buggy source:
private EnvTypePair analyzeAssignFwd(Node expr,TypeEnv inEnv,JSType requiredType,JSType specializedType){
  mayWarnAboutConst(expr);
  Node lhs=expr.getFirstChild();
  Node rhs=expr.getLastChild();
  LValueResultFwd lvalue=analyzeLValueFwd(lhs,inEnv,requiredType);
  JSType declType=lvalue.declType;
  EnvTypePair rhsPair=analyzeExprFwd(rhs,lvalue.env,requiredType,specializedType);
  if (declType != null && !rhsPair.type.isSubtypeOf(declType)) {
    warnings.add(JSError.make(expr,MISTYPED_ASSIGN_RHS,declType.toString(),rhsPair.type.toString()));
  }
 else {
    rhsPair.env=updateLvalueTypeInEnv(rhsPair.env,lhs,lvalue.ptr,rhsPair.type);
  }
  return rhsPair;
}

Fixed version (ground truth):
private EnvTypePair analyzeAssignFwd(Node expr,TypeEnv inEnv,JSType requiredType,JSType specializedType){
  mayWarnAboutConst(expr);
  Node lhs=expr.getFirstChild();
  Node rhs=expr.getLastChild();
  LValueResultFwd lvalue=analyzeLValueFwd(lhs,inEnv,requiredType);
  JSType declType=lvalue.declType;
  if (NodeUtil.isEnumDecl(expr) && rhs.isObjectLit()) {
    return analyzeEnumObjLitFwd(rhs,lvalue.env,lvalue.type);
  }
  EnvTypePair rhsPair=analyzeExprFwd(rhs,lvalue.env,requiredType,specializedType);
  if (declType != null && !rhsPair.type.isSubtypeOf(declType)) {
    warnings.add(JSError.make(expr,MISTYPED_ASSIGN_RHS,declType.toString(),rhsPair.type.toString()));
  }
 else {
    rhsPair.env=updateLvalueTypeInEnv(rhsPair.env,lhs,lvalue.ptr,rhsPair.type);
  }
  return rhsPair;
}