nus-yam/ex-repair huggingface dataset:
Program: 19300
Project: 19300
Buggy source:
StringBuilder appendTo(StringBuilder builder,ToStringContext ctx){
  if (isPrototypeObject()) {
    return builder.append(getOwnerFunction().getThisType()).append("String_Node_Str");
  }
  if (!hasNonPrototypeProperties()) {
    if (fn != null) {
      return fn.appendTo(builder,ctx);
    }
    return this.nominalType.appendTo(builder,ctx);
  }
  if (!nominalType.isFunction() && !nominalType.isBuiltinObject() && !nominalType.isLiteralObject()) {
    nominalType.appendTo(builder,ctx);
  }
 else   if (isStruct()) {
    builder.append("String_Node_Str");
  }
 else   if (isDict()) {
    builder.append("String_Node_Str");
  }
 else   if (this.ns != null) {
    builder.append(this.ns);
  }
  if (this.fn != null) {
    builder.append("String_Node_Str");
    fn.appendTo(builder,ctx);
    builder.append("String_Node_Str");
  }
  if (ns == null || !props.isEmpty()) {
    builder.append('{');
    boolean firstIteration=true;
    for (    String pname : new TreeSet<>(props.keySet())) {
      if (firstIteration) {
        firstIteration=false;
      }
 else {
        builder.append("String_Node_Str");
      }
      builder.append(pname);
      builder.append("String_Node_Str");
      props.get(pname).appendTo(builder,ctx);
    }
    builder.append('}');
  }
  if (isLoose) {
    builder.append("String_Node_Str");
  }
  return builder;
}

Fixed version (ground truth):
StringBuilder appendTo(StringBuilder builder,ToStringContext ctx){
  if (isPrototypeObject()) {
    return builder.append(getOwnerFunction().getThisType()).append("String_Node_Str");
  }
  if (ctx.forAnnotation()) {
    if (fn != null) {
      fn.appendTo(builder,ctx);
    }
 else     if (!props.isEmpty()) {
      appendPropsTo(builder,ctx);
    }
 else     if (nominalType.isLiteralObject()) {
      builder.append("String_Node_Str");
    }
 else {
      nominalType.appendTo(builder,ctx);
    }
    return builder;
  }
  if (!hasNonPrototypeProperties()) {
    if (fn != null) {
      return fn.appendTo(builder,ctx);
    }
    return this.nominalType.appendTo(builder,ctx);
  }
  if (!nominalType.isFunction() && !nominalType.isBuiltinObject() && !nominalType.isLiteralObject()) {
    nominalType.appendTo(builder,ctx);
  }
 else   if (isStruct()) {
    builder.append("String_Node_Str");
  }
 else   if (isDict()) {
    builder.append("String_Node_Str");
  }
 else   if (this.ns != null) {
    builder.append(this.ns);
  }
  if (this.fn != null) {
    builder.append("String_Node_Str");
    fn.appendTo(builder,ctx);
    builder.append("String_Node_Str");
  }
  if (ns == null || !props.isEmpty()) {
    appendPropsTo(builder,ctx);
  }
  if (isLoose) {
    builder.append("String_Node_Str");
  }
  return builder;
}
Program: 19302
Project: 19302
Buggy source:
private void addRetTypeAndWarn(NTIScope fn,TypeEnv exitEnv,DeclaredFunctionType declType,FunctionTypeBuilder builder){
  Node fnRoot=fn.getRoot();
  JSType declRetType=declType.getReturnType();
  JSType actualRetType=checkNotNull(envGetType(exitEnv,RETVAL_ID));
  if (declRetType != null) {
    if (fnRoot.isGeneratorFunction()) {
      JSType generator=this.commonTypes.getGeneratorInstance(UNKNOWN);
      if (!generator.isSubtypeOf(declRetType)) {
        registerMismatchAndWarn(JSError.make(fnRoot,INVALID_DECLARED_RETURN_TYPE_OF_GENERATOR_FUNCTION,errorMsgWithTypeDiff(generator,declRetType)),declRetType,generator);
        builder.addRetType(UNKNOWN);
      }
 else {
        builder.addRetType(declRetType);
      }
    }
 else {
      builder.addRetType(declRetType);
      if (!isAllowedToNotReturn(fn) && !UNDEFINED.isSubtypeOf(declRetType) && hasPathWithNoReturn(this.cfg)) {
        warnings.add(JSError.make(fnRoot,MISSING_RETURN_STATEMENT,declRetType.toString()));
      }
    }
  }
 else   if (fnRoot.isGeneratorFunction()) {
    JSType yieldType=envGetType(exitEnv,YIELDVAL_ID);
    builder.addRetType(this.commonTypes.getGeneratorInstance(firstNonNull(yieldType,UNKNOWN)));
  }
 else   if (declType.getNominalType() == null) {
    builder.addRetType(firstNonBottom(actualRetType,TOP));
  }
 else {
    builder.addRetType(UNDEFINED);
  }
}

Fixed version (ground truth):
private void addRetTypeAndWarn(NTIScope fn,TypeEnv exitEnv,DeclaredFunctionType declType,FunctionTypeBuilder builder){
  Node fnRoot=fn.getRoot();
  JSType declRetType=declType.getReturnType();
  JSType actualRetType=checkNotNull(envGetType(exitEnv,RETVAL_ID));
  if (declRetType != null) {
    if (fnRoot.isGeneratorFunction()) {
      JSType generator=this.commonTypes.getGeneratorInstance(UNKNOWN);
      if (!generator.isSubtypeOf(declRetType)) {
        registerMismatchAndWarn(JSError.make(fnRoot,INVALID_DECLARED_RETURN_TYPE_OF_GENERATOR_FUNCTION,errorMsgWithTypeDiff(generator,declRetType)),declRetType,generator);
        builder.addRetType(UNKNOWN);
      }
 else {
        builder.addRetType(declRetType);
      }
    }
 else {
      builder.addRetType(declRetType);
      if (!isAllowedToNotReturn(fn) && !UNDEFINED.isSubtypeOf(declRetType) && hasPathWithNoReturn(this.cfg)) {
        warnings.add(JSError.make(fnRoot,MISSING_RETURN_STATEMENT,declRetType.toString()));
      }
    }
  }
 else   if (fnRoot.isGeneratorFunction()) {
    JSType yieldType=envGetType(exitEnv,YIELDVAL_ID);
    builder.addRetType(this.commonTypes.getGeneratorInstance(firstNonNull(yieldType,UNKNOWN)));
  }
 else   if (declType.getNominalType() == null) {
    builder.addRetType(firstNonBottom(actualRetType,UNKNOWN));
  }
 else {
    builder.addRetType(UNDEFINED);
  }
}
Program: 19303
Project: 19303
Buggy source:
private TypeEnv getExitTypeEnv(){
  if (!this.cfg.getImplicitReturn().getInEdges().isEmpty()) {
    exitEnvs.add(getInEnv(this.cfg.getImplicitReturn()));
  }
  checkState(!exitEnvs.isEmpty(),"String_Node_Str");
  return TypeEnv.join(exitEnvs);
}

