nus-yam/ex-repair huggingface dataset:
Program: 18744
Project: 18744
Buggy source:
public void testRecordSubtypeChain() throws Exception {
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType aType=builder.build();
  builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType abType=builder.build();
  builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",NUMBER_TYPE,null);
  JSType abcType=builder.build();
  List<JSType> typeChain=Lists.newArrayList(registry.getNativeType(JSTypeNative.ALL_TYPE),registry.getNativeType(JSTypeNative.OBJECT_PROTOTYPE),registry.getNativeType(JSTypeNative.OBJECT_TYPE),aType,abType,abcType,registry.getNativeType(JSTypeNative.NO_OBJECT_TYPE),registry.getNativeType(JSTypeNative.NO_TYPE));
  verifySubtypeChain(typeChain);
}

Fixed version (ground truth):
public void testRecordSubtypeChain() throws Exception {
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType aType=builder.build();
  builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType abType=builder.build();
  builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType acType=builder.build();
  JSType abOrAcType=registry.createUnionType(abType,acType);
  builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",NUMBER_TYPE,null);
  JSType abcType=builder.build();
  List<JSType> typeChain=Lists.newArrayList(registry.getNativeType(JSTypeNative.ALL_TYPE),registry.getNativeType(JSTypeNative.OBJECT_PROTOTYPE),registry.getNativeType(JSTypeNative.OBJECT_TYPE),aType,abOrAcType,abType,abcType,registry.getNativeType(JSTypeNative.NO_OBJECT_TYPE),registry.getNativeType(JSTypeNative.NO_TYPE));
  verifySubtypeChain(typeChain);
}
Program: 18745
Project: 18745
Buggy source:
public void testRecordTypeLeastSuperType3(){
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",NUMBER_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType subRecordType=builder.build();
  JSType leastSupertype=recordType.getLeastSupertype(subRecordType);
  assertTypeEquals(leastSupertype,OBJECT_TYPE);
}

Fixed version (ground truth):
public void testRecordTypeLeastSuperType3(){
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",NUMBER_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType otherRecordType=builder.build();
  assertTypeEquals(registry.createUnionType(recordType,otherRecordType),recordType.getLeastSupertype(otherRecordType));
}
Program: 18746
Project: 18746
Buggy source:
public void testRecordTypeLeastSuperType2(){
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",NUMBER_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType subRecordType=builder.build();
  JSType leastSupertype=recordType.getLeastSupertype(subRecordType);
  builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  assertTypeEquals(leastSupertype,builder.build());
}

Fixed version (ground truth):
public void testRecordTypeLeastSuperType2(){
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  builder.addProperty("String_Node_Str",NUMBER_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  builder.addProperty("String_Node_Str",STRING_TYPE,null);
  JSType otherRecordType=builder.build();
  assertTypeEquals(registry.createUnionType(recordType,otherRecordType),recordType.getLeastSupertype(otherRecordType));
}
Program: 18747
Project: 18747
Buggy source:
/** 
 * Check if the given node is a property of a name in the global scope.
 */
private boolean isQnameRootedInGlobalScope(Node n){
  Node root=NodeUtil.getRootOfQualifiedName(n);
  if (root.isName()) {
    Var var=scope.getVar(root.getString());
    if (var != null) {
      return var.isGlobal();
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check if the given node is a property of a name in the global scope.
 */
private boolean isQnameRootedInGlobalScope(Node n){
  Scope scope=getQnameRootScope(n);
  return scope != null && scope.isGlobal();
}
Program: 18749
Project: 18749
Buggy source:
public void testBadTemplateType2() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_NOT_OBJECT_TYPE.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType2() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_NOT_OBJECT_TYPE.format("String_Node_Str"));
}
Program: 18750
Project: 18750
Buggy source:
public void testBadTemplateType1() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_DUPLICATED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType1() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_DUPLICATED.format());
}
Program: 18751
Project: 18751
Buggy source:
public void testBadTemplateType5() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType5() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format());
}
Program: 18752
Project: 18752
Buggy source:
public void testBadTemplateType4() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType4() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format());
}
Program: 18753
Project: 18753
Buggy source:
public void testBadTemplateType3() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_OF_THIS_EXPECTED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType3() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_OF_THIS_EXPECTED.format());
}
Program: 18754
Project: 18754
Buggy source:
public void testBadTemplateType2() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_NOT_OBJECT_TYPE.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType2() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_NOT_OBJECT_TYPE.format("String_Node_Str"));
}
Program: 18755
Project: 18755
Buggy source:
public void testBadTemplateType1() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_DUPLICATED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType1() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_DUPLICATED.format());
}
Program: 18756
Project: 18756
Buggy source:
public void testBadTemplateType5() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType5() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format());
}
Program: 18757
Project: 18757
Buggy source:
public void testBadTemplateType4() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType4() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",FunctionTypeBuilder.TEMPLATE_TYPE_EXPECTED.format());
}
Program: 18758
Project: 18758
Buggy source:
public void testBadTemplateType3() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_OF_THIS_EXPECTED.format(),true);
}

