nus-yam/ex-repair huggingface dataset:
Program: 19349
Project: 19349
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: 19350
Project: 19350
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: 19351
Project: 19351
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: 19352
Project: 19352
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: 19353
Project: 19353
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: 19354
Project: 19354
Buggy source:
ObjectsBuilder(ResolveConflictsBy resolution){
  this.resolution=resolution;
  this.objs=new ArrayList<>();
}

Fixed version (ground truth):
ObjectsBuilder(){
  this.objs=new ArrayList<>();
}
Program: 19357
Project: 19357
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: 19358
Project: 19358
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: 19359
Project: 19359
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: 19360
Project: 19360
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: 19361
Project: 19361
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: 19362
Project: 19362
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: 19365
Project: 19365
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: 19366
Project: 19366
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: 19367
Project: 19367
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: 19368
Project: 19368
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: 19369
Project: 19369
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: 19370
Project: 19370
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: 19371
Project: 19371
Buggy source:
boolean isInterfaceInstance(){
  return this.nominalType != null && this.nominalType.isInterface();
}

Fixed version (ground truth):
boolean isInterfaceInstance(){
  return this.nominalType.isInterface();
}
Program: 19372
Project: 19372
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: 19374
Project: 19374
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: 19375
Project: 19375
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: 19376
Project: 19376
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: 19377
Project: 19377
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();
    }
  }
}
Program: 19378
Project: 19378
Buggy source:
@Override void endFile(){
  super.endFile();
  if (!preferLineBreakAtEndOfFile) {
    return;
  }
  if (lineLength > lineLengthThreshold / 2) {
    append("String_Node_Str");
    startNewLine();
  }
 else   if (prevCutPosition > 0) {
    code.setCharAt(prevCutPosition,' ');
    lineStartPosition=prevLineStartPosition;
    lineLength=code.length() - lineStartPosition;
    reportLineCut(lineIndex,prevCutPosition + 1,false);
    lineIndex--;
    prevCutPosition=0;
    prevLineStartPosition=0;
    append("String_Node_Str");
    startNewLine();
  }
 else {
  }
}

Fixed version (ground truth):
@Override void endFile(){
  super.endFile();
  if (!preferLineBreakAtEndOfFile) {
    return;
  }
  if (lineLength > lineLengthThreshold / 2) {
    append("String_Node_Str");
    startNewLine();
  }
 else   if (prevCutPosition > 0) {
    code.setCharAt(prevCutPosition,' ');
    lineStartPosition=prevLineStartPosition;
    lineLength=code.length() - lineStartPosition;
    int prevLineEndPosition=prevCutPosition - prevLineStartPosition + 1;
    reportLineCut(lineIndex,prevLineEndPosition,false);
    lineIndex--;
    prevCutPosition=0;
    prevLineStartPosition=0;
    append("String_Node_Str");
    startNewLine();
  }
 else {
  }
}
Program: 19379
Project: 19379
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: 19380
Project: 19380
Buggy source:
/** 
 * Invalidates the given type, so that no properties on it will be renamed.
 */
private void recordInvalidatingType(JSType type,JSError error){
  type=type.restrictByNotNullOrUndefined();
  if (type.isUnionType()) {
    for (    JSType alt : type.toMaybeUnionType().getAlternatesWithoutStructuralTyping()) {
      recordInvalidatingType(alt,error);
    }
  }
 else   if (type.isEnumElementType()) {
    recordInvalidatingType(type.toMaybeEnumElementType().getPrimitiveType(),error);
  }
 else {
    addInvalidatingType(type);
    recordInvalidationError(type,error);
    ObjectType objType=ObjectType.cast(type);
    if (objType != null && objType.getImplicitPrototype() != null) {
      addInvalidatingType(objType.getImplicitPrototype());
      recordInvalidationError(objType.getImplicitPrototype(),error);
    }
    if (objType != null && objType.isConstructor() && objType.isFunctionType()) {
      addInvalidatingType(objType.toMaybeFunctionType().getInstanceType());
    }
  }
}

Fixed version (ground truth):
/** 
 * Invalidates the given type, so that no properties on it will be renamed.
 */
