nus-yam/ex-repair huggingface dataset:
Program: 27263
Project: 27263
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: 27266
Project: 27266
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: 27267
Project: 27267
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: 27270
Project: 27270
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: 27271
Project: 27271
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: 27272
Project: 27272
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: 27274
Project: 27274
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: 27275
Project: 27275
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: 27276
Project: 27276
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: 27277
Project: 27277
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: 27278
Project: 27278
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: 27279
Project: 27279
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: 27280
Project: 27280
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: 27281
Project: 27281
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: 27282
Project: 27282
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();
}
Program: 27283
Project: 27283
Buggy source:
static ObjectType join(ObjectType obj1,ObjectType obj2){
  if (obj1.isTopObject() || obj2.isTopObject()) {
    return obj1.commonTypes.getTopObjectType();
  }
  if (obj1.equals(obj2)) {
    return obj1;
  }
 else   if (obj1.isPrototypeObject() && obj2.isPrototypeObject()) {
    return join(obj1.getNominalType().getInstanceAsObjectType(),obj2.getNominalType().getInstanceAsObjectType());
  }
  NominalType nt1=obj1.nominalType;
  NominalType nt2=obj2.nominalType;
  Preconditions.checkState(nt1.isRawSubtypeOf(nt2) || nt2.isRawSubtypeOf(nt1));
  JSTypes commonTypes=obj1.commonTypes;
  boolean isLoose=obj1.isLoose || obj2.isLoose;
  FunctionType fn=FunctionType.join(obj1.fn,obj2.fn);
  PersistentMap<String,Property> props;
  if (isLoose) {
    fn=fn == null ? null : fn.withLoose();
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=joinProps(obj1.props,obj2.props,nt1,nt2);
  }
  NominalType nominal=NominalType.join(nt1,nt2);
  if (nominal.isBuiltinObject() && fn != null) {
    if (isLoose) {
      nominal=obj1.commonTypes.getFunctionType();
    }
 else {
      fn=null;
    }
  }
  Namespace ns=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return makeObjectType(commonTypes,nominal,props,fn,ns,isLoose,ObjectKind.join(obj1.objectKind,obj2.objectKind));
}

Fixed version (ground truth):
static ObjectType join(ObjectType obj1,ObjectType obj2){
  if (obj1.isTopObject() || obj2.isTopObject()) {
    return obj1.commonTypes.getTopObjectType();
  }
  if (obj1.equals(obj2)) {
    return obj1;
  }
  if (obj1.isPrototypeObject() && obj2.isPrototypeObject()) {
    return join(obj1.getNominalType().getInstanceAsObjectType(),obj2.getNominalType().getInstanceAsObjectType());
  }
  NominalType nt1=obj1.nominalType;
  NominalType nt2=obj2.nominalType;
  Preconditions.checkState(nt1.isRawSubtypeOf(nt2) || nt2.isRawSubtypeOf(nt1));
  JSTypes commonTypes=obj1.commonTypes;
  boolean isLoose=obj1.isLoose || obj2.isLoose;
  FunctionType fn=FunctionType.join(obj1.fn,obj2.fn);
  PersistentMap<String,Property> props;
  if (isLoose) {
    fn=fn == null ? null : fn.withLoose();
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=joinProps(obj1.props,obj2.props,nt1,nt2);
  }
  NominalType nominal=NominalType.join(nt1,nt2);
  if (nominal.isBuiltinObject() && fn != null) {
    if (isLoose) {
      nominal=obj1.commonTypes.getFunctionType();
    }
 else {
      fn=null;
    }
  }
  Namespace ns=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return makeObjectType(commonTypes,nominal,props,fn,ns,isLoose,ObjectKind.join(obj1.objectKind,obj2.objectKind));
}
Program: 27284
Project: 27284
Buggy source:
static ImmutableSet<ObjectType> meetSetsHelper(boolean specializeObjs1,Set<ObjectType> objs1,Set<ObjectType> objs2){
  ObjectsBuilder newObjs=new ObjectsBuilder(ResolveConflictsBy.MEET);
  for (  ObjectType obj2 : objs2) {
    for (    ObjectType obj1 : objs1) {
      if (areRelatedNominalTypes(obj1.nominalType,obj2.nominalType)) {
        ObjectType newObj;
        if (specializeObjs1) {
          newObj=obj1.specialize(obj2);
          if (newObj == null) {
            continue;
          }
        }
 else {
          newObj=meet(obj1,obj2);
        }
        newObjs.add(newObj);
      }
 else       if (obj1.nominalType.isStructuralInterface() && obj2.isSubtypeOf(obj1,SubtypeCache.create())) {
        newObjs.add(obj2);
      }
 else       if (obj2.nominalType.isStructuralInterface() && obj1.isSubtypeOf(obj2,SubtypeCache.create())) {
        newObjs.add(obj1);
      }
    }
  }
  return newObjs.build();
}

