Program: 18869
Project: 18869
Buggy source:
private JSType supAndInfHelper(JSType that,boolean leastSuper){
  if (isFunctionType() && that.isFunctionType()) {
    if (isEquivalentTo(that)) {
      return this;
    }
    FunctionType other=null;
    if (that instanceof FunctionType) {
      other=(FunctionType)that;
    }
    if (other != null && isOrdinaryFunction() && that.isOrdinaryFunction() && !this.call.hasUnknownParamsOrReturn() && !other.call.hasUnknownParamsOrReturn()) {
      if (this.isSubtype(that)) {
        return leastSuper ? that : this;
      }
 else       if (that.isSubtype(this)) {
        return leastSuper ? this : that;
      }
      FunctionType merged=tryMergeFunctionPiecewise(other,leastSuper);
      if (merged != null) {
        return merged;
      }
    }
    JSType functionInstance=registry.getNativeType(JSTypeNative.FUNCTION_INSTANCE_TYPE);
    if (functionInstance.isEquivalentTo(that)) {
      return leastSuper ? that : this;
    }
 else     if (functionInstance.isEquivalentTo(this)) {
      return leastSuper ? this : that;
    }
    FunctionType greatestFn=registry.getNativeFunctionType(JSTypeNative.U2U_CONSTRUCTOR_TYPE);
    FunctionType leastFn=registry.getNativeFunctionType(JSTypeNative.LEAST_FUNCTION_TYPE);
    return leastSuper ? greatestFn : leastFn;
  }
  return leastSuper ? super.getLeastSupertype(that) : super.getGreatestSubtype(that);
}

Fixed version (ground truth):
/** 
 * Computes the supremum or infimum of functions with other types. Because sup() and inf() share a lot of logic for functions, we use a single helper.
 * @param leastSuper If true, compute the supremum of {@code this} with{@code that}. Otherwise compute the infimum.
 * @return The least supertype or greatest subtype.
 */
private JSType supAndInfHelper(JSType that,boolean leastSuper){
  if (isFunctionType() && that.isFunctionType()) {
    if (isEquivalentTo(that)) {
      return this;
    }
    FunctionType other=null;
    if (that instanceof FunctionType) {
      other=(FunctionType)that;
    }
    if (other != null && isOrdinaryFunction() && that.isOrdinaryFunction() && !this.call.hasUnknownParamsOrReturn() && !other.call.hasUnknownParamsOrReturn()) {
      boolean isSubtypeOfThat=this.isSubtype(that);
      boolean isSubtypeOfThis=that.isSubtype(this);
      if (isSubtypeOfThat && !isSubtypeOfThis) {
        return leastSuper ? that : this;
      }
 else       if (isSubtypeOfThis && !isSubtypeOfThat) {
        return leastSuper ? this : that;
      }
      FunctionType merged=tryMergeFunctionPiecewise(other,leastSuper);
      if (merged != null) {
        return merged;
      }
    }
    JSType functionInstance=registry.getNativeType(JSTypeNative.FUNCTION_INSTANCE_TYPE);
    if (functionInstance.isEquivalentTo(that)) {
      return leastSuper ? that : this;
    }
 else     if (functionInstance.isEquivalentTo(this)) {
      return leastSuper ? this : that;
    }
    FunctionType greatestFn=registry.getNativeFunctionType(JSTypeNative.U2U_CONSTRUCTOR_TYPE);
    FunctionType leastFn=registry.getNativeFunctionType(JSTypeNative.LEAST_FUNCTION_TYPE);
    return leastSuper ? greatestFn : leastFn;
  }
  return leastSuper ? super.getLeastSupertype(that) : super.getGreatestSubtype(that);
}