Fixed version (ground truth):
private TypeEnv getExitTypeEnv(){
  for (int i=0; i < exitEnvs.size(); i++) {
    TypeEnv env=exitEnvs.get(i);
    exitEnvs.set(i,envPutType(env,RETVAL_ID,BOTTOM));
  }
  if (!this.cfg.getImplicitReturn().getInEdges().isEmpty()) {
    exitEnvs.add(getInEnv(this.cfg.getImplicitReturn()));
  }
  checkState(!exitEnvs.isEmpty(),"String_Node_Str");
  return TypeEnv.join(exitEnvs);
}
Program: 19304
Project: 19304
Buggy source:
public void testFunctionsWithAbnormalExit(){
  typeCheck("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_ARGUMENT_TYPE);
  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","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","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
}

Fixed version (ground truth):
public void testFunctionsWithAbnormalExit(){
  typeCheck("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_ARGUMENT_TYPE);
  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","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","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"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str"));
}
Program: 19305
Project: 19305
Buggy source:
private boolean evalTypePredicate(Node ttlAst,NameResolver nameResolver){
  TypeI[] params=evalTypeParams(ttlAst,nameResolver);
  String name=getCallName(ttlAst);
  Keywords keyword=nameToKeyword(name);
  TypeI type=params[0];
switch (keyword) {
case EQ:
    return type.isEquivalentTo(params[1]);
case SUB:
  return type.isSubtypeOf(params[1]);
case ISCTOR:
return type.isConstructor();
case ISTEMPLATIZED:
return type.isObjectType() && type.toMaybeObjectType().isGenericObjectType() && !type.hasUninstantiatedTypeVariables();
case ISRECORD:
return type.isRecordType();
case ISUNKNOWN:
return type.isSomeUnknownType();
default :
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
private boolean evalTypePredicate(Node ttlAst,NameResolver nameResolver){
  TypeI[] params=evalTypeParams(ttlAst,nameResolver);
  String name=getCallName(ttlAst);
  Keywords keyword=nameToKeyword(name);
  TypeI type=params[0];
switch (keyword) {
case EQ:
    return type.isEquivalentTo(params[1]);
case SUB:
  return type.isSubtypeOf(params[1]);
case ISCTOR:
return type.isConstructor();
case ISTEMPLATIZED:
return type.isObjectType() && type.toMaybeObjectType().isGenericObjectType();
case ISRECORD:
return type.isRecordType();
case ISUNKNOWN:
return type.isSomeUnknownType();
default :
throw new IllegalStateException("String_Node_Str");
}
}
Program: 19306
Project: 19306
Buggy source:
private TypeI evalTemplatizedType(Node ttlAst,NameResolver nameResolver){
  ImmutableList<Node> params=getCallParams(ttlAst);
  TypeI firstParam=evalInternal(params.get(0),nameResolver);
  if (!firstParam.hasUninstantiatedTypeVariables()) {
    reportWarning(ttlAst,BASETYPE_INVALID,firstParam.toString());
    return getUnknownType();
  }
  TypeI[] templatizedTypes=new TypeI[params.size() - 1];
  for (int i=0; i < templatizedTypes.length; i++) {
    templatizedTypes[i]=evalInternal(params.get(i + 1),nameResolver);
  }
  ObjectTypeI baseType=firstParam.toMaybeObjectType();
  return createTemplatizedType(baseType,templatizedTypes);
}

Fixed version (ground truth):
private TypeI evalTemplatizedType(Node ttlAst,NameResolver nameResolver){
  ImmutableList<Node> params=getCallParams(ttlAst);
  TypeI firstParam=evalInternal(params.get(0),nameResolver);
  if (firstParam.isFullyInstantiated()) {
    reportWarning(ttlAst,BASETYPE_INVALID,firstParam.toString());
    return getUnknownType();
  }
  TypeI[] templatizedTypes=new TypeI[params.size() - 1];
  for (int i=0; i < templatizedTypes.length; i++) {
    templatizedTypes[i]=evalInternal(params.get(i + 1),nameResolver);
  }
  ObjectTypeI baseType=firstParam.toMaybeObjectType();
  return createTemplatizedType(baseType,templatizedTypes);
}
Program: 19307
Project: 19307
Buggy source:
private boolean evalTypePredicate(Node ttlAst,NameResolver nameResolver){
  TypeI[] params=evalTypeParams(ttlAst,nameResolver);
  String name=getCallName(ttlAst);
  Keywords keyword=nameToKeyword(name);
  TypeI type=params[0];
switch (keyword) {
case EQ:
    return type.isEquivalentTo(params[1]);
case SUB:
  return type.isSubtypeOf(params[1]);
case ISCTOR:
return type.isConstructor();
case ISTEMPLATIZED:
return type.isObjectType() && type.toMaybeObjectType().isGenericObjectType();
case ISRECORD:
return type.isRecordType();
case ISUNKNOWN:
return type.isSomeUnknownType();
default :
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
private boolean evalTypePredicate(Node ttlAst,NameResolver nameResolver){
  TypeI[] params=evalTypeParams(ttlAst,nameResolver);
  String name=getCallName(ttlAst);
  Keywords keyword=nameToKeyword(name);
  TypeI type=params[0];
switch (keyword) {
case EQ:
    return type.isEquivalentTo(params[1]);
case SUB:
  return type.isSubtypeOf(params[1]);
case ISCTOR:
return type.isConstructor();
case ISTEMPLATIZED:
return type.isObjectType() && type.toMaybeObjectType().isGenericObjectType() && type.isPartiallyInstantiated();
case ISRECORD:
return type.isRecordType();
case ISUNKNOWN:
return type.isSomeUnknownType();
default :
throw new IllegalStateException("String_Node_Str");
}
}
Program: 19308
Project: 19308
Buggy source:
@Override public void process(Node externs,Node root){
  NodeTraversal.traverseRootsEs6(compiler,new AbstractPostOrderCallback(){
    @Override public void visit(    NodeTraversal t,    Node n,    Node parent){
      if (n.isName() && !parent.isFunction() && !parent.isLabel()) {
        assertTrue("String_Node_Str" + n.getString() + "String_Node_Str",t.getScope().isDeclared(n.getString(),true));
      }
    }
  }
,externs,root);
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  NodeTraversal.traverseRootsEs6(compiler,new AbstractPostOrderCallback(){
    @Override public void visit(    NodeTraversal t,    Node n,    Node parent){
      if (n.isName() && !parent.isFunction() && !parent.isLabel()) {
        assertWithMessage("String_Node_Str",n).that(t.getScope().isDeclared(n.getString(),true)).isTrue();
      }
    }
  }
,externs,root);
}
Program: 19309
Project: 19309
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName() && !parent.isFunction() && !parent.isLabel()) {
    assertTrue("String_Node_Str" + n.getString() + "String_Node_Str",t.getScope().isDeclared(n.getString(),true));
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isName() && !parent.isFunction() && !parent.isLabel()) {
    assertWithMessage("String_Node_Str",n).that(t.getScope().isDeclared(n.getString(),true)).isTrue();
  }
}
Program: 19310
Project: 19310
Buggy source:
private void exportClass(Node scriptNode,Node classNode){
  Node classMembers=classNode.getLastChild();
  for (  Node maybeMemberFunctionDef : classMembers.children()) {
    if (maybeMemberFunctionDef.isMemberFunctionDef()) {
      String methodName=maybeMemberFunctionDef.getString();
      if (TEST_FUNCTIONS_NAME_PATTERN.matcher(methodName).matches()) {
        String functionRef=NodeUtil.getName(classNode) + "String_Node_Str" + methodName;
        String classRef=NodeUtil.getName(classNode) + "String_Node_Str";
        Node exportCallTarget=NodeUtil.newQName(compiler,exportPropertyFunction,maybeMemberFunctionDef,methodName);
        Node call=IR.call(exportCallTarget);
        if (exportCallTarget.isName()) {
          call.putBooleanProp(Node.FREE_CALL,true);
        }
        call.addChildToBack(NodeUtil.newQName(compiler,classRef,maybeMemberFunctionDef,classRef));
        call.addChildToBack(IR.string(methodName));
        call.addChildToBack(NodeUtil.newQName(compiler,functionRef,maybeMemberFunctionDef,functionRef));
        Node expression=IR.exprResult(call);
        scriptNode.addChildAfter(expression,classNode);
        compiler.reportChangeToEnclosingScope(expression);
      }
    }
  }
}

Fixed version (ground truth):
private void exportClass(Node scriptNode,Node classNode,String className,Node baseNode){
  Node classMembers=classNode.getLastChild();
  for (  Node maybeMemberFunctionDef : classMembers.children()) {
    if (maybeMemberFunctionDef.isMemberFunctionDef()) {
      String methodName=maybeMemberFunctionDef.getString();
      if (isTestFunction(methodName)) {
        String functionRef=className + "String_Node_Str" + methodName;
        String classRef=className + "String_Node_Str";
        Node exportCallTarget=NodeUtil.newQName(compiler,exportPropertyFunction,maybeMemberFunctionDef,methodName);
        Node call=IR.call(exportCallTarget);
        if (exportCallTarget.isName()) {
          call.putBooleanProp(Node.FREE_CALL,true);
        }
        call.addChildToBack(NodeUtil.newQName(compiler,classRef,maybeMemberFunctionDef,classRef));
        call.addChildToBack(IR.string(methodName));
        call.addChildToBack(NodeUtil.newQName(compiler,functionRef,maybeMemberFunctionDef,functionRef));
        Node expression=IR.exprResult(call);
        scriptNode.addChildAfter(expression,baseNode);
        compiler.reportChangeToEnclosingScope(expression);
      }
    }
  }
}
Program: 19311
Project: 19311
Buggy source:
/** 
 * Whether node corresponds to a function expression declared with var, let or const which is of the form: <pre> var/let/const functionName = function() { // Implementation }; </pre> This has the AST structure VAR/LET/CONST -> NAME -> FUNCTION
 * @param node
 */
private boolean isNameDeclaredFunction(Node node){
  if (!NodeUtil.isNameDeclaration(node)) {
    return false;
  }
  Node grandchild=node.getFirstFirstChild();
  return grandchild != null && grandchild.isFunction();
}

Fixed version (ground truth):
/** 
 * Whether node corresponds to a function expression declared with var, let or const which is of the form: <pre> var/let/const functionName = function() { // Implementation }; </pre> This has the AST structure VAR/LET/CONST -> NAME -> FUNCTION
 * @param node
 */
private boolean isNameDeclaredFunction(Node node){
  Node grandchild=getNameDeclaredGrandchild(node);
  return grandchild != null && grandchild.isFunction();
}
Program: 19313
Project: 19313
Buggy source:
void fillPropertyScopes(){
  List<Symbol> types=new ArrayList<>();
  List<Symbol> googModuleExportTypes=new ArrayList<>();
  for (  Symbol sym : getAllSymbols()) {
    if (needsPropertyScope(sym)) {
      if (sym.getName().startsWith("String_Node_Str")) {
        googModuleExportTypes.add(sym);
      }
 else {
        types.add(sym);
      }
    }
  }
  Collections.sort(types,getNaturalSymbolOrdering().reverse());
  Collections.sort(googModuleExportTypes,getNaturalSymbolOrdering().reverse());
  for (  Symbol s : Iterables.concat(googModuleExportTypes,types)) {
    createPropertyScopeFor(s);
  }
  pruneOrphanedNames();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") void fillPropertyScopes(){
  List<Symbol> types=new ArrayList<>();
  List<Symbol> googModuleExportTypes=new ArrayList<>();
  for (  Symbol sym : getAllSymbols()) {
    if (needsPropertyScope(sym)) {
      if (sym.getName().startsWith("String_Node_Str")) {
        googModuleExportTypes.add(sym);
      }
 else {
        types.add(sym);
      }
    }
  }
  Collections.sort(types,getNaturalSymbolOrdering().reverse());
  Collections.sort(googModuleExportTypes,getNaturalSymbolOrdering().reverse());
  Iterable<Symbol> allTypes=Iterables.concat(googModuleExportTypes,types);
  Map<JSType,Symbol> symbolThatDeclaresType=new IdentityHashMap<>();
  for (  Symbol s : allTypes) {
    symbolThatDeclaresType.put(s.getType(),s);
  }
  for (  Symbol s : allTypes) {
    if (s.getType() == null || symbolThatDeclaresType.get(s.getType()).equals(s)) {
      createPropertyScopeFor(s);
    }
  }
  for (  Symbol s : allTypes) {
    if (s.getType() != null) {
      s.propertyScope=symbolThatDeclaresType.get(s.getType()).getPropertyScope();
    }
  }
  pruneOrphanedNames();
}
Program: 19314
Project: 19314
Buggy source:
private void removeSymbol(Symbol s){
  SymbolScope scope=getScope(s);
  if (scope.ownSymbols.remove(s.getName()) != s) {
    throw new IllegalStateException("String_Node_Str" + s);
  }
  if (symbols.remove(s.getDeclaration().getNode(),s.getName()) != s) {
    throw new IllegalStateException("String_Node_Str" + s);
  }
}

Fixed version (ground truth):
private void removeSymbol(Symbol s){
  SymbolScope scope=getScope(s);
  if (!scope.ownSymbols.remove(s.getName()).equals(s)) {
    throw new IllegalStateException("String_Node_Str" + s);
  }
  if (!symbols.remove(s.getDeclaration().getNode(),s.getName()).equals(s)) {
    throw new IllegalStateException("String_Node_Str" + s);
  }
}
Program: 19316
Project: 19316
Buggy source:
private boolean isSubtypeOfHelper(boolean keepLoosenessOfThis,JSType other,SubtypeCache subSuperMap,MismatchInfo[] boxedInfo){
  if (isUnknown() || other.isUnknown() || other.isTop()) {
    return true;
  }
  if (isTheTruthyType()) {
    return !other.makeTruthy().isBottom();
  }
  if (isTheFalsyType()) {
    return !other.makeFalsy().isBottom();
  }
  if (!EnumType.areSubtypes(this,other,subSuperMap)) {
    return false;
  }
  int mask=getMask() & ~ENUM_MASK;
  if ((mask | other.getMask()) != other.getMask()) {
    if (boxedInfo != null && isUnion()) {
      whyNotUnionSubtypes(this,other,boxedInfo);
    }
    return false;
  }
  if (getTypeVar() != null && !getTypeVar().equals(other.getTypeVar())) {
    return false;
  }
  if (getObjs().isEmpty()) {
    return true;
  }
  boolean result=ObjectType.isUnionSubtype(keepLoosenessOfThis,getObjs(),other.getObjs(),subSuperMap);
  if (boxedInfo != null) {
    ObjectType.whyNotUnionSubtypes(keepLoosenessOfThis,getObjs(),other.getObjs(),subSuperMap,boxedInfo);
  }
  return result;
}

Fixed version (ground truth):
private boolean isSubtypeOfHelper(boolean keepLoosenessOfThis,JSType other,SubtypeCache subSuperMap,MismatchInfo[] boxedInfo){
  if (isUnknown() || other.isUnknown() || other.isTop()) {
    return true;
  }
  if (isTheTruthyType()) {
    return !other.makeTruthy().isBottom();
  }
  if (isTheFalsyType()) {
    return !other.makeFalsy().isBottom();
  }
  if (other.isTheTruthyType()) {
    return isAnyTruthyType();
  }
  if (!EnumType.areSubtypes(this,other,subSuperMap)) {
    return false;
  }
  int mask=getMask() & ~ENUM_MASK;
  if ((mask | other.getMask()) != other.getMask()) {
    if (boxedInfo != null && isUnion()) {
      whyNotUnionSubtypes(this,other,boxedInfo);
    }
    return false;
  }
  if (getTypeVar() != null && !getTypeVar().equals(other.getTypeVar())) {
    return false;
  }
  if (getObjs().isEmpty()) {
    return true;
  }
  boolean result=ObjectType.isUnionSubtype(keepLoosenessOfThis,getObjs(),other.getObjs(),subSuperMap);
  if (boxedInfo != null) {
    ObjectType.whyNotUnionSubtypes(keepLoosenessOfThis,getObjs(),other.getObjs(),subSuperMap,boxedInfo);
  }
  return result;
}
Program: 19318
Project: 19318
Buggy source:
public void testExports(){
  CompilerOptions options=createCompilerOptions();
  CompilationLevel level=CompilationLevel.ADVANCED_OPTIMIZATIONS;
  level.setOptionsForCompilationLevel(options);
  WarningLevel warnings=WarningLevel.DEFAULT;
  warnings.setOptionsForWarningLevel(options);
  options.setRemoveUnusedPrototypePropertiesInExterns(true);
  String code="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  test(options,code,"String_Node_Str" + "String_Node_Str");
  options.setGenerateExports(true);
  test(options,"String_Node_Str" + "String_Node_Str",FindExportableNodes.NON_GLOBAL_ERROR);
  options.exportLocalPropertyDefinitions=true;
  options.setRemoveUnusedPrototypePropertiesInExterns(false);
  test(options,code,"String_Node_Str" + "String_Node_Str");
  test(options,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str");
  options.setCheckTypes(true);
  options.setDisambiguateProperties(true);
  options.setAmbiguateProperties(true);
  options.propertyInvalidationErrors=ImmutableMap.of("String_Node_Str",CheckLevel.ERROR);
  test(options,code,"String_Node_Str" + "String_Node_Str");
  test(options,"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 testExports(){
  CompilerOptions options=createCompilerOptions();
  CompilationLevel level=CompilationLevel.ADVANCED_OPTIMIZATIONS;
  level.setOptionsForCompilationLevel(options);
  WarningLevel warnings=WarningLevel.DEFAULT;
  warnings.setOptionsForWarningLevel(options);
  options.setRemoveUnusedPrototypePropertiesInExterns(true);
  String code="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  test(options,code,"String_Node_Str" + "String_Node_Str");
  options.setGenerateExports(true);
  test(options,"String_Node_Str" + "String_Node_Str",FindExportableNodes.NON_GLOBAL_ERROR);
  options.exportLocalPropertyDefinitions=true;
  options.setRemoveUnusedPrototypePropertiesInExterns(false);
  test(options,code,"String_Node_Str");
  test(options,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");
  options.setCheckTypes(true);
  options.setDisambiguateProperties(true);
  options.setAmbiguateProperties(true);
  options.propertyInvalidationErrors=ImmutableMap.of("String_Node_Str",CheckLevel.ERROR);
  test(options,code,"String_Node_Str");
  test(options,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str");
}
Program: 19319
Project: 19319
Buggy source:
public void testIssue724(){
  CompilerOptions options=createCompilerOptions();
  CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
  options.setCheckSymbols(false);
  options.setCheckTypes(false);
  String code="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  String result="String_Node_Str" + "String_Node_Str";
  test(options,code,result);
}

Fixed version (ground truth):
public void testIssue724(){
  CompilerOptions options=createCompilerOptions();
  CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
  options.setCheckSymbols(false);
  options.setCheckTypes(false);
  String code=LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  String result="String_Node_Str";
  test(options,code,result);
}
Program: 19320
Project: 19320
Buggy source:
private EnvTypePair analyzeLooseCallNodeBwd(Node callNode,TypeEnv outEnv,JSType retType){
  Preconditions.checkArgument(callNode.isCall() || callNode.isNew());
  Preconditions.checkNotNull(retType);
  Node callee=callNode.getFirstChild();
  TypeEnv tmpEnv=outEnv;
  FunctionTypeBuilder builder=new FunctionTypeBuilder(this.commonTypes);
  for (Node arg=callee.getNext(); arg != null; arg=arg.getNext()) {
    EnvTypePair pair=analyzeExprBwd(arg,tmpEnv);
    JSType argType=pair.type;
    tmpEnv=pair.env;
    builder.addReqFormal(isImpreciseType(argType) ? BOTTOM : argType);
  }
  JSType looseRetType=retType.isUnknown() ? BOTTOM : retType;
  JSType looseFunctionType=commonTypes.fromFunctionType(builder.addRetType(looseRetType).addLoose().buildFunction());
  println("String_Node_Str",looseFunctionType);
  EnvTypePair calleePair=analyzeExprBwd(callee,tmpEnv,looseFunctionType);
  return new EnvTypePair(calleePair.env,retType);
}

Fixed version (ground truth):
private EnvTypePair analyzeLooseCallNodeBwd(Node callNode,TypeEnv outEnv,JSType retType){
  Preconditions.checkArgument(callNode.isCall() || callNode.isNew());
  Preconditions.checkNotNull(retType);
  Node callee=callNode.getFirstChild();
  TypeEnv tmpEnv=outEnv;
  FunctionTypeBuilder builder=new FunctionTypeBuilder(this.commonTypes);
  Node target=callNode.getFirstChild();
  for (Node arg=callNode.getLastChild(); arg != target; arg=arg.getPrevious()) {
    EnvTypePair pair=analyzeExprBwd(arg,tmpEnv);
    JSType argType=pair.type;
    tmpEnv=pair.env;
    builder.addReqFormalToFront(isImpreciseType(argType) ? BOTTOM : argType);
  }
  JSType looseRetType=retType.isUnknown() ? BOTTOM : retType;
  JSType looseFunctionType=commonTypes.fromFunctionType(builder.addRetType(looseRetType).addLoose().buildFunction());
  println("String_Node_Str",looseFunctionType);
  EnvTypePair calleePair=analyzeExprBwd(callee,tmpEnv,looseFunctionType);
  return new EnvTypePair(calleePair.env,retType);
}
Program: 19321
Project: 19321
Buggy source:
public void testBackwardAnalyzedLooseFunctionParametersInRightOrder(){
  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"));
}

Fixed version (ground truth):
public void testBackwardAnalyzedLooseFunctionParametersInRightOrder(){
  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","String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 19322
Project: 19322
Buggy source:
private EnvTypePair analyzeThisFwd(Node expr,TypeEnv inEnv,JSType requiredType,JSType specializedType){
  mayWarnAboutGlobalThis(expr,currentScope);
  if (!this.currentScope.hasThis()) {
    return new EnvTypePair(inEnv,UNKNOWN);
  }
  JSType inferredType=envGetType(inEnv,THIS_ID);
  if (!inferredType.isSubtypeOf(requiredType)) {
    return new EnvTypePair(inEnv,inferredType);
  }
  JSType preciseType=inferredType.specialize(specializedType);
  if (preciseType.isBottom()) {
    preciseType=pickFallbackTypeAfterBottom(THIS_ID,inferredType,specializedType);
  }
  return EnvTypePair.addBinding(inEnv,THIS_ID,preciseType);
}

Fixed version (ground truth):
private EnvTypePair analyzeThisFwd(Node expr,TypeEnv inEnv,JSType requiredType,JSType specializedType){
  mayWarnAboutGlobalThis(expr);
  if (!this.currentScope.hasThis()) {
    return new EnvTypePair(inEnv,UNKNOWN);
  }
  JSType inferredType=envGetType(inEnv,THIS_ID);
  if (!inferredType.isSubtypeOf(requiredType)) {
    return new EnvTypePair(inEnv,inferredType);
  }
  JSType preciseType=inferredType.specialize(specializedType);
  if (preciseType.isBottom()) {
    preciseType=pickFallbackTypeAfterBottom(THIS_ID,inferredType,specializedType);
  }
  return EnvTypePair.addBinding(inEnv,THIS_ID,preciseType);
}
Program: 19324
Project: 19324
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))) {
      pair.type=requiredType;
      return pair;
    }
  }
  return analyzeUnaryNumFwd(expr,inEnv);
}
Program: 19327
Project: 19327
Buggy source:
private boolean mayWarnAboutInexistentProp(Node propAccessNode,JSType recvType,QualifiedName propQname){
  Preconditions.checkState(propAccessNode.isGetProp() || propAccessNode.isGetElem());
  String pname=propQname.toString();
  if (propAccessNode.isGetElem() || !recvType.isLoose() && recvType.hasProp(propQname)) {
    return false;
  }
  if (recvType.isUnknown() || recvType.isTrueOrTruthy() || recvType.isLoose()|| (allowPropertyOnSubtypes && (recvType.mayContainUnknownObject() || recvType.isIObject()))) {
    if (symbolTable.isPropertyDefined(pname)) {
      return false;
    }
    warnings.add(JSError.make(propAccessNode,INEXISTENT_PROPERTY,pname,"String_Node_Str"));
    return true;
  }
  if (allowPropertyOnSubtypes && !recvType.isStruct() && recvType.isPropDefinedOnSubtype(propQname)) {
    return false;
  }
  String recvTypeAsString=recvType.toString();
  Node recv=propAccessNode.getFirstChild();
  String errorMsg;
  if (!recv.isQualifiedName()) {
    errorMsg=recvTypeAsString;
  }
 else   if (recvTypeAsString.length() > 100) {
    errorMsg=recv.getQualifiedName();
  }
 else {
    errorMsg=recv.getQualifiedName() + "String_Node_Str" + recvTypeAsString;
  }
  DiagnosticType warningType=recvType.mayHaveProp(propQname) ? POSSIBLY_INEXISTENT_PROPERTY : INEXISTENT_PROPERTY;
  warnings.add(JSError.make(propAccessNode,warningType,pname,errorMsg));
  return true;
}

Fixed version (ground truth):
private boolean mayWarnAboutInexistentProp(Node propAccessNode,JSType recvType,QualifiedName propQname){
  Preconditions.checkState(propAccessNode.isGetProp() || propAccessNode.isGetElem());
  String pname=propQname.toString();
  if (propAccessNode.isGetElem() || (!recvType.isLoose() && recvType.hasProp(propQname))) {
    return false;
  }
  if (recvType.isUnknown() || recvType.isTrueOrTruthy() || recvType.isLoose()|| (allowPropertyOnSubtypes && (recvType.mayContainUnknownObject() || recvType.isIObject()))) {
    if (symbolTable.isPropertyDefined(pname)) {
      return false;
    }
    warnings.add(JSError.make(propAccessNode,INEXISTENT_PROPERTY,pname,"String_Node_Str"));
    return true;
  }
  if (allowPropertyOnSubtypes && !recvType.isStruct() && recvType.isPropDefinedOnSubtype(propQname)) {
    return false;
  }
  String recvTypeAsString=recvType.toString();
  Node recv=propAccessNode.getFirstChild();
  String errorMsg;
  if (!recv.isQualifiedName()) {
    errorMsg=recvTypeAsString;
  }
 else   if (recvTypeAsString.length() > 100) {
    errorMsg=recv.getQualifiedName();
  }
 else {
    errorMsg=recv.getQualifiedName() + "String_Node_Str" + recvTypeAsString;
  }
  DiagnosticType warningType=recvType.mayHaveProp(propQname) ? POSSIBLY_INEXISTENT_PROPERTY : INEXISTENT_PROPERTY;
  warnings.add(JSError.make(propAccessNode,warningType,pname,errorMsg));
  return true;
}
Program: 19328
Project: 19328
Buggy source:
private void mayWarnAboutGlobalThis(Node thisExpr,NTIScope currentScope){
  Preconditions.checkArgument(thisExpr.isThis());
  if (this.currentScope.isTopLevel() || !this.currentScope.hasThis()) {
    Node parent=thisExpr.getParent();
    if ((parent.isGetProp() || parent.isGetElem()) && !NodeUtil.isCallOrNewArgument(this.currentScope.getRoot())) {
      warnings.add(JSError.make(thisExpr,GLOBAL_THIS));
    }
  }
}

Fixed version (ground truth):
private void mayWarnAboutGlobalThis(Node thisExpr){
  Preconditions.checkArgument(thisExpr.isThis());
  if (this.currentScope.isTopLevel() || !this.currentScope.hasThis()) {
    Node parent=thisExpr.getParent();
    if ((parent.isGetProp() || parent.isGetElem()) && !NodeUtil.isCallOrNewArgument(this.currentScope.getRoot())) {
      warnings.add(JSError.make(thisExpr,GLOBAL_THIS));
    }
  }
}
Program: 19329
Project: 19329
Buggy source:
private void warnInvalidOperand(Node expr,Token operatorType,Object expected,Object actual){
  Preconditions.checkArgument((expected instanceof String) || (expected instanceof JSType));
  Preconditions.checkArgument((actual instanceof String) || (actual instanceof JSType));
  if (expected instanceof JSType && actual instanceof JSType) {
    warnings.add(JSError.make(expr,INVALID_OPERAND_TYPE,operatorType.toString(),errorMsgWithTypeDiff((JSType)expected,(JSType)actual)));
  }
 else {
    warnings.add(JSError.make(expr,INVALID_OPERAND_TYPE,operatorType.toString(),"String_Node_Str" + expected.toString() + "String_Node_Str"+ "String_Node_Str"+ actual.toString()+ "String_Node_Str"));
  }
}

Fixed version (ground truth):
private void warnInvalidOperand(Node expr,Token operatorType,Object expected,Object actual){
  Preconditions.checkArgument((expected instanceof String) || (expected instanceof JSType));
  Preconditions.checkArgument((actual instanceof String) || (actual instanceof JSType));
  if (expected instanceof JSType && actual instanceof JSType) {
    warnings.add(JSError.make(expr,INVALID_OPERAND_TYPE,operatorType.toString(),errorMsgWithTypeDiff((JSType)expected,(JSType)actual)));
  }
 else {
    warnings.add(JSError.make(expr,INVALID_OPERAND_TYPE,operatorType.toString(),"String_Node_Str" + expected + "String_Node_Str"+ "String_Node_Str"+ actual+ "String_Node_Str"));
  }
}
Program: 19332
Project: 19332
Buggy source:
void add(JSError warning){
  String filename=warning.node.getSourceFileName();
  if (filename != null && filename.startsWith("String_Node_Str") || JSType.mockToString) {
    return;
  }
  compiler.report(warning);
}

Fixed version (ground truth):
void add(JSError warning){
  String filename=warning.node.getSourceFileName();
  if ((filename != null && filename.startsWith("String_Node_Str")) || JSType.mockToString) {
    return;
  }
  compiler.report(warning);
}
Program: 19333
Project: 19333
Buggy source:
private TypeEnv collectTypesForFreeVarsFwd(Node n,TypeEnv env){
  Preconditions.checkArgument(n.isFunction() || n.isName() && NodeUtil.isCallOrNewTarget(n));
  String fnName=n.isFunction() ? symbolTable.getFunInternalName(n) : n.getString();
  NTIScope innerScope=this.currentScope.getScope(fnName);
  for (  String freeVar : innerScope.getOuterVars()) {
    if (innerScope.getDeclaredTypeOf(freeVar) == null) {
      FunctionType summary=summaries.get(innerScope).getFunType();
      JSType outerType=envGetType(env,freeVar);
      if (outerType == null) {
        outerType=UNKNOWN;
      }
      JSType innerType=summary.getOuterVarPrecondition(freeVar);
      if (!innerType.isLoose() && (n.isName() || n.isFunction() && !outerType.isUndefined()) && !JSType.haveCommonSubtype(outerType,innerType)) {
        warnings.add(JSError.make(n,CROSS_SCOPE_GOTCHA,freeVar,outerType.toString(),innerType.toString()));
      }
      env=envPutType(env,freeVar,n.isFunction() ? JSType.join(innerType,outerType) : innerType);
    }
  }
  return env;
}

Fixed version (ground truth):
private TypeEnv collectTypesForFreeVarsFwd(Node n,TypeEnv env){
  Preconditions.checkArgument(n.isFunction() || (n.isName() && NodeUtil.isCallOrNewTarget(n)));
  String fnName=n.isFunction() ? symbolTable.getFunInternalName(n) : n.getString();
  NTIScope innerScope=this.currentScope.getScope(fnName);
  for (  String freeVar : innerScope.getOuterVars()) {
    if (innerScope.getDeclaredTypeOf(freeVar) == null) {
      FunctionType summary=summaries.get(innerScope).getFunType();
      JSType outerType=envGetType(env,freeVar);
      if (outerType == null) {
        outerType=UNKNOWN;
      }
      JSType innerType=summary.getOuterVarPrecondition(freeVar);
      if (!innerType.isLoose() && (n.isName() || (n.isFunction() && !outerType.isUndefined())) && !JSType.haveCommonSubtype(outerType,innerType)) {
        warnings.add(JSError.make(n,CROSS_SCOPE_GOTCHA,freeVar,outerType.toString(),innerType.toString()));
      }
      env=envPutType(env,freeVar,n.isFunction() ? JSType.join(innerType,outerType) : innerType);
    }
  }
  return env;
}
Program: 19336
Project: 19336
Buggy source:
private void validateCatch(Node n){
  validateNodeType(Token.CATCH,n);
  validateChildCount(n);
  Node caught=n.getFirstChild();
  if (caught.isName()) {
    validateName(caught);
  }
 else   if (n.isArrayPattern()) {
    validateArrayPattern(Token.CATCH,caught);
  }
 else {
    validateObjectPattern(Token.CATCH,caught);
  }
  validateBlock(n.getLastChild());
}

Fixed version (ground truth):
private void validateCatch(Node n){
  validateNodeType(Token.CATCH,n);
  validateChildCount(n);
  Node caught=n.getFirstChild();
  if (caught.isName()) {
    validateName(caught);
  }
 else   if (caught.isArrayPattern()) {
    validateArrayPattern(Token.CATCH,caught);
  }
 else {
    validateObjectPattern(Token.CATCH,caught);
  }
  validateBlock(n.getLastChild());
}
Program: 19337
Project: 19337
Buggy source:
/** 
 * Gets the outcome scope if we do know the outcome of the entire expression.
 */
FlowScope getOutcomeFlowScope(Token nodeType,boolean outcome){
  if (nodeType == Token.AND && outcome || nodeType == Token.OR && !outcome) {
    return rightScope;
  }
 else {
    return getJoinedFlowScope();
  }
}

Fixed version (ground truth):
/** 
 * Gets the outcome scope if we do know the outcome of the entire expression.
 */
FlowScope getOutcomeFlowScope(Token nodeType,boolean outcome){
  if ((nodeType == Token.AND && outcome) || (nodeType == Token.OR && !outcome)) {
    return rightScope;
  }
 else {
    return getJoinedFlowScope();
  }
}
Program: 19338
Project: 19338
Buggy source:
/** 
 * @return Whether the alias was recorded.
 */
private boolean maybeRecordAlias(String name,Node parent,@Nullable NameInformation referring,String referringName){
  boolean isPrototypePropAssignment=parent.isAssign() && NodeUtil.isPrototypeProperty(parent.getFirstChild());
  if ((parent.isName() || parent.isAssign()) && !isPrototypePropAssignment && referring != null && scopes.containsEntry(parent,referring)) {
    recordAlias(referringName,name);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return Whether the alias was recorded.
 */
private boolean maybeRecordAlias(String name,Node n,@Nullable NameInformation referring,String referringName){
  Node consumer=getConsumingExpression(n);
  boolean isPrototypePropAssignment=consumer.isAssign() && NodeUtil.isPrototypeProperty(consumer.getFirstChild());
  if ((consumer.isName() || consumer.isAssign()) && !isPrototypePropAssignment && referring != null && scopes.containsEntry(consumer,referring)) {
    recordAlias(referringName,name);
    return true;
  }
  return false;
}
Program: 19340
Project: 19340
Buggy source:
public void testNoRemoveWindowPropertyAlias4(){
  test("String_Node_Str" + "String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testNoRemoveWindowPropertyAlias4(){
  testSame(LINE_JOINER.join("String_Node_Str","String_Node_Str"));
}
Program: 19341
Project: 19341
Buggy source:
public void testNoRemoveWindowPropertyAlias5(){
  test("String_Node_Str" + "String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testNoRemoveWindowPropertyAlias5(){
  testSame(LINE_JOINER.join("String_Node_Str","String_Node_Str"));
}
Program: 19342
Project: 19342
Buggy source:
public void testNoRemoveWindowPropertyAlias4a(){
  test("String_Node_Str" + "String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testNoRemoveWindowPropertyAlias4a(){
  testSame(LINE_JOINER.join("String_Node_Str","String_Node_Str"));
}
Program: 19343
Project: 19343
Buggy source:
public void testNoRemoveWindowPropertyAlias5a(){
  test("String_Node_Str" + "String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testNoRemoveWindowPropertyAlias5a(){
  testSame(LINE_JOINER.join("String_Node_Str","String_Node_Str"));
}
Program: 19344
Project: 19344
Buggy source:
public void testAliasInstanceof5(){
  test("String_Node_Str" + "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 testAliasInstanceof5(){
  testSame(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 19345
Project: 19345
Buggy source:
boolean isGlobalVar(String varName){
  NTIScope s=this;
  while (s.parent != null) {
    if (isDefinedLocally(varName,false)) {
      return false;
    }
    s=s.parent;
  }
  return true;
}

Fixed version (ground truth):
boolean isGlobalVar(String varName){
  NTIScope s=this;
  while (s.parent != null) {
    if (s.isDefinedLocally(varName,false)) {
      return false;
    }
    s=s.parent;
  }
  return true;
}
Program: 19346
Project: 19346
Buggy source:
void addNamespace(Node qnameNode,Namespace ns){
  if (ns instanceof EnumType) {
    this.localEnums.add((EnumType)ns);
  }
  if (qnameNode.isName()) {
    String varName=qnameNode.getString();
    Preconditions.checkState(!this.localNamespaces.containsKey(varName));
    this.localNamespaces.put(varName,ns);
    if (qnameNode.isFromExterns() && !this.externs.containsKey(varName)) {
      this.externs.put(qnameNode.getString(),null);
    }
  }
 else {
    Preconditions.checkState(!isDefined(qnameNode));
    QualifiedName qname=QualifiedName.fromNode(qnameNode);
    Namespace rootns=getNamespace(qname.getLeftmostName());
    rootns.addNamespace(qname.getAllButLeftmost(),ns);
  }
}

Fixed version (ground truth):
void addNamespace(Node qnameNode,Namespace ns){
  if (ns instanceof EnumType) {
    this.localEnums.add((EnumType)ns);
  }
  if (qnameNode.isName()) {
    String varName=qnameNode.getString();
    Preconditions.checkState(!this.localNamespaces.containsKey(varName),"String_Node_Str",varName);
    this.localNamespaces.put(varName,ns);
    if (qnameNode.isFromExterns() && !this.externs.containsKey(varName)) {
      this.externs.put(qnameNode.getString(),null);
    }
  }
 else {
    Preconditions.checkState(!isDefined(qnameNode));
    QualifiedName qname=QualifiedName.fromNode(qnameNode);
    Namespace rootns=getNamespace(qname.getLeftmostName());
    rootns.addNamespace(qname.getAllButLeftmost(),ns);
  }
}
Program: 19347
Project: 19347
Buggy source:
static NominalType join(NominalType c1,NominalType c2){
  if (c1 == null || c2 == null) {
    return null;
  }
  if (c1.isNominalSubtypeOf(c2)) {
    return c2;
  }
  if (c1.isRawSubtypeOf(c2)) {
    return new NominalType(joinTypeMaps(c2.typeMap.keySet(),c1.typeMap,c2.typeMap),c2.rawType);
  }
  if (c2.isNominalSubtypeOf(c1)) {
    return c1;
  }
  if (c2.isRawSubtypeOf(c1)) {
    return new NominalType(joinTypeMaps(c1.typeMap.keySet(),c1.typeMap,c2.typeMap),c1.rawType);
  }
  return null;
}

Fixed version (ground truth):
static NominalType join(NominalType c1,NominalType c2){
  if (c1 == null || c2 == null) {
    return null;
  }
  if (c1.isNominalSubtypeOf(c2)) {
    return c2;
  }
  if (c2.isNominalSubtypeOf(c1)) {
    return c1;
  }
  if (c1.rawType.equals(c2.rawType)) {
    return c1.isGeneric() ? new NominalType(joinTypeMaps(c1,c2),c1.rawType) : c1;
  }
  Preconditions.checkState(!c1.isRawSubtypeOf(c2) && !c2.isRawSubtypeOf(c1));
  return null;
}
Program: 19348
Project: 19348
Buggy source:
private static ImmutableMap<String,JSType> joinTypeMaps(Set<String> domain,ImmutableMap<String,JSType> m1,ImmutableMap<String,JSType> m2){
  ImmutableMap.Builder<String,JSType> builder=ImmutableMap.builder();
  for (  String typevar : domain) {
    JSType t1=m1.get(typevar);
    JSType t2=m2.get(typevar);
    if (t1 == null) {
      builder.put(typevar,Preconditions.checkNotNull(t2));
    }
 else     if (t2 == null) {
      builder.put(typevar,t1);
    }
 else {
      builder.put(typevar,JSType.join(t1,t2));
    }
  }
  return builder.build();
}

Fixed version (ground truth):
private static ImmutableMap<String,JSType> joinTypeMaps(NominalType nt1,NominalType nt2){
  Preconditions.checkState(nt1.rawType.equals(nt2.rawType));
  ImmutableMap.Builder<String,JSType> builder=ImmutableMap.builder();
  if (nt1.isIObject()) {
    String indexTypevar=nt1.rawType.getTypeParameters().get(0);
    builder.put(indexTypevar,JSType.meet(nt1.getIndexType(),nt2.getIndexType()));
    String indexedTypevar=nt1.rawType.getTypeParameters().get(1);
    builder.put(indexedTypevar,JSType.join(nt1.getIndexedType(),nt2.getIndexedType()));
    return builder.build();
  }
  for (  String typevar : nt1.typeMap.keySet()) {
    builder.put(typevar,JSType.join(nt1.typeMap.get(typevar),nt2.typeMap.get(typevar)));
  }
  return builder.build();
}