Fixed version (ground truth):
static ImmutableSet<ObjectType> meetSetsHelper(boolean specializeObjs1,Set<ObjectType> objs1,Set<ObjectType> objs2){
  ObjectsBuilder newObjs=new ObjectsBuilder();
  for (  ObjectType obj2 : objs2) {
    for (    ObjectType obj1 : objs1) {
      if (areRelatedNominalTypes(obj1.nominalType,obj2.nominalType)) {
        ObjectType newObj;
        if (specializeObjs1) {
          newObj=obj1.specialize(obj2);
          if (newObj == null) {
            continue;
          }
        }
 else {
          newObj=meet(obj1,obj2);
        }
        newObjs.add(newObj);
      }
 else       if (obj1.nominalType.isStructuralInterface() && obj2.isSubtypeOf(obj1,SubtypeCache.create())) {
        newObjs.add(obj2);
      }
 else       if (obj2.nominalType.isStructuralInterface() && obj1.isSubtypeOf(obj2,SubtypeCache.create())) {
        newObjs.add(obj1);
      }
    }
  }
  return newObjs.build();
}
Program: 27285
Project: 27285
Buggy source:
static ImmutableSet<ObjectType> joinSets(ImmutableSet<ObjectType> objs1,ImmutableSet<ObjectType> objs2){
  if (objs1.isEmpty()) {
    return objs2;
  }
 else   if (objs2.isEmpty()) {
    return objs1;
  }
  ObjectType[] objs1Arr=objs1.toArray(new ObjectType[0]);
  ObjectType[] keptFrom1=Arrays.copyOf(objs1Arr,objs1Arr.length);
  ObjectsBuilder newObjs=new ObjectsBuilder(ResolveConflictsBy.JOIN);
  for (  ObjectType obj2 : objs2) {
    boolean addedObj2=false;
    for (int i=0; i < objs1Arr.length; i++) {
      ObjectType obj1=objs1Arr[i];
      NominalType nt1=obj1.nominalType;
      NominalType nt2=obj2.nominalType;
      if (areRelatedNominalTypes(nt1,nt2)) {
        if ((nt2.isBuiltinObject() && nt1 != null && !obj1.isSubtypeOf(obj2,SubtypeCache.create())) || (nt1.isBuiltinObject() && nt2 != null && !obj2.isSubtypeOf(obj1,SubtypeCache.create()))) {
          break;
        }
        keptFrom1[i]=null;
        addedObj2=true;
        newObjs.add(join(obj1,obj2));
        break;
      }
    }
    if (!addedObj2) {
      newObjs.add(obj2);
    }
  }
  for (  ObjectType o : keptFrom1) {
    if (o != null) {
      newObjs.add(o);
    }
  }
  return newObjs.build();
}

Fixed version (ground truth):
static ImmutableSet<ObjectType> joinSets(ImmutableSet<ObjectType> objs1,ImmutableSet<ObjectType> objs2){
  if (objs1.isEmpty()) {
    return objs2;
  }
 else   if (objs2.isEmpty()) {
    return objs1;
  }
  List<ObjectType> objs=new ArrayList<>(objs1);
  objs.addAll(objs2);
  for (int i=0; i < objs.size() - 1; i++) {
    ObjectType obj1=objs.get(i);
    NominalType nt1=obj1.nominalType;
    for (int j=i + 1; j < objs.size(); j++) {
      ObjectType obj2=objs.get(j);
      NominalType nt2=obj2.nominalType;
      if (nt1.isBuiltinObject() && nt2.isBuiltinObject()) {
        objs.set(i,null);
        objs.set(j,join(obj1,obj2));
      }
 else       if ((areRelatedNominalTypes(nt1,nt2) || NominalType.equalRawTypes(nt1,nt2)) && (!nt1.isBuiltinObject() || obj2.isSubtypeOf(obj1,SubtypeCache.create())) && (!nt2.isBuiltinObject() || obj1.isSubtypeOf(obj2,SubtypeCache.create()))) {
        objs.set(i,null);
        objs.set(j,join(obj1,obj2));
      }
    }
  }
  ImmutableSet.Builder<ObjectType> builder=ImmutableSet.builder();
  for (  ObjectType obj : objs) {
    if (obj != null) {
      builder.add(obj);
    }
  }
  return builder.build();
}
Program: 27286
Project: 27286
Buggy source:
static ObjectType meet(ObjectType obj1,ObjectType obj2){
  Preconditions.checkState(areRelatedNominalTypes(obj1.nominalType,obj2.nominalType));
  if (obj1.isTopObject() || obj2.isBottomObject()) {
    return obj2;
  }
 else   if (obj2.isTopObject() || obj1.isBottomObject()) {
    return obj1;
  }
  JSTypes commonTypes=obj1.commonTypes;
  NominalType resultNomType=NominalType.pickSubclass(obj1.nominalType,obj2.nominalType);
  FunctionType fn=FunctionType.meet(obj1.fn,obj2.fn);
  if (!FunctionType.isInhabitable(fn)) {
    return commonTypes.getBottomObject();
  }
  boolean isLoose=(obj1.isLoose && obj2.isLoose) || fn != null && fn.isLoose();
  if (resultNomType.isFunction() && fn == null) {
    fn=obj1.fn == null ? obj2.fn : obj1.fn;
    isLoose=fn.isLoose();
  }
  PersistentMap<String,Property> props;
  if (isLoose) {
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=meetPropsHelper(commonTypes,false,resultNomType,obj1.props,obj2.props);
  }
  if (props == commonTypes.BOTTOM_PROPERTY_MAP) {
    return commonTypes.getBottomObject();
  }
  ObjectKind ok=ObjectKind.meet(obj1.objectKind,obj2.objectKind);
  Namespace resultNs=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return new ObjectType(commonTypes,resultNomType,props,fn,resultNs,isLoose,ok);
}