private void recordInvalidatingType(JSType type,TypeMismatch mis){
  type=type.restrictByNotNullOrUndefined();
  if (type.isUnionType()) {
    for (    JSType alt : type.toMaybeUnionType().getAlternatesWithoutStructuralTyping()) {
      recordInvalidatingType(alt,mis);
    }
  }
 else   if (type.isEnumElementType()) {
    recordInvalidatingType(type.toMaybeEnumElementType().getPrimitiveType(),mis);
  }
 else {
    addInvalidatingType(type);
    recordInvalidationError(type,mis);
    ObjectType objType=ObjectType.cast(type);
    if (objType != null && objType.getImplicitPrototype() != null) {
      addInvalidatingType(objType.getImplicitPrototype());
      recordInvalidationError(objType.getImplicitPrototype(),mis);
    }
    if (objType != null && objType.isConstructor() && objType.isFunctionType()) {
      addInvalidatingType(objType.toMaybeFunctionType().getInstanceType());
    }
  }
}
Program: 19381
Project: 19381
Buggy source:
@Override public void process(Node externs,Node root){
  Preconditions.checkState(compiler.getLifeCycleStage() == LifeCycleStage.NORMALIZED);
  this.ancestorInterfaces=new HashMap<>();
  this.gtwpCache=new HashMap<>();
  for (  TypeMismatch mis : compiler.getTypeMismatches()) {
    recordInvalidatingType(mis.typeA,mis.src);
    recordInvalidatingType(mis.typeB,mis.src);
  }
  for (  TypeMismatch mis : compiler.getImplicitInterfaceUses()) {
    recordInvalidatingType(mis.typeA,mis.src);
    recordInvalidatingType(mis.typeB,mis.src);
  }
  NodeTraversal.traverseEs6(compiler,externs,new FindExternProperties());
  NodeTraversal.traverseEs6(compiler,root,new FindRenameableProperties());
  renameProperties();
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  Preconditions.checkState(compiler.getLifeCycleStage() == LifeCycleStage.NORMALIZED);
  this.ancestorInterfaces=new HashMap<>();
  this.gtwpCache=new HashMap<>();
  for (  TypeMismatch mis : compiler.getTypeMismatches()) {
    recordInvalidatingType(mis.typeA,mis);
    recordInvalidatingType(mis.typeB,mis);
  }
  for (  TypeMismatch mis : compiler.getImplicitInterfaceUses()) {
    recordInvalidatingType(mis.typeA,mis);
    recordInvalidatingType(mis.typeB,mis);
  }
  NodeTraversal.traverseEs6(compiler,externs,new FindExternProperties());
  NodeTraversal.traverseEs6(compiler,root,new FindRenameableProperties());
  renameProperties();
}
Program: 19382
Project: 19382
Buggy source:
private void recordInvalidationError(JSType t,JSError error){
  if (!t.isObject()) {
    return;
  }
  if (invalidationMap != null) {
    Collection<JSError> errors=this.invalidationMap.get(t);
    if (errors.size() < MAX_INVALIDATION_WARNINGS_PER_PROPERTY) {
      errors.add(error);
    }
  }
}

Fixed version (ground truth):
private void recordInvalidationError(JSType t,TypeMismatch mis){
  if (!t.isObject()) {
    return;
  }
  if (invalidationMap != null) {
    Collection<JSError> errors=this.invalidationMap.get(t);
    if (errors.size() < MAX_INVALIDATION_WARNINGS_PER_PROPERTY) {
      JSError error=mis.src;
      if (error.getType().equals(TypeValidator.TYPE_MISMATCH_WARNING) && error.description.isEmpty()) {
        String msg="String_Node_Str" + mis.typeA + "String_Node_Str"+ mis.typeB;
        error=JSError.make(error.node,TypeValidator.TYPE_MISMATCH_WARNING,msg);
      }
      errors.add(error);
    }
  }
}
Program: 19383
Project: 19383
Buggy source:
private void recordImplicitInterfaceUses(Node src,JSType sourceType,JSType targetType){
  sourceType=removeNullUndefinedAndTemplates(sourceType);
  targetType=removeNullUndefinedAndTemplates(targetType);
  boolean strictMismatch=!sourceType.isSubtypeWithoutStructuralTyping(targetType) && !targetType.isSubtypeWithoutStructuralTyping(sourceType);
  boolean mismatch=!sourceType.isSubtype(targetType) && !targetType.isSubtype(sourceType);
  if (strictMismatch || mismatch) {
    String msg;
    if (numImplicitUses < 10) {
      msg="String_Node_Str" + sourceType + "String_Node_Str"+ targetType;
    }
 else {
      msg="String_Node_Str";
    }
    numImplicitUses++;
    JSError err=JSError.make(src,TYPE_MISMATCH_WARNING,msg);
    implicitInterfaceUses.add(new TypeMismatch(sourceType,targetType,err));
  }
}

Fixed version (ground truth):
private void recordImplicitInterfaceUses(Node src,JSType sourceType,JSType targetType){
  sourceType=removeNullUndefinedAndTemplates(sourceType);
  targetType=removeNullUndefinedAndTemplates(targetType);
  boolean strictMismatch=!sourceType.isSubtypeWithoutStructuralTyping(targetType) && !targetType.isSubtypeWithoutStructuralTyping(sourceType);
  boolean mismatch=!sourceType.isSubtype(targetType) && !targetType.isSubtype(sourceType);
  if (strictMismatch || mismatch) {
    JSError err=JSError.make(src,TYPE_MISMATCH_WARNING,"String_Node_Str");
    implicitInterfaceUses.add(new TypeMismatch(sourceType,targetType,err));
  }
}
Program: 19384
Project: 19384
Buggy source:
/** 
 * Converts a tree to JS code
 */
