nus-yam/ex-repair huggingface dataset:
Program: 19252
Project: 19252
Buggy source:
/** 
 * @param value The value to use when rewriting.
 * @param depth The chain depth.
 * @param newNodes Expression nodes that have been updated.
 * @param prop The property to rewrite with value.
 */
private void rewriteAliasProp(Node value,int depth,Set<AstChange> newNodes,Name prop){
  rewriteAliasProps(prop,value,depth + 1,newNodes);
  List<Ref> refs=new ArrayList<>(prop.getRefs());
  for (  Ref ref : refs) {
    Node target=ref.node;
    for (int i=0; i <= depth; i++) {
      if (target.isGetProp()) {
        target=target.getFirstChild();
      }
 else       if (NodeUtil.isObjectLitKey(target)) {
        Node gparent=target.getGrandparent();
        if (gparent.isAssign()) {
          target=gparent.getFirstChild();
        }
 else {
          checkState(NodeUtil.isObjectLitKey(gparent));
          target=gparent;
        }
      }
 else {
        throw new IllegalStateException("String_Node_Str" + target);
      }
    }
    checkState(target.isGetProp() || target.isName());
    Node newValue=value.cloneTree();
    target.replaceWith(newValue);
    compiler.reportChangeToEnclosingScope(newValue);
    prop.removeRef(ref);
    newNodes.add(new AstChange(ref.module,ref.scope,ref.node));
    codeChanged=true;
  }
}

Fixed version (ground truth):
/** 
 * @param value The value to use when rewriting.
 * @param depth The chain depth.
 * @param newNodes Expression nodes that have been updated.
 * @param prop The property to rewrite with value.
 */
private void rewriteAliasProp(Node value,int depth,Set<AstChange> newNodes,Name prop){
  rewriteAliasProps(prop,value,depth + 1,newNodes);
  List<Ref> refs=new ArrayList<>(prop.getRefs());
  for (  Ref ref : refs) {
    Node target=ref.node;
    for (int i=0; i <= depth; i++) {
      if (target.isGetProp()) {
        target=target.getFirstChild();
      }
 else       if (NodeUtil.isObjectLitKey(target)) {
        Node gparent=target.getGrandparent();
        if (gparent.isAssign()) {
          target=gparent.getFirstChild();
        }
 else {
          checkState(NodeUtil.isObjectLitKey(gparent));
          target=gparent;
        }
      }
 else {
        throw new IllegalStateException("String_Node_Str" + target);
      }
    }
    checkState(target.isGetProp() || target.isName());
    Node newValue=value.cloneTree();
    target.replaceWith(newValue);
    compiler.reportChangeToEnclosingScope(newValue);
    prop.removeRef(ref);
    newNodes.add(new AstChange(ref.module,ref.scope,ref.node));
  }
}
Program: 19255
Project: 19255
Buggy source:
/** 
 * @param value The value to use when rewriting.
 * @param depth The chain depth.
 * @param newNodes Expression nodes that have been updated.
 * @param prop The property to rewrite with value.
 */
private void rewriteAliasProp(Node value,int depth,Set<AstChange> newNodes,Name prop){
  rewriteAliasProps(prop,value,depth + 1,newNodes);
  List<Ref> refs=new ArrayList<>(prop.getRefs());
  for (  Ref ref : refs) {
    Node target=ref.node;
    for (int i=0; i <= depth; i++) {
      if (target.isGetProp()) {
        target=target.getFirstChild();
      }
 else       if (NodeUtil.isObjectLitKey(target)) {
        Node gparent=target.getGrandparent();
        if (gparent.isAssign()) {
          target=gparent.getFirstChild();
        }
 else {
          checkState(NodeUtil.isObjectLitKey(gparent));
          target=gparent;
        }
      }
 else {
        throw new IllegalStateException("String_Node_Str" + target);
      }
    }
    checkState(target.isGetProp() || target.isName());
    Node newValue=value.cloneTree();
    target.replaceWith(newValue);
    compiler.reportChangeToEnclosingScope(newValue);
    prop.removeRef(ref);
    newNodes.add(new AstChange(ref.module,ref.scope,ref.node));
  }
}

Fixed version (ground truth):
/** 
 * @param value The value to use when rewriting.
 * @param depth The chain depth.
 * @param newNodes Expression nodes that have been updated.
 * @param prop The property to rewrite with value.
 */
private void rewriteAliasProp(Node value,int depth,Set<AstChange> newNodes,Name prop){
  rewriteAliasProps(prop,value,depth + 1,newNodes);
  List<Ref> refs=new ArrayList<>(prop.getRefs());
  for (  Ref ref : refs) {
    Node target=ref.node;
    for (int i=0; i <= depth; i++) {
      if (target.isGetProp()) {
        target=target.getFirstChild();
      }
 else       if (NodeUtil.isObjectLitKey(target)) {
        Node gparent=target.getGrandparent();
        if (gparent.isAssign()) {
          target=gparent.getFirstChild();
        }
 else {
          checkState(NodeUtil.isObjectLitKey(gparent));
          target=gparent;
        }
      }
 else {
        throw new IllegalStateException("String_Node_Str" + target);
      }
    }
    checkState(target.isGetProp() || target.isName());
    Node newValue=value.cloneTree();
    target.replaceWith(newValue);
    compiler.reportChangeToEnclosingScope(newValue);
    prop.removeRef(ref);
    newNodes.add(new AstChange(ref.module,ref.scope,ref.node));
    codeChanged=true;
  }
}
Program: 19257
Project: 19257
Buggy source:
@Override public ObjectTypeI withoutStrayProperties(){
  ObjectType obj=getObjTypeIfSingletonObj();
  NominalType nt=getNominalTypeIfSingletonObj();
  return nt.isLiteralObject() || obj.isPrototypeObject() || obj.isNamespace() ? this : nt.getInstanceAsJSType();
}