Fixed version (ground truth):
static ObjectType meet(ObjectType obj1,ObjectType obj2){
  NominalType nt1=obj1.nominalType;
  NominalType nt2=obj2.nominalType;
  Preconditions.checkState(areRelatedNominalTypes(nt1,nt2),"String_Node_Str",nt1,nt2);
  if (obj1.isTopObject() || obj2.isBottomObject()) {
    return obj2;
  }
 else   if (obj2.isTopObject() || obj1.isBottomObject()) {
    return obj1;
  }
  JSTypes commonTypes=obj1.commonTypes;
  NominalType resultNomType=NominalType.pickSubclass(nt1,nt2);
  FunctionType fn=FunctionType.meet(obj1.fn,obj2.fn);
  if (!FunctionType.isInhabitable(fn)) {
    return commonTypes.getBottomObject();
  }
  boolean isLoose=(obj1.isLoose && obj2.isLoose) || fn != null && fn.isLoose();
  if (resultNomType.isFunction() && fn == null) {
    fn=obj1.fn == null ? obj2.fn : obj1.fn;
    isLoose=fn.isLoose();
  }
  PersistentMap<String,Property> props;
  if (isLoose) {
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=meetPropsHelper(commonTypes,false,resultNomType,obj1.props,obj2.props);
  }
  if (props == commonTypes.BOTTOM_PROPERTY_MAP) {
    return commonTypes.getBottomObject();
  }
  ObjectKind ok=ObjectKind.meet(obj1.objectKind,obj2.objectKind);
  Namespace resultNs=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return new ObjectType(commonTypes,resultNomType,props,fn,resultNs,isLoose,ok);
}
Program: 27287
Project: 27287
Buggy source:
void add(ObjectType newObj){
  boolean addedObj=false;
  for (int i=0; i < this.objs.size(); i++) {
    ObjectType oldObj=this.objs.get(i);
    if (NominalType.equalRawTypes(oldObj.getNominalType(),newObj.getNominalType())) {
      addedObj=true;
      if (this.resolution == ResolveConflictsBy.JOIN) {
        this.objs.set(i,ObjectType.join(oldObj,newObj));
      }
 else {
        this.objs.set(i,ObjectType.meet(oldObj,newObj));
      }
    }
  }
  if (!addedObj) {
    this.objs.add(newObj);
  }
}

Fixed version (ground truth):
void add(ObjectType newObj){
  boolean addedObj=false;
  for (int i=0; i < this.objs.size(); i++) {
    ObjectType oldObj=this.objs.get(i);
    if (NominalType.equalRawTypes(oldObj.getNominalType(),newObj.getNominalType())) {
      addedObj=true;
      this.objs.set(i,ObjectType.meet(oldObj,newObj));
    }
  }
  if (!addedObj) {
    this.objs.add(newObj);
  }
}
Program: 27288
Project: 27288
Buggy source:
ObjectsBuilder(ResolveConflictsBy resolution){
  this.resolution=resolution;
  this.objs=new ArrayList<>();
}

