Program: 19390
Project: 19390
Buggy source:
public DeclaredFunctionType withTypeInfoFromSuper(DeclaredFunctionType superType,boolean getsTypeInfoFromParentMethod){
  if (getsTypeInfoFromParentMethod && getSyntacticArity() == superType.getSyntacticArity()) {
    NominalType nt=superType.nominalType == null ? null : superType.nominalType.getNominalTypeIfSingletonObj();
    NominalType rt=this.receiverType == null ? null : this.receiverType.getNominalTypeIfSingletonObj();
    return new DeclaredFunctionType(this.commonTypes,superType.requiredFormals,superType.optionalFormals,superType.restFormals,superType.returnType,nt == null ? null : nt.getInstanceAsJSType(),rt == null ? null : rt.getInstanceAsJSType(),superType.typeParameters,false);
  }
  FunctionTypeBuilder builder=new FunctionTypeBuilder(this.commonTypes);
  int i=0;
  for (  JSType formal : this.requiredFormals) {
    builder.addReqFormal(formal != null ? formal : superType.getFormalType(i));
    i++;
  }
  for (  JSType formal : this.optionalFormals) {
    builder.addOptFormal(formal != null ? formal : superType.getFormalType(i));
    i++;
  }
  if (this.restFormals != null) {
    builder.addRestFormals(this.restFormals);
  }
 else   if (superType.hasRestFormals()) {
    builder.addRestFormals(superType.restFormals);
  }
  builder.addRetType(this.returnType != null ? this.returnType : superType.returnType);
  builder.addNominalType(this.nominalType);
  builder.addReceiverType(this.receiverType);
  if (!this.typeParameters.isEmpty()) {
    builder.addTypeParameters(this.typeParameters);
  }
 else   if (!superType.typeParameters.isEmpty()) {
    builder.addTypeParameters(superType.typeParameters);
  }
  return builder.buildDeclaration();
}

Fixed version (ground truth):
public DeclaredFunctionType withTypeInfoFromSuper(DeclaredFunctionType superType,boolean getsTypeInfoFromParentMethod){
  if (getsTypeInfoFromParentMethod && getSyntacticArity() == superType.getSyntacticArity()) {
    NominalType nt=superType.nominalType == null ? null : superType.nominalType.getNominalTypeIfSingletonObj();
    NominalType rt=this.receiverType == null ? null : this.receiverType.getNominalTypeIfSingletonObj();
    return new DeclaredFunctionType(this.commonTypes,superType.requiredFormals,superType.optionalFormals,superType.restFormals,superType.returnType,nt == null ? null : nt.getInstanceAsJSType(),rt == null ? null : rt.getInstanceAsJSType(),superType.typeParameters,false);
  }
  FunctionTypeBuilder builder=new FunctionTypeBuilder(this.commonTypes);
  int i=0;
  for (  JSType formal : this.requiredFormals) {
    builder.addReqFormal(formal != null ? formal : superType.getFormalType(i));
    i++;
  }
  for (  JSType formal : this.optionalFormals) {
    builder.addOptFormal(formal != null ? formal : superType.getFormalType(i));
    i++;
  }
  if (this.restFormals != null) {
    builder.addRestFormals(this.restFormals);
  }
 else   if (superType.hasRestFormals()) {
    builder.addRestFormals(superType.restFormals);
  }
  builder.addRetType(this.returnType != null ? this.returnType : superType.returnType);
  builder.addNominalType(this.nominalType);
  builder.addReceiverType(this.receiverType);
  if (!this.typeParameters.isEmpty()) {
    builder.addTypeParameters(this.typeParameters);
  }
 else   if (!superType.typeParameters.isEmpty()) {
    builder.addTypeParameters(superType.typeParameters);
  }
  builder.addAbstract(this.isAbstract);
  return builder.buildDeclaration();
}