Fixed version (ground truth):
public void testBadTemplateType3() throws Exception {
  testTypes("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeInference.TEMPLATE_TYPE_OF_THIS_EXPECTED.format());
}
Program: 18759
Project: 18759
Buggy source:
@Override public void inferQualifiedSlot(Node node,String symbol,JSType bottomType,JSType inferredType){
  Scope functionScope=getFunctionScope();
  if (functionScope.isLocal()) {
    if (functionScope.getVar(symbol) == null && !functionScope.isBottom()) {
      int firstDot=symbol.indexOf("String_Node_Str");
      Preconditions.checkState(firstDot != -1);
      Var owner=functionScope.getVar(symbol.substring(0,firstDot));
      Scope ownerScope=owner == null ? functionScope : owner.getScope();
      ownerScope.declare(symbol,node,bottomType,null);
    }
    inferSlotType(symbol,inferredType);
  }
}

Fixed version (ground truth):
@Override public void inferQualifiedSlot(Node node,String symbol,JSType bottomType,JSType inferredType){
  Scope functionScope=getFunctionScope();
  if (functionScope.isLocal()) {
    if (functionScope.getVar(symbol) == null && !functionScope.isBottom()) {
      functionScope.declare(symbol,node,bottomType,null);
    }
    inferSlotType(symbol,inferredType);
  }
}
Program: 18760
Project: 18760
Buggy source:
/** 
 * Visits a GETPROP node.
 * @param t The node traversal object that supplies context, such as thescope chain to use in name lookups as well as error reporting.
 * @param n The node being visited.
 * @param parent The parent of <code>n</code>
 */
private void visitGetProp(NodeTraversal t,Node n,Node parent){
  if (n.getJSType() != null && parent.getType() == Token.ASSIGN) {
    return;
  }
  Node property=n.getLastChild();
  Node objNode=n.getFirstChild();
  JSType childType=getJSType(objNode);
  if (!validator.expectNotNullOrUndefined(t,n,childType,childType + "String_Node_Str",getNativeType(OBJECT_TYPE))) {
    ensureTyped(t,n);
    return;
  }
  checkPropertyAccess(childType,property.getString(),t,n);
  ensureTyped(t,n);
}

Fixed version (ground truth):
/** 
 * Visits a GETPROP node.
 * @param t The node traversal object that supplies context, such as thescope chain to use in name lookups as well as error reporting.
 * @param n The node being visited.
 * @param parent The parent of <code>n</code>
 */
private void visitGetProp(NodeTraversal t,Node n,Node parent){
  if (n.getJSType() != null && parent.getType() == Token.ASSIGN) {
    return;
  }
  Node property=n.getLastChild();
  Node objNode=n.getFirstChild();
  JSType childType=getJSType(objNode);
  if (!validator.expectNotNullOrUndefined(t,n,childType,"String_Node_Str",getNativeType(OBJECT_TYPE))) {
    ensureTyped(t,n);
    return;
  }
  checkPropertyAccess(childType,property.getString(),t,n);
  ensureTyped(t,n);
}
Program: 18761
Project: 18761
Buggy source:
/** 
 * Creates an instance for a function that is an interface. 
 */
private FunctionType(JSTypeRegistry registry,String name,Node source){
  super(registry,name,registry.getNativeObjectType(JSTypeNative.FUNCTION_INSTANCE_TYPE));
  Preconditions.checkArgument(source == null || Token.FUNCTION == source.getType());
  Preconditions.checkArgument(name != null);
  this.source=source;
  this.call=new ArrowType(registry,new Node(Token.LP),null);
  this.kind=Kind.INTERFACE;
  this.typeOfThis=new InstanceObjectType(registry,this);
}

Fixed version (ground truth):
/** 
 * Creates an instance for a function that is an interface. 
 */
private FunctionType(JSTypeRegistry registry,String name,Node source){
  super(registry,name,registry.getNativeObjectType(JSTypeNative.FUNCTION_INSTANCE_TYPE));
  setPrettyPrint(true);
  Preconditions.checkArgument(source == null || Token.FUNCTION == source.getType());
  Preconditions.checkArgument(name != null);
  this.source=source;
  this.call=new ArrowType(registry,new Node(Token.LP),null);
  this.kind=Kind.INTERFACE;
  this.typeOfThis=new InstanceObjectType(registry,this);
}
Program: 18762
Project: 18762
Buggy source:
/** 
 * Informally, a function is represented by  {@code function (params): returnType} where the {@code params} is a commaseparated list of types, the first one being a special {@code this:T} if the function expects a known type for {@code this}.
 */
@Override public String toString(){
  if (this == registry.getNativeType(JSTypeNative.FUNCTION_INSTANCE_TYPE)) {
    return "String_Node_Str";
  }
  StringBuilder b=new StringBuilder(32);
  b.append("String_Node_Str");
  int paramNum=call.parameters.getChildCount();
  boolean hasKnownTypeOfThis=!typeOfThis.isUnknownType();
  if (hasKnownTypeOfThis) {
    if (isConstructor()) {
      b.append("String_Node_Str");
    }
 else {
      b.append("String_Node_Str");
    }
    b.append(typeOfThis.toString());
  }
  if (paramNum > 0) {
    if (hasKnownTypeOfThis) {
      b.append("String_Node_Str");
    }
    Node p=call.parameters.getFirstChild();
    if (p.isVarArgs()) {
      appendVarArgsString(b,p.getJSType());
    }
 else {
      b.append(p.getJSType().toString());
    }
    p=p.getNext();
    while (p != null) {
      b.append("String_Node_Str");
      if (p.isVarArgs()) {
        appendVarArgsString(b,p.getJSType());
      }
 else {
        b.append(p.getJSType().toString());
      }
      p=p.getNext();
    }
  }
  b.append("String_Node_Str");
  b.append(call.returnType);
  return b.toString();
}

Fixed version (ground truth):
/** 
 * Informally, a function is represented by  {@code function (params): returnType} where the {@code params} is a commaseparated list of types, the first one being a special {@code this:T} if the function expects a known type for {@code this}.
 */
@Override public String toString(){
  if (!isPrettyPrint() || this == registry.getNativeType(JSTypeNative.FUNCTION_INSTANCE_TYPE)) {
    return "String_Node_Str";
  }
  setPrettyPrint(false);
  StringBuilder b=new StringBuilder(32);
  b.append("String_Node_Str");
  int paramNum=call.parameters.getChildCount();
  boolean hasKnownTypeOfThis=!typeOfThis.isUnknownType();
  if (hasKnownTypeOfThis) {
    if (isConstructor()) {
      b.append("String_Node_Str");
    }
 else {
      b.append("String_Node_Str");
    }
    b.append(typeOfThis.toString());
  }
  if (paramNum > 0) {
    if (hasKnownTypeOfThis) {
      b.append("String_Node_Str");
    }
    Node p=call.parameters.getFirstChild();
    if (p.isVarArgs()) {
      appendVarArgsString(b,p.getJSType());
    }
 else {
      b.append(p.getJSType().toString());
    }
    p=p.getNext();
    while (p != null) {
      b.append("String_Node_Str");
      if (p.isVarArgs()) {
        appendVarArgsString(b,p.getJSType());
      }
 else {
        b.append(p.getJSType().toString());
      }
      p=p.getNext();
    }
  }
  b.append("String_Node_Str");
  b.append(call.returnType);
  setPrettyPrint(true);
  return b.toString();
}
Program: 18763
Project: 18763
Buggy source:
/** 
 * A generic implementation meant to be used as a helper for common getGreatestSubtype implementations.
 */
static JSType getGreatestSubtype(JSType thisType,JSType thatType){
  if (thisType.isEquivalentTo(thatType)) {
    return thisType;
  }
 else   if (thisType.isUnknownType() || thatType.isUnknownType()) {
    return thisType.isEquivalentTo(thatType) ? thisType : thisType.getNativeType(JSTypeNative.UNKNOWN_TYPE);
  }
 else   if (thisType.isSubtype(thatType)) {
    return filterNoResolvedType(thisType);
  }
 else   if (thatType.isSubtype(thisType)) {
    return filterNoResolvedType(thatType);
  }
 else   if (thisType.isUnionType()) {
    return thisType.toMaybeUnionType().meet(thatType);
  }
 else   if (thatType.isUnionType()) {
    return thatType.toMaybeUnionType().meet(thisType);
  }
  if (thisType.isEnumElementType()) {
    JSType inf=thisType.toMaybeEnumElementType().meet(thatType);
    if (inf != null) {
      return inf;
    }
  }
 else   if (thatType.isEnumElementType()) {
    JSType inf=thatType.toMaybeEnumElementType().meet(thisType);
    if (inf != null) {
      return inf;
    }
  }
  if (thisType.isObject() && thatType.isObject()) {
    return thisType.getNativeType(JSTypeNative.NO_OBJECT_TYPE);
  }
  return thisType.getNativeType(JSTypeNative.NO_TYPE);
}

Fixed version (ground truth):
/** 
 * A generic implementation meant to be used as a helper for common getGreatestSubtype implementations.
 */
static JSType getGreatestSubtype(JSType thisType,JSType thatType){
  if (thisType.isEquivalentTo(thatType)) {
    return thisType;
  }
 else   if (thisType.isUnknownType() || thatType.isUnknownType()) {
    return thisType.isEquivalentTo(thatType) ? thisType : thisType.getNativeType(JSTypeNative.UNKNOWN_TYPE);
  }
 else   if (thisType.isSubtype(thatType)) {
    return filterNoResolvedType(thisType);
  }
 else   if (thatType.isSubtype(thisType)) {
    return filterNoResolvedType(thatType);
  }
 else   if (thisType.isUnionType()) {
    return thisType.toMaybeUnionType().meet(thatType);
  }
 else   if (thatType.isUnionType()) {
    return thatType.toMaybeUnionType().meet(thisType);
  }
 else   if (thisType.isRecordType()) {
    return thisType.toMaybeRecordType().getGreatestSubtypeHelper(thatType);
  }
 else   if (thatType.isRecordType()) {
    return thatType.toMaybeRecordType().getGreatestSubtypeHelper(thisType);
  }
  if (thisType.isEnumElementType()) {
    JSType inf=thisType.toMaybeEnumElementType().meet(thatType);
    if (inf != null) {
      return inf;
    }
  }
 else   if (thatType.isEnumElementType()) {
    JSType inf=thatType.toMaybeEnumElementType().meet(thisType);
    if (inf != null) {
      return inf;
    }
  }
  if (thisType.isObject() && thatType.isObject()) {
    return thisType.getNativeType(JSTypeNative.NO_OBJECT_TYPE);
  }
  return thisType.getNativeType(JSTypeNative.NO_TYPE);
}
Program: 18764
Project: 18764
Buggy source:
public boolean isRecordType(){
  return false;
}

Fixed version (ground truth):
public boolean isRecordType(){
  return toMaybeRecordType() != null;
}
Program: 18765
Project: 18765
Buggy source:
@Override public boolean isSubtype(JSType that){
  if (JSType.isSubtypeHelper(this,that)) {
    return true;
  }
  if (that.isUnionType()) {
    return false;
  }
  if (that instanceof RecordType) {
    return RecordType.isSubtype(this,(RecordType)that);
  }
  ObjectType thatObj=that.toObjectType();
  ObjectType thatCtor=thatObj == null ? null : thatObj.getConstructor();
  if (thatCtor != null && thatCtor.isInterface()) {
    Iterable<ObjectType> thisInterfaces=getCtorImplementedInterfaces();
    for (    ObjectType thisInterface : thisInterfaces) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
  if (getConstructor() != null && getConstructor().isInterface()) {
    for (    ObjectType thisInterface : getCtorExtendedInterfaces()) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
  if (isUnknownType() || implicitPrototypeChainIsUnknown()) {
    return true;
  }
  return this.isImplicitPrototype(thatObj);
}

Fixed version (ground truth):
@Override public boolean isSubtype(JSType that){
  if (JSType.isSubtypeHelper(this,that)) {
    return true;
  }
  if (that.isUnionType()) {
    return false;
  }
  if (that.isRecordType()) {
    return RecordType.isSubtype(this,that.toMaybeRecordType());
  }
  ObjectType thatObj=that.toObjectType();
  ObjectType thatCtor=thatObj == null ? null : thatObj.getConstructor();
  if (thatCtor != null && thatCtor.isInterface()) {
    Iterable<ObjectType> thisInterfaces=getCtorImplementedInterfaces();
    for (    ObjectType thisInterface : thisInterfaces) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
  if (getConstructor() != null && getConstructor().isInterface()) {
    for (    ObjectType thisInterface : getCtorExtendedInterfaces()) {
      if (thisInterface.isSubtype(that)) {
        return true;
      }
    }
  }
  if (isUnknownType() || implicitPrototypeChainIsUnknown()) {
    return true;
  }
  return this.isImplicitPrototype(thatObj);
}
Program: 18766
Project: 18766
Buggy source:
@Override public boolean isEquivalentTo(JSType other){
  if (!(other instanceof RecordType)) {
    return false;
  }
  RecordType otherRecord=(RecordType)other;
  Set<String> keySet=properties.keySet();
  Map<String,JSType> otherProps=otherRecord.properties;
  if (!otherProps.keySet().equals(keySet)) {
    return false;
  }
  for (  String key : keySet) {
    if (!otherProps.get(key).isEquivalentTo(properties.get(key))) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isEquivalentTo(JSType other){
  if (!other.isRecordType()) {
    return false;
  }
  RecordType otherRecord=other.toMaybeRecordType();
  if (otherRecord == this) {
    return true;
  }
  Set<String> keySet=properties.keySet();
  Map<String,JSType> otherProps=otherRecord.properties;
  if (!otherProps.keySet().equals(keySet)) {
    return false;
  }
  for (  String key : keySet) {
    if (!otherProps.get(key).isEquivalentTo(properties.get(key))) {
      return false;
    }
  }
  return true;
}
Program: 18767
Project: 18767
Buggy source:
/** 
 * Creates a record type.
 * @param registry The type registry under which this type lives.
 * @param properties A map of all the properties of this record type.
 * @throws IllegalStateException if the {@code RecordProperty} associatedwith a property is null.
 */
RecordType(JSTypeRegistry registry,Map<String,RecordProperty> properties){
  super(registry,null,null);
  for (  String property : properties.keySet()) {
    RecordProperty prop=properties.get(property);
    if (prop == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    defineDeclaredProperty(property,prop.getType(),prop.getPropertyNode());
  }
  isFrozen=true;
}

Fixed version (ground truth):
/** 
 * Creates a record type.
 * @param registry The type registry under which this type lives.
 * @param properties A map of all the properties of this record type.
 * @throws IllegalStateException if the {@code RecordProperty} associatedwith a property is null.
 */
RecordType(JSTypeRegistry registry,Map<String,RecordProperty> properties){
  super(registry,null,null);
  setPrettyPrint(true);
  for (  String property : properties.keySet()) {
    RecordProperty prop=properties.get(property);
    if (prop == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    defineDeclaredProperty(property,prop.getType(),prop.getPropertyNode());
  }
  isFrozen=true;
}
Program: 18768
Project: 18768
Buggy source:
@Override public JSType getLeastSupertype(JSType that){
  if (!that.isRecordType()) {
    return super.getLeastSupertype(that);
  }
  RecordType thatRecord=(RecordType)that;
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  for (  String property : properties.keySet()) {
    if (thatRecord.hasProperty(property) && thatRecord.getPropertyType(property).isEquivalentTo(getPropertyType(property))) {
      builder.addProperty(property,getPropertyType(property),getPropertyNode(property));
    }
  }
  return builder.build();
}

Fixed version (ground truth):
@Override public JSType getLeastSupertype(JSType that){
  if (!that.isRecordType()) {
    return super.getLeastSupertype(that);
  }
  RecordType thatRecord=that.toMaybeRecordType();
  RecordTypeBuilder builder=new RecordTypeBuilder(registry);
  for (  String property : properties.keySet()) {
    if (thatRecord.hasProperty(property) && thatRecord.getPropertyType(property).isEquivalentTo(getPropertyType(property))) {
      builder.addProperty(property,getPropertyType(property),getPropertyNode(property));
    }
  }
  return builder.build();
}
Program: 18769
Project: 18769
Buggy source:
/** 
 * Looks for a type expression at the current token and if found, returns it. Note that this method consumes input. Parameter type expressions are special for two reasons: <ol> <li>They must begin with '{', to distinguish type names from param names. <li>They may end in '=', to denote optionality. </ol>
 * @param token The current token.
 * @return The type expression found or null if none.
 */
private Node parseAndRecordParamTypeNode(JsDocToken token){
  Preconditions.checkArgument(token == JsDocToken.LC);
  int lineno=stream.getLineno();
  int startCharno=stream.getCharno();
  Node typeNode=parseParamTypeExpressionAnnotation(token);
  int endCharno=stream.getCharno();
  jsdocBuilder.markTypeNode(typeNode,lineno,startCharno,endCharno,true);
  return typeNode;
}

Fixed version (ground truth):
/** 
 * Looks for a type expression at the current token and if found, returns it. Note that this method consumes input. Parameter type expressions are special for two reasons: <ol> <li>They must begin with '{', to distinguish type names from param names. <li>They may end in '=', to denote optionality. </ol>
 * @param token The current token.
 * @return The type expression found or null if none.
 */
private Node parseAndRecordParamTypeNode(JsDocToken token){
  Preconditions.checkArgument(token == JsDocToken.LC);
  int lineno=stream.getLineno();
  int startCharno=stream.getCharno();
  Node typeNode=parseParamTypeExpressionAnnotation(token);
  if (typeNode != null) {
    int endLineno=stream.getLineno();
    int endCharno=stream.getCharno();
    jsdocBuilder.markTypeNode(typeNode,lineno,startCharno,endLineno,endCharno,true);
  }
  return typeNode;
}
Program: 18770
Project: 18770
Buggy source:
/** 
 * Looks for a parameter type expression at the current token and if found, returns it. Note that this method consumes input.
 * @param token The current token.
 * @param lineno The line of the type expression.
 * @param startCharno The starting character position of the type expression.
 * @param matchingLC Whether the type expression starts with a "{".
 * @param onlyParseSimpleNames If true, only simple type names are parsed(via a call to parseTypeNameAnnotation instead of parseTypeExpressionAnnotation).
 * @return The type expression found or null if none.
 */
private Node parseAndRecordTypeNode(JsDocToken token,int lineno,int startCharno,boolean matchingLC,boolean onlyParseSimpleNames){
  Node typeNode=null;
  if (onlyParseSimpleNames) {
    typeNode=parseTypeNameAnnotation(token);
  }
 else {
    typeNode=parseTypeExpressionAnnotation(token);
  }
  if (typeNode != null && !matchingLC) {
    typeNode.putBooleanProp(Node.BRACELESS_TYPE,true);
  }
  int endCharno=stream.getCharno();
  jsdocBuilder.markTypeNode(typeNode,lineno,startCharno,endCharno,matchingLC);
  return typeNode;
}

Fixed version (ground truth):
/** 
 * Looks for a parameter type expression at the current token and if found, returns it. Note that this method consumes input.
 * @param token The current token.
 * @param lineno The line of the type expression.
 * @param startCharno The starting character position of the type expression.
 * @param matchingLC Whether the type expression starts with a "{".
 * @param onlyParseSimpleNames If true, only simple type names are parsed(via a call to parseTypeNameAnnotation instead of parseTypeExpressionAnnotation).
 * @return The type expression found or null if none.
 */
private Node parseAndRecordTypeNode(JsDocToken token,int lineno,int startCharno,boolean matchingLC,boolean onlyParseSimpleNames){
  Node typeNode=null;
  if (onlyParseSimpleNames) {
    typeNode=parseTypeNameAnnotation(token);
  }
 else {
    typeNode=parseTypeExpressionAnnotation(token);
  }
  if (typeNode != null && !matchingLC) {
    typeNode.putBooleanProp(Node.BRACELESS_TYPE,true);
  }
  if (typeNode != null) {
    int endLineno=stream.getLineno();
    int endCharno=stream.getCharno();
    jsdocBuilder.markTypeNode(typeNode,lineno,startCharno,endLineno,endCharno,matchingLC);
  }
  return typeNode;
}
Program: 18771
Project: 18771
Buggy source:
/** 
 * Gets the list of all markers for the documentation in this JSDoc. 
 */
public Collection<Marker> getMarkers(){
  return documentation == null ? null : documentation.markers;
}

Fixed version (ground truth):
/** 
 * Gets the list of all markers for the documentation in this JSDoc. 
 */
public Collection<Marker> getMarkers(){
  return documentation == null ? ImmutableList.<Marker>of() : documentation.markers;
}
Program: 18772
Project: 18772
Buggy source:
/** 
 * Adds a textual block to the current marker.
 */
public void markText(String text,int startLineno,int startCharno,int endLineno,int endCharno){
  if (currentMarker != null) {
    currentMarker.description=new JSDocInfo.StringPosition();
    currentMarker.description.setItem(text);
    currentMarker.description.setPositionInformation(startLineno,startCharno,endLineno,endCharno);
  }
}

Fixed version (ground truth):
/** 
 * Adds a textual block to the current marker.
 */
public void markText(String text,int startLineno,int startCharno,int endLineno,int endCharno){
  if (currentMarker != null) {
    JSDocInfo.StringPosition position=new JSDocInfo.StringPosition();
    position.setItem(text);
    position.setPositionInformation(startLineno,startCharno,endLineno,endCharno);
    currentMarker.setDescription(position);
  }
}
Program: 18773
Project: 18773
Buggy source:
/** 
 * Adds a marker to the current JSDocInfo and populates the marker with the annotation information.
 */
public void markAnnotation(String annotation,int lineno,int charno){
  JSDocInfo.Marker marker=currentInfo.addMarker();
  if (marker != null) {
    marker.annotation=new JSDocInfo.StringPosition();
    marker.annotation.setItem(annotation);
    marker.annotation.setPositionInformation(lineno,charno,lineno,charno + annotation.length());
  }
  currentMarker=marker;
}

Fixed version (ground truth):
/** 
 * Adds a marker to the current JSDocInfo and populates the marker with the annotation information.
 */
public void markAnnotation(String annotation,int lineno,int charno){
  JSDocInfo.Marker marker=currentInfo.addMarker();
  if (marker != null) {
    JSDocInfo.TrimmedStringPosition position=new JSDocInfo.TrimmedStringPosition();
    position.setItem(annotation);
    position.setPositionInformation(lineno,charno,lineno,charno + annotation.length());
    marker.setAnnotation(position);
    populated=true;
  }
  currentMarker=marker;
}
Program: 18774
Project: 18774
Buggy source:
/** 
 * Adds a name declaration to the current marker.
 */
public void markName(String name,int lineno,int charno){
  if (currentMarker != null) {
    currentMarker.name=new JSDocInfo.StringPosition();
    currentMarker.name.setItem(name);
    currentMarker.name.setPositionInformation(lineno,charno,lineno,charno + name.length());
  }
}

Fixed version (ground truth):
/** 
 * Adds a name declaration to the current marker.
 */
public void markName(String name,int lineno,int charno){
  if (currentMarker != null) {
    JSDocInfo.TrimmedStringPosition position=new JSDocInfo.TrimmedStringPosition();
    position.setItem(name);
    position.setPositionInformation(lineno,charno,lineno,charno + name.length());
    currentMarker.setName(position);
  }
}
Program: 18775
Project: 18775
Buggy source:
/** 
 * Adds a type declaration to the current marker.
 */
public void markTypeNode(Node typeNode,int lineno,int startCharno,int endCharno,boolean hasLC){
  if (currentMarker != null) {
    currentMarker.type=new JSDocInfo.TypePosition();
    currentMarker.type.setItem(typeNode);
    currentMarker.type.hasBrackets=hasLC;
    currentMarker.type.setPositionInformation(lineno,startCharno,lineno,endCharno);
  }
}

Fixed version (ground truth):
/** 
 * Adds a type declaration to the current marker.
 */
public void markTypeNode(Node typeNode,int lineno,int startCharno,int endLineno,int endCharno,boolean hasLC){
  if (currentMarker != null) {
    JSDocInfo.TypePosition position=new JSDocInfo.TypePosition();
    position.setItem(typeNode);
    position.setHasBrackets(hasLC);
    position.setPositionInformation(lineno,startCharno,endLineno,endCharno);
    currentMarker.setType(position);
  }
}
Program: 18776
Project: 18776
Buggy source:
/** 
 * Sets the position information contained in this source position.
 */
public void setPositionInformation(int startLineno,int startCharno,int endLineno,int endCharno){
  this.startLineno=startLineno;
  this.startCharno=startCharno;
  this.endLineno=endLineno;
  this.endCharno=endCharno;
}

Fixed version (ground truth):
/** 
 * Sets the position information contained in this source position.
 */
public void setPositionInformation(int startLineno,int startCharno,int endLineno,int endCharno){
  if (startLineno == endLineno) {
    if (startCharno >= endCharno) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + startCharno + "String_Node_Str"+ "String_Node_Str"+ endCharno);
    }
  }
 else {
    if (startLineno > endLineno) {
      throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + startLineno + "String_Node_Str"+ "String_Node_Str"+ endLineno);
    }
  }
  this.startLineno=startLineno;
  this.startCharno=startCharno;
  this.endLineno=endLineno;
  this.endCharno=endCharno;
}
Program: 18777
Project: 18777
Buggy source:
private void assertMarkerPosition(Node n,int lineno,int charno){
  int count=0;
  for (  JSDocInfo.Marker marker : n.getJSDocInfo().getMarkers()) {
    assertEquals(lineno,marker.annotation.getStartLine());
    assertEquals(charno,marker.annotation.getPositionOnStartLine());
    count++;
  }
  assertEquals(1,count);
}

Fixed version (ground truth):
private void assertMarkerPosition(Node n,int lineno,int charno){
  int count=0;
  for (  JSDocInfo.Marker marker : n.getJSDocInfo().getMarkers()) {
    assertEquals(lineno,marker.getAnnotation().getStartLine());
    assertEquals(charno,marker.getAnnotation().getPositionOnStartLine());
    count++;
  }
  assertEquals(1,count);
}
Program: 18778
Project: 18778
Buggy source:
/** 
 * Set the implicit prototype if it's possible to do so.
 * @return True if we were able to set the implicit prototype successfully,false if it was not possible to do so for some reason. There are a few different reasons why this could fail: for example, numbers can't be implicit prototypes, and we don't want to change the implicit prototype if other classes have already subclassed this one.
 */
public boolean resetImplicitPrototype(JSType type,ObjectType newImplicitProto){
  if (type instanceof PrototypeObjectType) {
    PrototypeObjectType poType=(PrototypeObjectType)type;
    if (!poType.hasCachedValues()) {
      poType.setImplicitPrototype(newImplicitProto);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Set the implicit prototype if it's possible to do so.
 * @return True if we were able to set the implicit prototype successfully,false if it was not possible to do so for some reason. There are a few different reasons why this could fail: for example, numbers can't be implicit prototypes, and we don't want to change the implicit prototype if other classes have already subclassed this one.
 */
public boolean resetImplicitPrototype(JSType type,ObjectType newImplicitProto){
  if (type instanceof PrototypeObjectType) {
    PrototypeObjectType poType=(PrototypeObjectType)type;
    poType.clearCachedValues();
    poType.setImplicitPrototype(newImplicitProto);
    return true;
  }
  return false;
}
Program: 18779
Project: 18779
Buggy source:
/** 
 * Returns true if any cached valeus have been set for this type.  If true, then the prototype chain should not be changed, as it might invalidate the cached values.
 */
public boolean hasCachedValues(){
  return !unknown;
}

Fixed version (ground truth):
/** 
 * Returns true if any cached values have been set for this type.  If true, then the prototype chain should not be changed, as it might invalidate the cached values.
 */
public boolean hasCachedValues(){
  return !unknown;
}
Program: 18780
Project: 18780
Buggy source:
/** 
 * Sets the source node.
 */
public void setSource(Node source){
  if (null == source) {
    prototypeSlot=null;
  }
  this.source=source;
}

Fixed version (ground truth):
/** 
 * Sets the source node.
 */
public void setSource(Node source){
  if (prototypeSlot != null) {
    if (source == null || prototypeSlot.getNode() == null) {
      prototypeSlot=new Property(prototypeSlot.getName(),prototypeSlot.getType(),prototypeSlot.isTypeInferred(),source);
    }
  }
  this.source=source;
}
Program: 18781
Project: 18781
Buggy source:
private FlowScope narrowScope(FlowScope scope,Node node,JSType narrowed){
  scope=scope.createChildFlowScope();
  if (node.getType() == Token.GETPROP) {
    scope.inferQualifiedSlot(node.getQualifiedName(),getNativeType(UNKNOWN_TYPE),narrowed);
  }
 else {
    redeclareSimpleVar(scope,node,narrowed);
  }
  return scope;
}

Fixed version (ground truth):
private FlowScope narrowScope(FlowScope scope,Node node,JSType narrowed){
  scope=scope.createChildFlowScope();
  if (node.getType() == Token.GETPROP) {
    scope.inferQualifiedSlot(node.getQualifiedName(),getJSType(node),narrowed);
  }
 else {
    redeclareSimpleVar(scope,node,narrowed);
  }
  return scope;
}
Program: 18782
Project: 18782
Buggy source:
public void testClosure7() throws Exception {
  testClosureTypes(CLOSURE_DEFS + "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 testClosure7() throws Exception {
  testClosureTypes(CLOSURE_DEFS + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}
Program: 18783
Project: 18783
Buggy source:
private void reportRefToUndefinedName(Name name,Ref ref){
  while (name.parent != null && name.parent.globalSets + name.parent.localSets == 0) {
    name=name.parent;
  }
  compiler.report(JSError.make(ref.getSourceName(),ref.node,level,UNDEFINED_NAME_WARNING,name.fullName()));
}

Fixed version (ground truth):
private void reportRefToUndefinedName(Name name,Ref ref){
  while (name.parent != null && name.parent.globalSets + name.parent.localSets == 0) {
    name=name.parent;
  }
  compiler.report(JSError.make(ref.getSourceName(),ref.node,level,UNDEFINED_NAME_WARNING,name.getFullName()));
}
Program: 18784
Project: 18784
Buggy source:
private void reportBadModuleReference(Name name,Ref ref){
  compiler.report(JSError.make(ref.source.getName(),ref.node,STRICT_MODULE_DEP_QNAME,ref.getModule().getName(),name.getDeclaration().getModule().getName(),name.fullName()));
}

Fixed version (ground truth):
private void reportBadModuleReference(Name name,Ref ref){
  compiler.report(JSError.make(ref.source.getName(),ref.node,STRICT_MODULE_DEP_QNAME,ref.getModule().getName(),name.getDeclaration().getModule().getName(),name.getFullName()));
}
Program: 18785
Project: 18785
Buggy source:
private void validateName(Name name,boolean isDefined){
  Ref declaration=name.getDeclaration();
  Name parent=name.parent;
  boolean singleGlobalParentDecl=parent != null && parent.getDeclaration() != null && parent.localSets == 0;
  JSModuleGraph moduleGraph=compiler.getModuleGraph();
  for (  Ref ref : name.getRefs()) {
    if (!isDefined && !isTypedef(ref)) {
      reportRefToUndefinedName(name,ref);
    }
 else     if (declaration != null && ref.getModule() != declaration.getModule() && !moduleGraph.dependsOn(ref.getModule(),declaration.getModule())) {
      reportBadModuleReference(name,ref);
    }
 else     if (ref.scope.isGlobal() && singleGlobalParentDecl && parent.getDeclaration().preOrderIndex > ref.preOrderIndex) {
      compiler.report(JSError.make(ref.source.getName(),ref.node,NAME_DEFINED_LATE_WARNING,name.fullName(),parent.fullName(),parent.getDeclaration().source.getName(),String.valueOf(parent.getDeclaration().node.getLineno())));
    }
  }
}

Fixed version (ground truth):
private void validateName(Name name,boolean isDefined){
  Ref declaration=name.getDeclaration();
  Name parent=name.parent;
  boolean singleGlobalParentDecl=parent != null && parent.getDeclaration() != null && parent.localSets == 0;
  JSModuleGraph moduleGraph=compiler.getModuleGraph();
  for (  Ref ref : name.getRefs()) {
    if (!isDefined && !isTypedef(ref)) {
      reportRefToUndefinedName(name,ref);
    }
 else     if (declaration != null && ref.getModule() != declaration.getModule() && !moduleGraph.dependsOn(ref.getModule(),declaration.getModule())) {
      reportBadModuleReference(name,ref);
    }
 else     if (ref.scope.isGlobal() && singleGlobalParentDecl && parent.getDeclaration().preOrderIndex > ref.preOrderIndex) {
      compiler.report(JSError.make(ref.source.getName(),ref.node,NAME_DEFINED_LATE_WARNING,name.getFullName(),parent.getFullName(),parent.getDeclaration().source.getName(),String.valueOf(parent.getDeclaration().node.getLineno())));
    }
  }
}
Program: 18786
Project: 18786
Buggy source:
/** 
 * Reports a warning because a namespace was redefined.
 * @param nameObj A namespace that is being redefined
 * @param ref The reference that set the namespace
 */
private void warnAboutNamespaceRedefinition(Name nameObj,Ref ref){
  compiler.report(JSError.make(ref.getSourceName(),ref.node,NAMESPACE_REDEFINED_WARNING,nameObj.fullName()));
}

Fixed version (ground truth):
/** 
 * Reports a warning because a namespace was redefined.
 * @param nameObj A namespace that is being redefined
 * @param ref The reference that set the namespace
 */
private void warnAboutNamespaceRedefinition(Name nameObj,Ref ref){
  compiler.report(JSError.make(ref.getSourceName(),ref.node,NAMESPACE_REDEFINED_WARNING,nameObj.getFullName()));
}
Program: 18787
Project: 18787
Buggy source:
/** 
 * Warns about any references to "this" in the given FUNCTION. The function is getting collapsed, so the references will change.
 */
private void checkForHosedThisReferences(Node function,JSDocInfo docInfo,final Name name){
  if (docInfo == null || (!docInfo.isConstructor() && !docInfo.hasThisType())) {
    NodeTraversal.traverse(compiler,function.getLastChild(),new NodeTraversal.AbstractShallowCallback(){
      @Override public void visit(      NodeTraversal t,      Node n,      Node parent){
        if (n.getType() == Token.THIS) {
          compiler.report(JSError.make(name.getDeclaration().getSourceName(),n,UNSAFE_THIS,name.fullName()));
        }
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * Warns about any references to "this" in the given FUNCTION. The function is getting collapsed, so the references will change.
 */
private void checkForHosedThisReferences(Node function,JSDocInfo docInfo,final Name name){
  if (docInfo == null || (!docInfo.isConstructor() && !docInfo.hasThisType())) {
    NodeTraversal.traverse(compiler,function.getLastChild(),new NodeTraversal.AbstractShallowCallback(){
      @Override public void visit(      NodeTraversal t,      Node n,      Node parent){
        if (n.getType() == Token.THIS) {
          compiler.report(JSError.make(name.getDeclaration().getSourceName(),n,UNSAFE_THIS,name.getFullName()));
        }
      }
    }
);
  }
}
Program: 18788
Project: 18788
Buggy source:
@Override public void process(Node externs,Node root){
  GlobalNamespace namespace;
  if (collapsePropertiesOnExternTypes) {
    namespace=new GlobalNamespace(compiler,externs,root);
  }
 else {
    namespace=new GlobalNamespace(compiler,root);
  }
  if (inlineAliases) {
    inlineAliases(namespace);
  }
  nameMap=namespace.getNameIndex();
  globalNames=namespace.getNameForest();
  checkNamespaces();
  for (  Name n : globalNames) {
    flattenReferencesToCollapsibleDescendantNames(n,n.getName());
  }
  for (  Name n : globalNames) {
    collapseDeclarationOfNameAndDescendants(n,n.getName());
  }
}

Fixed version (ground truth):
@Override public void process(Node externs,Node root){
  GlobalNamespace namespace;
  if (collapsePropertiesOnExternTypes) {
    namespace=new GlobalNamespace(compiler,externs,root);
  }
 else {
    namespace=new GlobalNamespace(compiler,root);
  }
  if (inlineAliases) {
    inlineAliases(namespace);
  }
  nameMap=namespace.getNameIndex();
  globalNames=namespace.getNameForest();
  checkNamespaces();
  for (  Name n : globalNames) {
    flattenReferencesToCollapsibleDescendantNames(n,n.getBaseName());
  }
  for (  Name n : globalNames) {
    collapseDeclarationOfNameAndDescendants(n,n.getBaseName());
  }
}
Program: 18789
Project: 18789
Buggy source:
/** 
 * Flattens all references to collapsible properties of a global name except their initial definitions. Recurses on subnames.
 * @param n An object representing a global name
 * @param alias The flattened name for {@code n}
 */
private void flattenReferencesToCollapsibleDescendantNames(Name n,String alias){
  if (n.props == null)   return;
  for (  Name p : n.props) {
    String propAlias=appendPropForAlias(alias,p.getName());
    if (p.canCollapse()) {
      flattenReferencesTo(p,propAlias);
    }
 else     if (p.isSimpleStubDeclaration()) {
      flattenSimpleStubDeclaration(p,propAlias);
    }
    flattenReferencesToCollapsibleDescendantNames(p,propAlias);
  }
}

Fixed version (ground truth):
/** 
 * Flattens all references to collapsible properties of a global name except their initial definitions. Recurses on subnames.
 * @param n An object representing a global name
 * @param alias The flattened name for {@code n}
 */
private void flattenReferencesToCollapsibleDescendantNames(Name n,String alias){
  if (n.props == null)   return;
  for (  Name p : n.props) {
    String propAlias=appendPropForAlias(alias,p.getBaseName());
    if (p.canCollapse()) {
      flattenReferencesTo(p,propAlias);
    }
 else     if (p.isSimpleStubDeclaration()) {
      flattenSimpleStubDeclaration(p,propAlias);
    }
    flattenReferencesToCollapsibleDescendantNames(p,propAlias);
  }
}