Fixed version (ground truth):
ObjectsBuilder(){
  this.objs=new ArrayList<>();
}
Program: 27291
Project: 27291
Buggy source:
public void testComplexFunctionWithFunctionDefinition2a(){
  assumeMinimumCapture=false;
  test("String_Node_Str",LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  assumeMinimumCapture=true;
  test("String_Node_Str" + "String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testComplexFunctionWithFunctionDefinition2a(){
  assumeMinimumCapture=false;
  testSame("String_Node_Str" + "String_Node_Str");
  assumeMinimumCapture=true;
  test("String_Node_Str" + "String_Node_Str","String_Node_Str");
}
Program: 27292
Project: 27292
Buggy source:
public void testShadowVariables16(){
  assumeMinimumCapture=false;
  test(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),"String_Node_Str");
  assumeMinimumCapture=true;
  test(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),"String_Node_Str");
}

Fixed version (ground truth):
public void testShadowVariables16(){
  assumeMinimumCapture=false;
  test("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assumeMinimumCapture=true;
  test("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}
Program: 27293
Project: 27293
Buggy source:
public void testAnonymous3(){
  assumeMinimumCapture=false;
  test("String_Node_Str","String_Node_Str");
  assumeMinimumCapture=true;
  test("String_Node_Str","String_Node_Str");
  test("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testAnonymous3(){
  assumeMinimumCapture=false;
  testSame("String_Node_Str");
  assumeMinimumCapture=true;
  test("String_Node_Str","String_Node_Str");
  test("String_Node_Str","String_Node_Str");
}
Program: 27294
Project: 27294
Buggy source:
public void testAnonymous1(){
  assumeMinimumCapture=false;
  test("String_Node_Str",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"));
  assumeMinimumCapture=true;
  test("String_Node_Str",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 testAnonymous1(){
  assumeMinimumCapture=false;
  test("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  assumeMinimumCapture=true;
  test("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}
Program: 27295
Project: 27295
Buggy source:
public void testShadowVariables7(){
  assumeMinimumCapture=false;
  test(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),"String_Node_Str");
  assumeMinimumCapture=true;
  test(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"),"String_Node_Str");
}

Fixed version (ground truth):
public void testShadowVariables7(){
  assumeMinimumCapture=false;
  test("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assumeMinimumCapture=true;
  test("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}
Program: 27296
Project: 27296
Buggy source:
public void testAddFunctionProperties3() throws Exception {
  String source=LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  String expected="String_Node_Str";
  CompilerOptions options=createCompilerOptions();
  CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
  options.setRenamingPolicy(VariableRenamingPolicy.OFF,PropertyRenamingPolicy.OFF);
  options.setCheckTypes(false);
  test(options,source,expected);
}

Fixed version (ground truth):
public void testAddFunctionProperties3() throws Exception {
  String source="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  String expected="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str";
  CompilerOptions options=createCompilerOptions();
  CompilationLevel.ADVANCED_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
  options.setRenamingPolicy(VariableRenamingPolicy.OFF,PropertyRenamingPolicy.OFF);
  options.setCheckTypes(false);
  test(options,source,expected);
}
Program: 27297
Project: 27297
Buggy source:
public static MismatchInfo whyNotSubtypeOf(JSType t1,JSType t2){
  if (t1.isSingletonObj() && t2.isSingletonObj()) {
    MismatchInfo[] boxedInfo=new MismatchInfo[1];
    ObjectType.whyNotSubtypeOf(t1.getObjTypeIfSingletonObj(),t2.getObjTypeIfSingletonObj(),boxedInfo);
    return boxedInfo[0];
  }
  if (t1.isUnion()) {
    MismatchInfo[] boxedInfo=new MismatchInfo[1];
    boolean areSubtypes=t1.isSubtypeOfHelper(true,t2,SubtypeCache.create(),boxedInfo);
    Preconditions.checkState(!areSubtypes);
    return boxedInfo[0];
  }
  return null;
}

Fixed version (ground truth):
public static MismatchInfo whyNotSubtypeOf(JSType found,JSType expected){
  if (found.isSingletonObj() && expected.isSingletonObj()) {
    MismatchInfo[] boxedInfo=new MismatchInfo[1];
    ObjectType.whyNotSubtypeOf(found.getObjTypeIfSingletonObj(),expected.getObjTypeIfSingletonObj(),boxedInfo);
    return boxedInfo[0];
  }
  if (found.isUnion()) {
    MismatchInfo[] boxedInfo=new MismatchInfo[1];
    boolean areSubtypes=found.isSubtypeOfHelper(true,expected,SubtypeCache.create(),boxedInfo);
    Preconditions.checkState(!areSubtypes);
    return boxedInfo[0];
  }
  return null;
}
Program: 27298
Project: 27298
Buggy source:
private ObjectType withLoose(){
  if (isTopObject()) {
    return this.commonTypes.getLooseTopObjectType();
  }
  if (isLoose() || this.nominalType != null && this.nominalType.isClassy() || this.ns != null) {
    return this;
  }
  FunctionType fn=this.fn == null ? null : this.fn.withLoose();
  PersistentMap<String,Property> newProps=PersistentMap.create();
  for (  Map.Entry<String,Property> propsEntry : this.props.entrySet()) {
    String pname=propsEntry.getKey();
    Property prop=propsEntry.getValue();
    newProps=newProps.with(pname,prop.withRequired());
  }
  return new ObjectType(this.commonTypes,this.nominalType,newProps,fn,null,true,this.objectKind);
}

Fixed version (ground truth):
private ObjectType withLoose(){
  if (isTopObject()) {
    return this.commonTypes.getLooseTopObjectType();
  }
  if (isLoose() || (!this.nominalType.isBuiltinObject() && !this.nominalType.isFunction()) || this.ns != null) {
    return this;
  }
  FunctionType fn=this.fn == null ? null : this.fn.withLoose();
  PersistentMap<String,Property> newProps=PersistentMap.create();
  for (  Map.Entry<String,Property> propsEntry : this.props.entrySet()) {
    String pname=propsEntry.getKey();
    Property prop=propsEntry.getValue();
    newProps=newProps.with(pname,prop.withRequired());
  }
  return new ObjectType(this.commonTypes,this.nominalType,newProps,fn,null,true,this.objectKind);
}
Program: 27299
Project: 27299
Buggy source:
private ObjectType(JSTypes commonTypes,NominalType nominalType,PersistentMap<String,Property> props,FunctionType fn,Namespace ns,boolean isLoose,ObjectKind objectKind){
  Preconditions.checkNotNull(commonTypes);
  Preconditions.checkNotNull(nominalType);
  Preconditions.checkArgument(fn == null || fn.isQmarkFunction() || fn.isLoose() == isLoose,"String_Node_Str",isLoose,fn);
  Preconditions.checkArgument(FunctionType.isInhabitable(fn));
  if (ns != null) {
    String name=nominalType.getName();
    Preconditions.checkArgument(name.equals(JSTypes.OBJLIT_CLASS_NAME) || name.equals("String_Node_Str") || name.equals("String_Node_Str"),"String_Node_Str",name);
  }
  Preconditions.checkArgument(!nominalType.isClassy() || !isLoose,"String_Node_Str",nominalType);
  Preconditions.checkArgument(fn == null || nominalType.isFunction(),"String_Node_Str",nominalType,fn);
  this.commonTypes=commonTypes;
  this.nominalType=nominalType;
  this.props=isLoose ? loosenProps(props) : props;
  this.fn=fn;
  this.ns=ns;
  this.isLoose=isLoose;
  this.objectKind=isLoose ? ObjectKind.UNRESTRICTED : objectKind;
}

Fixed version (ground truth):
private ObjectType(JSTypes commonTypes,NominalType nominalType,PersistentMap<String,Property> props,FunctionType fn,Namespace ns,boolean isLoose,ObjectKind objectKind){
  Preconditions.checkNotNull(commonTypes);
  Preconditions.checkNotNull(nominalType);
  Preconditions.checkArgument(fn == null || fn.isQmarkFunction() || fn.isLoose() == isLoose,"String_Node_Str",isLoose,fn);
  Preconditions.checkArgument(FunctionType.isInhabitable(fn));
  if (ns != null) {
    String name=nominalType.getName();
    Preconditions.checkArgument(name.equals(JSTypes.OBJLIT_CLASS_NAME) || name.equals("String_Node_Str") || name.equals("String_Node_Str"),"String_Node_Str",name);
  }
  if (isLoose) {
    Preconditions.checkArgument(nominalType.isBuiltinObject() || nominalType.isFunction(),"String_Node_Str",nominalType);
  }
  Preconditions.checkArgument(fn == null || nominalType.isFunction(),"String_Node_Str",nominalType,fn);
  this.commonTypes=commonTypes;
  this.nominalType=nominalType;
  this.props=isLoose ? loosenProps(props) : props;
  this.fn=fn;
  this.ns=ns;
  this.isLoose=isLoose;
  this.objectKind=isLoose ? ObjectKind.UNRESTRICTED : objectKind;
}
Program: 27300
Project: 27300
Buggy source:
StringBuilder appendTo(StringBuilder builder){
  if (isPrototypeObject()) {
    return builder.append(getOwnerFunction().getThisType()).append("String_Node_Str");
  }
  if (!hasNonPrototypeProperties()) {
    if (fn != null) {
      return fn.appendTo(builder);
    }
 else     if (this.nominalType != null) {
      return this.nominalType.appendTo(builder);
    }
  }
  if (!nominalType.getName().equals("String_Node_Str") && !nominalType.getName().equals("String_Node_Str") && !nominalType.getName().equals(JSTypes.OBJLIT_CLASS_NAME)) {
    nominalType.appendTo(builder);
  }
 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);
    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(':');
      props.get(pname).appendTo(builder);
    }
    builder.append('}');
  }
  if (isLoose) {
    builder.append("String_Node_Str");
  }
  return builder;
}

Fixed version (ground truth):
StringBuilder appendTo(StringBuilder builder){
  if (isPrototypeObject()) {
    return builder.append(getOwnerFunction().getThisType()).append("String_Node_Str");
  }
  if (!hasNonPrototypeProperties()) {
    if (fn != null) {
      return fn.appendTo(builder);
    }
    return this.nominalType.appendTo(builder);
  }
  if (!nominalType.getName().equals("String_Node_Str") && !nominalType.getName().equals("String_Node_Str") && !nominalType.getName().equals(JSTypes.OBJLIT_CLASS_NAME)) {
    nominalType.appendTo(builder);
  }
 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);
    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(':');
      props.get(pname).appendTo(builder);
    }
    builder.append('}');
  }
  if (isLoose) {
    builder.append("String_Node_Str");
  }
  return builder;
}
Program: 27301
Project: 27301
Buggy source:
private Property getLeftmostProp(QualifiedName qname){
  String pname=qname.getLeftmostName();
  Property p=props.get(pname);
  if (p != null) {
    return p;
  }
  if (this.ns != null) {
    p=this.ns.getNsProp(pname);
    if (p != null) {
      return p;
    }
  }
  if (this.nominalType != null) {
    return this.nominalType.getProp(pname);
  }
  if (this.commonTypes.getObjectType() != null) {
    return this.commonTypes.getObjectType().getProp(pname);
  }
  return null;
}

Fixed version (ground truth):
private Property getLeftmostProp(QualifiedName qname){
  String pname=qname.getLeftmostName();
  Property p=props.get(pname);
  if (p != null) {
    return p;
  }
  if (this.ns != null) {
    p=this.ns.getNsProp(pname);
    if (p != null) {
      return p;
    }
  }
  return this.nominalType.getProp(pname);
}
Program: 27302
Project: 27302
Buggy source:
static void whyNotSubtypeOf(ObjectType obj1,ObjectType obj2,MismatchInfo[] boxedInfo){
  Preconditions.checkArgument(boxedInfo.length == 1);
  boolean areSubtypes=obj1.isSubtypeOfHelper(true,obj2,SubtypeCache.create(),boxedInfo);
  Preconditions.checkState(!areSubtypes);
}

Fixed version (ground truth):
static void whyNotSubtypeOf(ObjectType obj1,ObjectType obj2,MismatchInfo[] boxedInfo){
  Preconditions.checkArgument(boxedInfo.length == 1);
  boolean areSubtypes=obj1.isSubtypeOfHelper(true,obj2,SubtypeCache.create(),boxedInfo);
  Preconditions.checkState(!areSubtypes,"String_Node_Str",obj1,obj2);
}
Program: 27303
Project: 27303
Buggy source:
boolean isInterfaceInstance(){
  return this.nominalType != null && this.nominalType.isInterface();
}

Fixed version (ground truth):
boolean isInterfaceInstance(){
  return this.nominalType.isInterface();
}
Program: 27304
Project: 27304
Buggy source:
static ObjectType meet(ObjectType obj1,ObjectType obj2){
  Preconditions.checkState(areRelatedNominalTypes(obj1.nominalType,obj2.nominalType));
  if (obj1.isTopObject() || obj2.isBottomObject()) {
    return obj2;
  }
 else   if (obj2.isTopObject() || obj1.isBottomObject()) {
    return obj1;
  }
  JSTypes commonTypes=obj1.commonTypes;
  NominalType resultNomType=NominalType.pickSubclass(obj1.nominalType,obj2.nominalType);
  FunctionType fn=FunctionType.meet(obj1.fn,obj2.fn);
  if (!FunctionType.isInhabitable(fn)) {
    return commonTypes.getBottomObject();
  }
  boolean isLoose=obj1.isLoose && obj2.isLoose || fn != null && fn.isLoose();
  if (resultNomType.isFunction() && fn == null) {
    fn=obj1.fn == null ? obj2.fn : obj1.fn;
    isLoose=fn.isLoose();
  }
  PersistentMap<String,Property> props;
  if (isLoose) {
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=meetPropsHelper(commonTypes,false,resultNomType,obj1.props,obj2.props);
  }
  if (props == commonTypes.BOTTOM_PROPERTY_MAP) {
    return commonTypes.getBottomObject();
  }
  ObjectKind ok=ObjectKind.meet(obj1.objectKind,obj2.objectKind);
  Namespace resultNs=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return new ObjectType(commonTypes,resultNomType,props,fn,resultNs,isLoose,ok);
}

Fixed version (ground truth):
static ObjectType meet(ObjectType obj1,ObjectType obj2){
  Preconditions.checkState(areRelatedNominalTypes(obj1.nominalType,obj2.nominalType));
  if (obj1.isTopObject() || obj2.isBottomObject()) {
    return obj2;
  }
 else   if (obj2.isTopObject() || obj1.isBottomObject()) {
    return obj1;
  }
  JSTypes commonTypes=obj1.commonTypes;
  NominalType resultNomType=NominalType.pickSubclass(obj1.nominalType,obj2.nominalType);
  FunctionType fn=FunctionType.meet(obj1.fn,obj2.fn);
  if (!FunctionType.isInhabitable(fn)) {
    return commonTypes.getBottomObject();
  }
  boolean isLoose=(obj1.isLoose && obj2.isLoose) || fn != null && fn.isLoose();
  if (resultNomType.isFunction() && fn == null) {
    fn=obj1.fn == null ? obj2.fn : obj1.fn;
    isLoose=fn.isLoose();
  }
  PersistentMap<String,Property> props;
  if (isLoose) {
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=meetPropsHelper(commonTypes,false,resultNomType,obj1.props,obj2.props);
  }
  if (props == commonTypes.BOTTOM_PROPERTY_MAP) {
    return commonTypes.getBottomObject();
  }
  ObjectKind ok=ObjectKind.meet(obj1.objectKind,obj2.objectKind);
  Namespace resultNs=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return new ObjectType(commonTypes,resultNomType,props,fn,resultNs,isLoose,ok);
}
Program: 27308
Project: 27308
Buggy source:
private static JSType joinNominalTypes(JSType nt1,JSType nt2){
  if (nt1 == null || nt2 == null) {
    return null;
  }
  NominalType n1=getNominalTypeIfSingletonObj(nt1);
  NominalType n2=getNominalTypeIfSingletonObj(nt2);
  if (n1 != null && n2 != null) {
    NominalType tmp=NominalType.pickSuperclass(n1,n2);
    if (tmp != null) {
      return tmp.getInstanceAsJSType();
    }
  }
  return JSType.join(nt1,nt2);
}

Fixed version (ground truth):
private static JSType joinNominalTypes(JSType nt1,JSType nt2){
  if (nt1 == null || nt2 == null) {
    return null;
  }
  NominalType n1=getNominalTypeIfSingletonObj(nt1);
  NominalType n2=getNominalTypeIfSingletonObj(nt2);
  if (n1 != null && n2 != null) {
    NominalType tmp=NominalType.join(n1,n2);
    if (tmp != null) {
      return tmp.getInstanceAsJSType();
    }
  }
  return JSType.join(nt1,nt2);
}
Program: 27309
Project: 27309
Buggy source:
static ObjectType join(ObjectType obj1,ObjectType obj2){
  if (obj1.isTopObject() || obj2.isTopObject()) {
    return obj1.commonTypes.getTopObjectType();
  }
  if (obj1.equals(obj2)) {
    return obj1;
  }
  NominalType nt1=obj1.nominalType;
  NominalType nt2=obj2.nominalType;
  Preconditions.checkState(nt1.isRawSubtypeOf(nt2) || nt2.isRawSubtypeOf(nt1));
  JSTypes commonTypes=obj1.commonTypes;
  boolean isLoose=obj1.isLoose || obj2.isLoose;
  FunctionType fn=FunctionType.join(obj1.fn,obj2.fn);
  PersistentMap<String,Property> props;
  if (isLoose) {
    fn=fn == null ? null : fn.withLoose();
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=joinProps(obj1.props,obj2.props,nt1,nt2);
  }
  NominalType nominal=NominalType.pickSuperclass(nt1,nt2);
  if (nominal.isBuiltinObject() && fn != null) {
    if (isLoose) {
      nominal=obj1.commonTypes.getFunctionType();
    }
 else {
      fn=null;
    }
  }
  Namespace ns=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return makeObjectType(commonTypes,nominal,props,fn,ns,isLoose,ObjectKind.join(obj1.objectKind,obj2.objectKind));
}

Fixed version (ground truth):
static ObjectType join(ObjectType obj1,ObjectType obj2){
  if (obj1.isTopObject() || obj2.isTopObject()) {
    return obj1.commonTypes.getTopObjectType();
  }
  if (obj1.equals(obj2)) {
    return obj1;
  }
  NominalType nt1=obj1.nominalType;
  NominalType nt2=obj2.nominalType;
  Preconditions.checkState(nt1.isRawSubtypeOf(nt2) || nt2.isRawSubtypeOf(nt1));
  JSTypes commonTypes=obj1.commonTypes;
  boolean isLoose=obj1.isLoose || obj2.isLoose;
  FunctionType fn=FunctionType.join(obj1.fn,obj2.fn);
  PersistentMap<String,Property> props;
  if (isLoose) {
    fn=fn == null ? null : fn.withLoose();
    props=joinPropsLoosely(commonTypes,obj1.props,obj2.props);
  }
 else {
    props=joinProps(obj1.props,obj2.props,nt1,nt2);
  }
  NominalType nominal=NominalType.join(nt1,nt2);
  if (nominal.isBuiltinObject() && fn != null) {
    if (isLoose) {
      nominal=obj1.commonTypes.getFunctionType();
    }
 else {
      fn=null;
    }
  }
  Namespace ns=Objects.equals(obj1.ns,obj2.ns) ? obj1.ns : null;
  return makeObjectType(commonTypes,nominal,props,fn,ns,isLoose,ObjectKind.join(obj1.objectKind,obj2.objectKind));
}
Program: 27310
Project: 27310
Buggy source:
public void testOnlyOneInstanceOfEachClassInUnion(){
  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","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","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","String_Node_Str","String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public void testOnlyOneInstanceOfEachClassInUnion(){
  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","String_Node_Str","String_Node_Str"),NewTypeInference.MISTYPED_ASSIGN_RHS);
  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","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","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","String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 27311
Project: 27311
Buggy source:
private JSType evalTemplateTypeOf(Node ttlAst,NameResolver nameResolver){
  ImmutableList<Node> params=getCallParams(ttlAst);
  JSType type=evalInternal(params.get(0),nameResolver);
  if (!type.isTemplatizedType()) {
    reportWarning(ttlAst,TEMPTYPE_INVALID,"String_Node_Str",type.toString());
    return getUnknownType();
  }
  int index=(int)params.get(1).getDouble();
  ImmutableList<JSType> templateTypes=((TemplatizedType)type).getTemplateTypes();
  if (index > templateTypes.size()) {
    reportWarning(ttlAst,INDEX_OUTOFBOUNDS,Integer.toString(index),Integer.toString(templateTypes.size()));
    return getUnknownType();
  }
  return templateTypes.get(index);
}

Fixed version (ground truth):
private JSType evalTemplateTypeOf(Node ttlAst,NameResolver nameResolver){
  ImmutableList<Node> params=getCallParams(ttlAst);
  JSType type=evalInternal(params.get(0),nameResolver);
  if (!type.isTemplatizedType()) {
    reportWarning(ttlAst,TEMPTYPE_INVALID,"String_Node_Str",type.toString());
    return getUnknownType();
  }
  int index=(int)params.get(1).getDouble();
  ImmutableList<JSType> templateTypes=((TemplatizedType)type).getTemplateTypes();
  if (index >= templateTypes.size()) {
    reportWarning(ttlAst,INDEX_OUTOFBOUNDS,Integer.toString(index),Integer.toString(templateTypes.size()));
    return getUnknownType();
  }
  return templateTypes.get(index);
}
Program: 27312
Project: 27312
Buggy source:
/** 
 * This may start a new line if the current line is longer than the line length threshold.
 */
@Override void maybeCutLine(){
  if (lineLength > lineLengthThreshold) {
    if (preferredBreakPosition > lineStartPosition && preferredBreakPosition < lineStartPosition + lineLength) {
      int position=preferredBreakPosition;
      code.insert(position,'\n');
      prevCutPosition=position;
      reportLineCut(lineIndex,position - lineStartPosition,true);
      lineIndex++;
      lineLength-=(position - lineStartPosition);
      lineStartPosition=position + 1;
    }
 else {
      startNewLine();
    }
  }
}

Fixed version (ground truth):
/** 
 * This may start a new line if the current line is longer than the line length threshold.
 */
@Override void maybeCutLine(){
  if (lineLength > lineLengthThreshold) {
    if (preferredBreakPosition > lineStartPosition && preferredBreakPosition < lineStartPosition + lineLength) {
      int position=preferredBreakPosition;
      code.insert(position,'\n');
      prevCutPosition=position;
      reportLineCut(lineIndex,position - lineStartPosition,true);
      lineIndex++;
      lineLength-=(position - lineStartPosition);
      prevLineStartPosition=lineStartPosition;
      lineStartPosition=position + 1;
    }
 else {
      startNewLine();
    }
  }
}