private static String toSource(Node root,Format outputFormat,CompilerOptions options,SourceMap sourceMap,boolean tagAsExterns,boolean tagAsStrict,boolean lineBreak,CodeGeneratorFactory codeGeneratorFactory){
  Preconditions.checkState(options.sourceMapDetailLevel != null);
  boolean createSourceMap=(sourceMap != null);
  MappedCodePrinter mcp=outputFormat == Format.COMPACT ? new CompactCodePrinter(lineBreak,options.preferLineBreakAtEndOfFile,options.lineLengthThreshold,createSourceMap,options.sourceMapDetailLevel) : new PrettyCodePrinter(options.lineLengthThreshold,createSourceMap,options.sourceMapDetailLevel);
  CodeGenerator cg=codeGeneratorFactory.getCodeGenerator(outputFormat,mcp);
  if (tagAsExterns) {
    cg.tagAsExterns();
  }
  if (tagAsStrict) {
    cg.tagAsStrict();
  }
  cg.add(root);
  mcp.endFile();
  String code=mcp.getCode();
  if (createSourceMap) {
    mcp.generateSourceMap(sourceMap);
  }
  return code;
}

Fixed version (ground truth):
/** 
 * Converts a tree to JS code
 */
private static String toSource(Node root,Format outputFormat,CompilerOptions options,SourceMap sourceMap,boolean tagAsExterns,boolean tagAsStrict,boolean lineBreak,CodeGeneratorFactory codeGeneratorFactory){
  Preconditions.checkState(options.sourceMapDetailLevel != null);
  boolean createSourceMap=(sourceMap != null);
  MappedCodePrinter mcp=outputFormat == Format.COMPACT ? new CompactCodePrinter(lineBreak,options.preferLineBreakAtEndOfFile,options.lineLengthThreshold,createSourceMap,options.sourceMapDetailLevel) : new PrettyCodePrinter(options.lineLengthThreshold,createSourceMap,options.sourceMapDetailLevel);
  CodeGenerator cg=codeGeneratorFactory.getCodeGenerator(outputFormat,mcp);
  if (tagAsExterns) {
    cg.tagAsExterns();
  }
  if (tagAsStrict) {
    cg.tagAsStrict();
  }
  cg.add(root);
  mcp.endFile();
  String code=mcp.getCode();
  if (createSourceMap) {
    mcp.generateSourceMap(code,sourceMap);
  }
  return code;
}
Program: 19385
Project: 19385
Buggy source:
/** 
 * Generates the source map from the given code consumer, appending the information it saved to the SourceMap object given.
 */
void generateSourceMap(SourceMap map){
  if (createSrcMap) {
    for (    Mapping mapping : allMappings) {
      map.addMapping(mapping.node,mapping.start,mapping.end);
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates the source map from the given code consumer, appending the information it saved to the SourceMap object given.
 */
void generateSourceMap(String code,SourceMap map){
  if (createSrcMap) {
    List<Integer> lineLengths=computeLineLengths(code);
    for (    Mapping mapping : allMappings) {
      map.addMapping(mapping.node,mapping.start,adjustEndPosition(lineLengths,mapping.end));
    }
  }
}
Program: 19386
Project: 19386
Buggy source:
@Override SourceFile getSourceFileByName(String sourceName){
  if (sourceName != null) {
    CompilerInput input=inputsById.get(new InputId(sourceName));
    if (input != null) {
      return input.getSourceFile();
    }
    return sourceMapOriginalSources.get(sourceName);
  }
  return null;
}

Fixed version (ground truth):
@Override public SourceFile getSourceFileByName(String sourceName){
  if (sourceName != null) {
    CompilerInput input=inputsById.get(new InputId(sourceName));
    if (input != null) {
      return input.getSourceFile();
    }
    return sourceMapOriginalSources.get(sourceName);
  }
  return null;
}
Program: 19387
Project: 19387
Buggy source:
/** 
 * Applies the provided set of code replacements to the code and returns the transformed code. The code replacements may not have any overlap.
 */
public static String applyCodeReplacements(Iterable<CodeReplacement> replacements,String code){
  List<CodeReplacement> sortedReplacements=ORDER_CODE_REPLACEMENTS.sortedCopy(replacements);
  validateNoOverlaps(sortedReplacements);
  StringBuilder sb=new StringBuilder();
  int lastIndex=0;
  for (  CodeReplacement replacement : sortedReplacements) {
    sb.append(code,lastIndex,replacement.getStartPosition());
    sb.append(replacement.getNewContent());
    lastIndex=replacement.getStartPosition() + replacement.getLength();
  }
  if (lastIndex <= code.length()) {
    sb.append(code,lastIndex,code.length());
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Applies the provided set of code replacements to the code and returns the transformed code. The code replacements may not have any overlap.
 */
public static String applyCodeReplacements(Iterable<CodeReplacement> replacements,String code){
  List<CodeReplacement> sortedReplacements=ORDER_CODE_REPLACEMENTS.sortedCopy(replacements);
  validateNoOverlaps(sortedReplacements);
  StringBuilder sb=new StringBuilder();
  int lastIndex=0;
  for (  CodeReplacement replacement : sortedReplacements) {
    sb.append(code,lastIndex,replacement.getStartPosition());
    sb.append(replacement.getNewContent());
    lastIndex=replacement.getEndPosition();
  }
  if (lastIndex <= code.length()) {
    sb.append(code,lastIndex,code.length());
  }
  return sb.toString();
}