Fixed version (ground truth):
@Override public ObjectTypeI withoutStrayProperties(){
  ObjectType obj=getObjTypeIfSingletonObj();
  NominalType nt=getNominalTypeIfSingletonObj();
  if (nt.isLiteralObject()) {
    return this;
  }
  if (obj.isPrototypeObject()) {
    return obj.getOwnerFunction().getInstanceTypeOfCtor().getPrototypeObject();
  }
  if (obj.isNamespace()) {
    return obj.getNamespaceType();
  }
  return nt.getInstanceAsJSType();
}
Program: 19258
Project: 19258
Buggy source:
private void addNonUnionType(TypeI newType){
  if (skipAmbiguating || invalidatingTypes.isInvalidating(newType)) {
    skipAmbiguating=true;
    return;
  }
  if (!relatedTypes.get(getIntForType(newType))) {
    computeRelatedTypes(newType);
    relatedTypes.or(getRelatedTypesOnNonUnion(newType));
  }
}

Fixed version (ground truth):
private void addNonUnionType(TypeI newType){
  if (skipAmbiguating || invalidatingTypes.isInvalidating(newType)) {
    skipAmbiguating=true;
    return;
  }
  ObjectTypeI maybeObj=newType.toMaybeObjectType();
  if (maybeObj != null) {
    newType=maybeObj.withoutStrayProperties();
  }
  if (!relatedTypes.get(getIntForType(newType))) {
    computeRelatedTypes(newType);
    relatedTypes.or(getRelatedTypesOnNonUnion(newType));
  }
}
Program: 19259
Project: 19259
Buggy source:
private static boolean canMergeObjectsInJoin(ObjectType obj1,ObjectType obj2){
  if (obj1.isTopObject() || obj2.isTopObject()) {
    return true;
  }
  NominalType nt1=obj1.nominalType;
  NominalType nt2=obj2.nominalType;
  if ((nt1.isBuiltinObject() || nt1.isLiteralObject()) && (nt2.isBuiltinObject() || nt2.isLiteralObject())) {
    return true;
  }
  if (nt1.isBuiltinObject()) {
    return obj1.isLoose && obj2.isSubtypeOf(obj1,SubtypeCache.create());
  }
  if (nt2.isBuiltinObject()) {
    return obj2.isLoose && obj1.isSubtypeOf(obj2,SubtypeCache.create());
  }
  return areRelatedNominalTypes(nt1,nt2) || NominalType.equalRawTypes(nt1,nt2);
}

Fixed version (ground truth):
private static boolean canMergeObjectsInJoin(ObjectType obj1,ObjectType obj2){
  if (obj1.isTopObject() || obj2.isTopObject() || obj1.equals(obj2)) {
    return true;
  }
  NominalType nt1=obj1.nominalType;
  NominalType nt2=obj2.nominalType;
  if (!obj1.isPrototypeObject() && (nt1.isBuiltinObject() || nt1.isLiteralObject()) && !obj2.isPrototypeObject()&& (nt2.isBuiltinObject() || nt2.isLiteralObject())) {
    return true;
  }
  if (nt1.isBuiltinObject()) {
    return obj1.isLoose && obj2.isSubtypeOf(obj1,SubtypeCache.create());
  }
  if (nt2.isBuiltinObject()) {
    return obj2.isLoose && obj1.isSubtypeOf(obj2,SubtypeCache.create());
  }
  return !obj1.isPrototypeObject() && !obj2.isPrototypeObject() && (areRelatedNominalTypes(nt1,nt2) || NominalType.equalRawTypes(nt1,nt2));
}
Program: 19260
Project: 19260
Buggy source:
Set<JSType> getSubtypesWithProperty(String pname){
  if (mayHaveProp(pname)) {
    if (this.protoProps.containsKey(pname)) {
      return ImmutableSet.of(this.protoObject);
    }
 else {
      return ImmutableSet.of(getInstanceAsJSType());
    }
  }
  HashSet<JSType> typesWithProp=new HashSet<>();
  for (  RawNominalType subtype : this.subtypes) {
    typesWithProp.addAll(subtype.getSubtypesWithProperty(pname));
  }
  return typesWithProp;
}

Fixed version (ground truth):
Set<JSType> getSubtypesWithProperty(String pname){
  if (mayHaveProp(pname)) {
    if (this.protoProps.containsKey(pname)) {
      return ImmutableSet.of(this.protoObject);
    }
    return ImmutableSet.of(getInstanceAsJSType());
  }
  HashSet<JSType> typesWithProp=new HashSet<>();
  for (  RawNominalType subtype : this.subtypes) {
    typesWithProp.addAll(subtype.getSubtypesWithProperty(pname));
  }
  return typesWithProp;
}
Program: 19261
Project: 19261
Buggy source:
public void testGetAllVars2(){
  String fnString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Compiler compiler=new Compiler();
  compiler.setLifeCycleStage(LifeCycleStage.NORMALIZED);
  ScopeCreator scopeCreator=new Es6SyntacticScopeCreator(compiler);
  Node ast=parse(fnString);
  Node functionNode=getFunctionNode(fnString);
  Scope globalScope=Scope.createGlobalScope(ast);
  Scope functionScope=scopeCreator.createScope(functionNode,globalScope);
  Map<String,Var> allVariables=new HashMap<>();
  List<Var> orderedVars=new LinkedList<>();
  NodeUtil.getAllVarsDeclaredInFunction(allVariables,orderedVars,compiler,scopeCreator,functionScope);
  Set<String> keySet=new HashSet<>(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(keySet,allVariables.keySet());
}

Fixed version (ground truth):
public void testGetAllVars2(){
  String fnString="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  Compiler compiler=new Compiler();
  compiler.setLifeCycleStage(LifeCycleStage.NORMALIZED);
  ScopeCreator scopeCreator=new Es6SyntacticScopeCreator(compiler);
  Node ast=parse(fnString);
  Node functionNode=getFunctionNode(fnString);
  Scope globalScope=Scope.createGlobalScope(ast);
  Scope functionScope=scopeCreator.createScope(functionNode,globalScope);
  Map<String,Var> allVariables=new HashMap<>();
  List<Var> orderedVars=new ArrayList<>();
  NodeUtil.getAllVarsDeclaredInFunction(allVariables,orderedVars,compiler,scopeCreator,functionScope);
  Set<String> keySet=new HashSet<>(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(keySet,allVariables.keySet());
}
Program: 19262
Project: 19262
Buggy source:
public void testGetAllVars1(){
  String fnString="String_Node_Str";
  Compiler compiler=new Compiler();
  compiler.setLifeCycleStage(LifeCycleStage.NORMALIZED);
  ScopeCreator scopeCreator=new Es6SyntacticScopeCreator(compiler);
  Node ast=parse(fnString);
  Node functionNode=getFunctionNode(fnString);
  Scope globalScope=Scope.createGlobalScope(ast);
  Scope functionScope=scopeCreator.createScope(functionNode,globalScope);
  Map<String,Var> allVariables=new HashMap<>();
  List<Var> orderedVars=new LinkedList<>();
  NodeUtil.getAllVarsDeclaredInFunction(allVariables,orderedVars,compiler,scopeCreator,functionScope);
  Set<String> keySet=new HashSet<>(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(keySet,allVariables.keySet());
}

Fixed version (ground truth):
public void testGetAllVars1(){
  String fnString="String_Node_Str";
  Compiler compiler=new Compiler();
  compiler.setLifeCycleStage(LifeCycleStage.NORMALIZED);
  ScopeCreator scopeCreator=new Es6SyntacticScopeCreator(compiler);
  Node ast=parse(fnString);
  Node functionNode=getFunctionNode(fnString);
  Scope globalScope=Scope.createGlobalScope(ast);
  Scope functionScope=scopeCreator.createScope(functionNode,globalScope);
  Map<String,Var> allVariables=new HashMap<>();
  List<Var> orderedVars=new ArrayList<>();
  NodeUtil.getAllVarsDeclaredInFunction(allVariables,orderedVars,compiler,scopeCreator,functionScope);
  Set<String> keySet=new HashSet<>(Arrays.asList("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  assertEquals(keySet,allVariables.keySet());
}
Program: 19264
Project: 19264
Buggy source:
public void testInvalidGoogBase14(){
  testError("String_Node_Str",GOOG_BASE_CLASS_ERROR);
}

Fixed version (ground truth):
public void testInvalidGoogBase14(){
  testError("String_Node_Str",BASE_CLASS_ERROR);
}
Program: 19265
Project: 19265
Buggy source:
public void testInvalidGoogBase14b(){
  testError("String_Node_Str",GOOG_BASE_CLASS_ERROR);
}

Fixed version (ground truth):
public void testInvalidGoogBase14b(){
  testError("String_Node_Str",BASE_CLASS_ERROR);
}
Program: 19268
Project: 19268
Buggy source:
private EnvTypePair analyzePropertyTestCallFwd(Node call,TypeEnv inEnv,JSType specializedType){
  return analyzeTypePredicate(call,call.getFirstChild().getLastChild().getString(),inEnv,specializedType);
}

Fixed version (ground truth):
private EnvTypePair analyzePropertyTestCallFwd(Node call,TypeEnv inEnv,JSType specializedType){
  analyzeExprFwdIgnoreResult(call.getFirstChild(),inEnv);
  return analyzeTypePredicate(call,call.getFirstChild().getLastChild().getString(),inEnv,specializedType);
}
Program: 19269
Project: 19269
Buggy source:
private EnvTypePair analyzeTypePredicate(Node call,String typeHint,TypeEnv inEnv,JSType specializedType){
  int numArgs=call.getChildCount() - 1;
  if (numArgs != 1) {
    warnings.add(JSError.make(call,WRONG_ARGUMENT_COUNT,call.getFirstChild().getQualifiedName(),Integer.toString(numArgs),"String_Node_Str","String_Node_Str"));
    return analyzeInvocationArgsFwdWhenError(call,inEnv);
  }
  EnvTypePair pair=analyzeExprFwd(call.getLastChild(),inEnv);
  if (specializedType.isTrueOrTruthy() || specializedType.isFalseOrFalsy()) {
    pair=analyzeExprFwd(call.getLastChild(),inEnv,UNKNOWN,predicateTransformType(typeHint,specializedType,pair.type));
  }
  pair.type=BOOLEAN;
  return pair;
}

Fixed version (ground truth):
private EnvTypePair analyzeTypePredicate(Node call,String typeHint,TypeEnv inEnv,JSType specializedType){
  analyzeExprFwdIgnoreResult(call.getFirstChild(),inEnv);
  int numArgs=call.getChildCount() - 1;
  if (numArgs != 1) {
    warnings.add(JSError.make(call,WRONG_ARGUMENT_COUNT,call.getFirstChild().getQualifiedName(),Integer.toString(numArgs),"String_Node_Str","String_Node_Str"));
    return analyzeInvocationArgsFwdWhenError(call,inEnv);
  }
  EnvTypePair pair=analyzeExprFwd(call.getLastChild(),inEnv);
  if (specializedType.isTrueOrTruthy() || specializedType.isFalseOrFalsy()) {
    pair=analyzeExprFwd(call.getLastChild(),inEnv,UNKNOWN,predicateTransformType(typeHint,specializedType,pair.type));
  }
  pair.type=BOOLEAN;
  return pair;
}
Program: 19270
Project: 19270
Buggy source:
private EnvTypePair analyzeIncDecFwd(Node expr,TypeEnv inEnv,JSType requiredType){
  mayWarnAboutConst(expr);
  Node ch=expr.getFirstChild();
  if (ch.isGetProp() || (ch.isGetElem() && ch.getLastChild().isString())) {
    Node recv=ch.getFirstChild();
    String pname=ch.getLastChild().getString();
    EnvTypePair pair=analyzeExprFwd(recv,inEnv);
    JSType recvType=pair.type;
    if (mayWarnAboutConstProp(ch,recvType,new QualifiedName(pname))) {
      pair.type=requiredType;
      return pair;
    }
  }
  return analyzeUnaryNumFwd(expr,inEnv);
}

Fixed version (ground truth):
private EnvTypePair analyzeIncDecFwd(Node expr,TypeEnv inEnv,JSType requiredType){
  mayWarnAboutConst(expr);
  Node ch=expr.getFirstChild();
  if (ch.isGetProp() || (ch.isGetElem() && ch.getLastChild().isString())) {
    Node recv=ch.getFirstChild();
    String pname=ch.getLastChild().getString();
    EnvTypePair pair=analyzeExprFwd(recv,inEnv);
    JSType recvType=pair.type;
    if (mayWarnAboutConstProp(ch,recvType,new QualifiedName(pname))) {
      maybeSetTypeI(ch,recvType.getProp(new QualifiedName(pname)));
      pair.type=requiredType;
      return pair;
    }
  }
  return analyzeUnaryNumFwd(expr,inEnv);
}
Program: 19271
Project: 19271
Buggy source:
private EnvTypePair analyzeAssertionCall(Node callNode,TypeEnv env,AssertionFunctionSpec assertionFunctionSpec){
  Node firstParam=callNode.getSecondChild();
  if (firstParam == null) {
    return new EnvTypePair(env,UNKNOWN);
  }
  Node assertedNode=assertionFunctionSpec.getAssertedParam(firstParam);
  if (assertedNode == null) {
    return new EnvTypePair(env,UNKNOWN);
  }
  JSType assertedType=assertionFunctionSpec.getAssertedNewType(callNode,currentScope);
  if (assertedType.isUnknown()) {
    warnings.add(JSError.make(callNode,UNKNOWN_ASSERTION_TYPE));
  }
  EnvTypePair pair=analyzeExprFwd(assertedNode,env,UNKNOWN,assertedType);
  boolean haveCommonSubtype=JSType.haveCommonSubtype(assertedType,pair.type);
  if (!pair.type.isSubtypeOf(assertedType) && haveCommonSubtype) {
    pair.type=assertedType;
  }
  if (!haveCommonSubtype) {
    JSType t=analyzeExprFwd(assertedNode,env).type.substituteGenericsWithUnknown();
    if (t.isSubtypeOf(assertedType)) {
      pair.type=t;
    }
 else {
      if (!firstParam.isFalse()) {
        warnings.add(JSError.make(assertedNode,ASSERT_FALSE));
      }
      pair.type=UNKNOWN;
      pair.env=env;
    }
  }
  return pair;
}

Fixed version (ground truth):
private EnvTypePair analyzeAssertionCall(Node callNode,TypeEnv env,AssertionFunctionSpec assertionFunctionSpec){
  analyzeExprFwdIgnoreResult(callNode.getFirstChild(),env);
  Node firstParam=callNode.getSecondChild();
  if (firstParam == null) {
    return new EnvTypePair(env,UNKNOWN);
  }
  for (  Node assertionArgument : firstParam.siblings()) {
    analyzeExprFwdIgnoreResult(assertionArgument,env);
  }
  Node assertedNode=assertionFunctionSpec.getAssertedParam(firstParam);
  if (assertedNode == null) {
    return new EnvTypePair(env,UNKNOWN);
  }
  JSType assertedType=assertionFunctionSpec.getAssertedNewType(callNode,currentScope);
  if (assertedType.isUnknown()) {
    warnings.add(JSError.make(callNode,UNKNOWN_ASSERTION_TYPE));
  }
  EnvTypePair pair=analyzeExprFwd(assertedNode,env,UNKNOWN,assertedType);
  boolean haveCommonSubtype=JSType.haveCommonSubtype(assertedType,pair.type);
  if (!pair.type.isSubtypeOf(assertedType) && haveCommonSubtype) {
    pair.type=assertedType;
  }
  if (!haveCommonSubtype) {
    JSType t=analyzeExprFwd(assertedNode,env).type.substituteGenericsWithUnknown();
    if (t.isSubtypeOf(assertedType)) {
      pair.type=t;
    }
 else {
      if (!firstParam.isFalse()) {
        warnings.add(JSError.make(assertedNode,ASSERT_FALSE));
      }
      pair.type=UNKNOWN;
      pair.env=env;
    }
  }
  return pair;
}
Program: 19273
Project: 19273
Buggy source:
private boolean isFunctionBind(Node expr,TypeEnv env,boolean isFwd){
  if (NodeUtil.isFunctionBind(expr)) {
    return true;
  }
  if (!expr.isGetProp() || !expr.isQualifiedName() || !expr.getLastChild().getString().equals("String_Node_Str")) {
    return false;
  }
  Node recv=expr.getFirstChild();
  JSType recvType=isFwd ? analyzeExprFwd(recv,env).type : analyzeExprBwd(recv,env).type;
  return !recvType.isUnknown() && recvType.isSubtypeOf(commonTypes.topFunction());
}

Fixed version (ground truth):
private boolean isFunctionBind(Node callee,TypeEnv env,boolean isFwd){
  if (NodeUtil.isFunctionBind(callee)) {
    if (isFwd) {
      analyzeExprFwdIgnoreResult(callee,env);
    }
    return true;
  }
  if (!callee.isGetProp() || !callee.isQualifiedName() || !callee.getLastChild().getString().equals("String_Node_Str")) {
    return false;
  }
  Node recv=callee.getFirstChild();
  JSType recvType;
  if (isFwd) {
    recvType=analyzeExprFwd(recv,env).type;
    maybeSetTypeI(callee,recvType.getProp(new QualifiedName("String_Node_Str")));
  }
 else {
    recvType=analyzeExprBwd(recv,env).type;
  }
  return !recvType.isUnknown() && recvType.isSubtypeOf(commonTypes.topFunction());
}
Program: 19275
Project: 19275
Buggy source:
private EnvTypePair analyzeGoogTypeof(Node typeof,Node typeString,TypeEnv inEnv,JSType specializedType){
  return analyzeTypePredicate(typeof,typeString.isString() ? typeString.getString() : "String_Node_Str",inEnv,specializedType);
}

Fixed version (ground truth):
private EnvTypePair analyzeGoogTypeof(Node typeof,Node typeString,TypeEnv inEnv,JSType specializedType){
  analyzeExprFwdIgnoreResult(typeString,inEnv);
  return analyzeTypePredicate(typeof,typeString.isString() ? typeString.getString() : "String_Node_Str",inEnv,specializedType);
}
Program: 19276
Project: 19276
Buggy source:
static boolean isFunctionBind(Node expr){
  if (!expr.isGetProp()) {
    return false;
  }
  if (isGoogBind(expr) || isGoogPartial(expr)) {
    return true;
  }
  return expr.getFirstChild().isFunction() && expr.getLastChild().getString().equals("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Does not use type info. For example, it returns false for f.bind(...) because it cannot know whether f is a function.
 */
static boolean isFunctionBind(Node expr){
  if (!expr.isGetProp()) {
    return false;
  }
  if (isGoogBind(expr) || isGoogPartial(expr)) {
    return true;
  }
  return expr.getFirstChild().isFunction() && expr.getLastChild().getString().equals("String_Node_Str");
}
Program: 19277
Project: 19277
Buggy source:
public void testClosureStyleFunctionBind(){
  typeCheck("String_Node_Str",NewTypeInference.GOOG_BIND_EXPECTS_FUNCTION);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str"),NewTypeInference.WRONG_ARGUMENT_COUNT);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str"),NewTypeInference.WRONG_ARGUMENT_COUNT);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_THIS_TYPE_IN_BIND);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str");
  typeCheck("String_Node_Str");
}

Fixed version (ground truth):
public void testClosureStyleFunctionBind(){
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str"),NewTypeInference.GOOG_BIND_EXPECTS_FUNCTION);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str"),NewTypeInference.WRONG_ARGUMENT_COUNT);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str"),NewTypeInference.WRONG_ARGUMENT_COUNT);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_THIS_TYPE_IN_BIND);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str"));
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str"));
}
Program: 19278
Project: 19278
Buggy source:
public void testSuperClassCtorProperty() throws Exception {
  String CLOSURE_DEFS=LINE_JOINER.join("String_Node_Str","String_Node_Str");
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("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","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck(CLOSURE_DEFS + "String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck(CLOSURE_DEFS + "String_Node_Str",NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(CLOSURE_DEFS + "String_Node_Str");
}

Fixed version (ground truth):
public void testSuperClassCtorProperty() throws Exception {
  String CLOSURE_DEFS=LINE_JOINER.join("String_Node_Str","String_Node_Str");
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("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","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(CLOSURE_DEFS + LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck(CLOSURE_DEFS + "String_Node_Str",NewTypeInference.MISTYPED_ASSIGN_RHS);
  typeCheck(CLOSURE_DEFS + "String_Node_Str",NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(LINE_JOINER.join(CLOSURE_DEFS,"String_Node_Str"));
}
Program: 19279
Project: 19279
Buggy source:
public void testGoogIsPredicatesNoSpecializedContext(){
  typeCheck(CLOSURE_BASE + "String_Node_Str",NewTypeInference.WRONG_ARGUMENT_COUNT);
  typeCheck(CLOSURE_BASE + "String_Node_Str",NewTypeInference.WRONG_ARGUMENT_COUNT,NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(CLOSURE_BASE + "String_Node_Str");
}

Fixed version (ground truth):
public void testGoogIsPredicatesNoSpecializedContext(){
  typeCheck(CLOSURE_BASE + "String_Node_Str",NewTypeInference.WRONG_ARGUMENT_COUNT);
  typeCheck(CLOSURE_BASE + "String_Node_Str",NewTypeInference.WRONG_ARGUMENT_COUNT,NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str"));
}
Program: 19280
Project: 19280
Buggy source:
public void testSpecializeTypesAfterNullableDereference(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
}

Fixed version (ground truth):
public void testSpecializeTypesAfterNullableDereference(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.NULLABLE_DEREFERENCE);
}
Program: 19282
Project: 19282
Buggy source:
public void testInferThisInSimpleInferExprType(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("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.INVALID_OPERAND_TYPE);
}

Fixed version (ground truth):
public void testInferThisInSimpleInferExprType(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join(CLOSURE_BASE,"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.INVALID_OPERAND_TYPE);
}
Program: 19284
Project: 19284
Buggy source:
public static QualifiedName fromNode(Node qnameNode){
  if (qnameNode == null || !qnameNode.isQualifiedName()) {
    return null;
  }
  return qnameNode.isName() ? new QualifiedName(qnameNode.getString()) : new QualifiedName(ImmutableList.copyOf(Splitter.on('.').split(qnameNode.getQualifiedName())));
}

Fixed version (ground truth):
public static QualifiedName fromNode(Node qnameNode){
  if (qnameNode == null || !qnameNode.isQualifiedName()) {
    return null;
  }
  if (qnameNode.isGetProp()) {
    String pname=qnameNode.getLastChild().getString();
    return join(fromNode(qnameNode.getFirstChild()),new QualifiedName(pname));
  }
  return new QualifiedName(qnameNode.getQualifiedName());
}
Program: 19285
Project: 19285
Buggy source:
public final Node cloneTree(boolean cloneTypeExprs){
  Node result=cloneNode(cloneTypeExprs);
  Node firstChild=null;
  Node lastChild=null;
  if (this.hasChildren()) {
    for (Node n2=getFirstChild(); n2 != null; n2=n2.next) {
      Node n2clone=n2.cloneTree(cloneTypeExprs);
      n2clone.parent=result;
      if (firstChild == null) {
        firstChild=n2clone;
        lastChild=firstChild;
      }
 else {
        lastChild.next=n2clone;
        n2clone.previous=lastChild;
        lastChild=n2clone;
      }
    }
    firstChild.previous=lastChild;
    lastChild.next=null;
    result.first=firstChild;
  }
  return result;
}

Fixed version (ground truth):
@CheckReturnValue public final Node cloneTree(boolean cloneTypeExprs){
  Node result=cloneNode(cloneTypeExprs);
  Node firstChild=null;
  Node lastChild=null;
  if (this.hasChildren()) {
    for (Node n2=getFirstChild(); n2 != null; n2=n2.next) {
      Node n2clone=n2.cloneTree(cloneTypeExprs);
      n2clone.parent=result;
      if (firstChild == null) {
        firstChild=n2clone;
        lastChild=firstChild;
      }
 else {
        lastChild.next=n2clone;
        n2clone.previous=lastChild;
        lastChild=n2clone;
      }
    }
    firstChild.previous=lastChild;
    lastChild.next=null;
    result.first=firstChild;
  }
  return result;
}
Program: 19286
Project: 19286
Buggy source:
/** 
 * @return A detached clone of the Node, specifically excluding its children.
 */
protected Node cloneNode(boolean cloneTypeExprs){
  return copyNodeFields(new Node(token),cloneTypeExprs);
}

Fixed version (ground truth):
/** 
 * @return A detached clone of the Node, specifically excluding its children.
 */
@CheckReturnValue protected Node cloneNode(boolean cloneTypeExprs){
  return copyNodeFields(new Node(token),cloneTypeExprs);
}
Program: 19287
Project: 19287
Buggy source:
public final void addChildToBack(Node child){
  checkArgument(child.parent == null,"String_Node_Str",child,parent,this);
  checkArgument(child.next == null);
  checkArgument(child.previous == null);
  if (first == null) {
    child.previous=child;
    first=child;
  }
 else {
    Node last=first.previous;
    last.next=child;
    child.previous=last;
    first.previous=child;
  }
  child.parent=this;
}

Fixed version (ground truth):
public final void addChildToBack(Node child){
  checkArgument(child.parent == null,"String_Node_Str",child,child.parent,this);
  checkArgument(child.next == null);
  checkArgument(child.previous == null);
  if (first == null) {
    child.previous=child;
    first=child;
  }
 else {
    Node last=first.previous;
    last.next=child;
    child.previous=last;
    first.previous=child;
  }
  child.parent=this;
}
Program: 19288
Project: 19288
Buggy source:
/** 
 * @param fnNode The function to inspect.
 * @return Whether the function has parameters, var, or function declarations.
 */
private static boolean hasLocalNames(Node fnNode){
  Node block=NodeUtil.getFunctionBody(fnNode);
  return NodeUtil.getFunctionParameters(fnNode).hasChildren() || NodeUtil.has(block,new NodeUtil.MatchDeclaration(),new NodeUtil.MatchShallowStatement());
}

Fixed version (ground truth):
/** 
 * @param fnNode The function to inspect.
 * @return Whether the function has parameters, var/const/let, class, or function declarations.
 */
private static boolean hasLocalNames(Node fnNode){
  Node block=NodeUtil.getFunctionBody(fnNode);
  return NodeUtil.getFunctionParameters(fnNode).hasChildren() || NodeUtil.has(block,new NodeUtil.MatchDeclaration(),new NodeUtil.MatchShallowStatement());
}
Program: 19289
Project: 19289
Buggy source:
/** 
 * see   {@link #isClassDeclaration}
 */
public static boolean isClassDeclaration(Node n){
  return n.isClass() && isDeclarationParent(n.getParent());
}

Fixed version (ground truth):
/** 
 * see   {@link #isClassDeclaration}
 */
public static boolean isClassDeclaration(Node n){
  return n.isClass() && isDeclarationParent(n.getParent()) && isNamedClass(n);
}
Program: 19290
Project: 19290
Buggy source:
private static boolean isDeclarationParent(Node parent){
switch (parent.getToken()) {
case DECLARE:
    return true;
case EXPORT:
  return !parent.getBooleanProp(Node.EXPORT_DEFAULT);
default :
return isStatementParent(parent);
}
}

Fixed version (ground truth):
private static boolean isDeclarationParent(Node parent){
switch (parent.getToken()) {
case DECLARE:
case EXPORT:
    return true;
default :
  return isStatementParent(parent);
}
}
Program: 19291
Project: 19291
Buggy source:
/** 
 * Is this node a function declaration? A function declaration is a function that has a name that is added to the current scope (i.e. a function that is not part of a expression; see   {@link #isFunctionExpression}).
 */
public static boolean isFunctionDeclaration(Node n){
  return n.isFunction() && isDeclarationParent(n.getParent());
}

Fixed version (ground truth):
/** 
 * Is this node a function declaration? A function declaration is a function that has a name that is added to the current scope (i.e. a function that is not part of a expression; see   {@link #isFunctionExpression}).
 */
public static boolean isFunctionDeclaration(Node n){
  return n.isFunction() && isDeclarationParent(n.getParent()) && isNamedFunction(n);
}
Program: 19292
Project: 19292
Buggy source:
/** 
 * Splits ES6 export combined with a variable or function declaration.
 */
private void splitExportDeclaration(Node n){
  Node c=n.getFirstChild();
  if (NodeUtil.isNameDeclaration(c) || c.isClass()) {
    n.removeChild(c);
    Node exportSpecs=new Node(Token.EXPORT_SPECS).srcref(n);
    n.addChildToFront(exportSpecs);
    Iterable<Node> names;
    if (c.isClass()) {
      names=Collections.singleton(c.getFirstChild());
      n.getParent().addChildBefore(c,n);
      n.getParent().addChildBefore(new Node(Token.EMPTY).srcref(n),n);
    }
 else {
      names=NodeUtil.getLhsNodesOfDeclaration(c);
      for (      Node child : c.children()) {
        c.removeChild(child);
        Node newDeclaration=new Node(c.getToken(),child).srcref(n);
        n.getParent().addChildBefore(newDeclaration,n);
      }
    }
    for (    Node name : names) {
      Node exportSpec=new Node(Token.EXPORT_SPEC).srcref(name);
      exportSpec.addChildToFront(name.cloneNode());
      exportSpec.addChildToFront(name.cloneNode());
      exportSpecs.addChildToBack(exportSpec);
    }
    compiler.reportChangeToEnclosingScope(n.getParent());
  }
}

Fixed version (ground truth):
/** 
 * Splits ES6 export combined with a variable or function declaration.
 */
private void splitExportDeclaration(Node n){
  if (n.getBooleanProp(Node.EXPORT_DEFAULT)) {
    return;
  }
  Node c=n.getFirstChild();
  if (NodeUtil.isDeclaration(c)) {
    n.removeChild(c);
    Node exportSpecs=new Node(Token.EXPORT_SPECS).srcref(n);
    n.addChildToFront(exportSpecs);
    Iterable<Node> names;
    if (c.isClass() || c.isFunction()) {
      names=Collections.singleton(c.getFirstChild());
      n.getParent().addChildBefore(c,n);
      if (c.isClass()) {
        n.getParent().addChildBefore(new Node(Token.EMPTY).srcref(n),n);
      }
    }
 else {
      names=NodeUtil.getLhsNodesOfDeclaration(c);
      for (      Node child : c.children()) {
        c.removeChild(child);
        Node newDeclaration=new Node(c.getToken(),child).srcref(n);
        n.getParent().addChildBefore(newDeclaration,n);
      }
    }
    for (    Node name : names) {
      Node exportSpec=new Node(Token.EXPORT_SPEC).srcref(name);
      exportSpec.addChildToFront(name.cloneNode());
      exportSpec.addChildToFront(name.cloneNode());
      exportSpecs.addChildToBack(exportSpec);
    }
    compiler.reportChangeToEnclosingScope(n.getParent());
  }
}
Program: 19293
Project: 19293
Buggy source:
/** 
 * Rewrite named unhoisted functions declarations to a known consistent behavior so we don't to different logic paths for the same code. From: function f() {} to: var f = function () {}; and move it to the top of the block. This actually breaks semantics, but the semantics are also not well-defined cross-browser.
 * @see https://github.com/google/closure-compiler/pull/429
 */
static boolean visitFunction(Node n,AbstractCompiler compiler){
  checkState(n.isFunction(),n);
  if (NodeUtil.isFunctionDeclaration(n) && !NodeUtil.isHoistedFunctionDeclaration(n)) {
    rewriteFunctionDeclaration(n,compiler);
    return true;
  }
 else   if (n.isFunction() && !NodeUtil.getFunctionBody(n).isNormalBlock()) {
    Node returnValue=NodeUtil.getFunctionBody(n);
    Node body=IR.block(IR.returnNode(returnValue.detach()));
    body.useSourceInfoIfMissingFromForTree(returnValue);
    n.addChildToBack(body);
    compiler.reportChangeToEnclosingScope(body);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Rewrite named unhoisted functions declarations to a known consistent behavior so we don't to different logic paths for the same code. From: function f() {} to: var f = function () {}; and move it to the top of the block. This actually breaks semantics, but the semantics are also not well-defined cross-browser.
 * @see https://github.com/google/closure-compiler/pull/429
 */
static boolean visitFunction(Node n,AbstractCompiler compiler){
  checkState(n.isFunction(),n);
  if (NodeUtil.isFunctionDeclaration(n) && !NodeUtil.isHoistedFunctionDeclaration(n) && !n.getParent().isExport()) {
    rewriteFunctionDeclaration(n,compiler);
    return true;
  }
 else   if (n.isFunction() && !NodeUtil.getFunctionBody(n).isNormalBlock()) {
    Node returnValue=NodeUtil.getFunctionBody(n);
    Node body=IR.block(IR.returnNode(returnValue.detach()));
    body.useSourceInfoIfMissingFromForTree(returnValue);
    n.addChildToBack(body);
    compiler.reportChangeToEnclosingScope(body);
  }
  return false;
}
Program: 19294
Project: 19294
Buggy source:
public void testIsFunctionDeclaration(){
  assertTrue(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertTrue(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
}

Fixed version (ground truth):
public void testIsFunctionDeclaration(){
  assertTrue(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertTrue(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertTrue(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
  assertFalse(NodeUtil.isFunctionDeclaration(getFunctionNode("String_Node_Str")));
}
Program: 19295
Project: 19295
Buggy source:
public void testIsClassDeclaration(){
  assertTrue(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertFalse(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertFalse(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertFalse(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertTrue(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
}

Fixed version (ground truth):
public void testIsClassDeclaration(){
  assertTrue(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertFalse(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertFalse(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertTrue(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertTrue(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
  assertFalse(NodeUtil.isClassDeclaration(getClassNode("String_Node_Str")));
}
Program: 19296
Project: 19296
Buggy source:
public void testSplitExportDeclarationOfClass(){
  test("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testSplitExportDeclarationOfClass(){
  test("String_Node_Str","String_Node_Str");
  testSame("String_Node_Str");
  testSame("String_Node_Str");
}
Program: 19297
Project: 19297
Buggy source:
public void testSplitExportDeclarationOfFunction(){
  test("String_Node_Str",LINE_JOINER.join("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public void testSplitExportDeclarationOfFunction(){
  test("String_Node_Str",LINE_JOINER.join("String_Node_Str","String_Node_Str"));
  testSame("String_Node_Str");
  test("String_Node_Str","String_Node_Str");
}
Program: 19298
Project: 19298
Buggy source:
/** 
 * Given an object literal to export, create an object lit with all its string properties. We don't care what the values of those properties are because they are not checked.
 */
private Node createExternObjectLit(Node exportedObjectLit){
  Node lit=IR.objectlit();
  lit.setJSType(exportedObjectLit.getJSType());
  lit.setJSDocInfo(buildEmptyJSDoc());
  int index=1;
  for (Node child=exportedObjectLit.getFirstChild(); child != null; child=child.getNext()) {
    if (child.isStringKey()) {
      lit.addChildToBack(IR.propdef(IR.stringKey(child.getString()),IR.number(index++)));
    }
  }
  return lit;
}

Fixed version (ground truth):
/** 
 * Given an object literal to export, create an object lit with all its string properties. We don't care what the values of those properties are because they are not checked.
 */
private Node createExternObjectLit(Node exportedObjectLit){
  Node lit=IR.objectlit();
  lit.setTypeI(exportedObjectLit.getTypeI());
  lit.setJSDocInfo(buildEmptyJSDoc());
  int index=1;
  for (Node child=exportedObjectLit.getFirstChild(); child != null; child=child.getNext()) {
    if (child.isStringKey()) {
      lit.addChildToBack(IR.propdef(IR.stringKey(child.getString()),IR.number(index++)));
    }
  }
  return lit;
}
Program: 19299
Project: 19299
Buggy source:
/** 
 * Given a function to export, create the empty function that will be put in the externs file. This extern function should have the same type as the original function and the same parameter name but no function body. We create a warning here if the the function to export is missing parameter or return types.
 */
private Node createExternFunction(Node exportedFunction){
  Node paramList=NodeUtil.getFunctionParameters(exportedFunction).cloneTree();
  Node param=paramList.getFirstChild();
  while (param != null && param.isName()) {
    String originalName=param.getOriginalName();
    if (originalName != null) {
      param.setString(originalName);
    }
    param=param.getNext();
  }
  Node externFunction=IR.function(IR.name("String_Node_Str"),paramList,IR.block());
  if (exportedFunction.getJSType() != null) {
    externFunction.setJSType(exportedFunction.getJSType());
    deleteInlineJsdocs(externFunction);
  }
  return externFunction;
}

Fixed version (ground truth):
/** 
 * Given a function to export, create the empty function that will be put in the externs file. This extern function should have the same type as the original function and the same parameter name but no function body. We create a warning here if the the function to export is missing parameter or return types.
 */
private Node createExternFunction(Node exportedFunction){
  Node paramList=NodeUtil.getFunctionParameters(exportedFunction).cloneTree();
  Node param=paramList.getFirstChild();
  while (param != null && param.isName()) {
    String originalName=param.getOriginalName();
    if (originalName != null) {
      param.setString(originalName);
    }
    param=param.getNext();
  }
  Node externFunction=IR.function(IR.name("String_Node_Str"),paramList,IR.block());
  if (exportedFunction.getTypeI() != null) {
    externFunction.setTypeI(exportedFunction.getTypeI());
    deleteInlineJsdocs(externFunction);
  }
  return externFunction;
}