Program: 132566
Project: 132566
Buggy source:
/** 
 * Match abstract argument types to provided argument expressions, producing a list of argument types of the same length as the number of input arguments. Expand variable-length arguments or omit optional arguments if needed.
 * @param context
 * @param overload
 * @param argTypes
 * @param throwOnFail on failure, return null if falseor throw exception if true
 * @return
 * @throws TypeMismatchException
 */
private static List<Type> matchArgs(Context context,FnOverload overload,List<Type> argTypes,boolean throwOnFail) throws TypeMismatchException {
  FunctionType fnType=overload.type;
  DefaultVals<Var> defaultVals=overload.defaultVals;
  List<Type> abstractInputs=fnType.getInputs();
  int numArgs=argTypes.size();
  boolean fixedLength=!defaultVals.hasAnyDefaults() && !fnType.hasVarargs();
  int minNumArgs;
  if (defaultVals.hasAnyDefaults()) {
    minNumArgs=defaultVals.firstDefault();
  }
 else   if (fnType.hasVarargs()) {
    minNumArgs=fnType.getInputs().size() - 1;
  }
 else {
    minNumArgs=fnType.getInputs().size();
  }
  if (numArgs < abstractInputs.size() - 1) {
    if (throwOnFail) {
      throw new TypeMismatchException(context,"String_Node_Str" + "String_Node_Str" + overload.id.originalName() + "String_Node_Str"+ (fixedLength ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ minNumArgs+ "String_Node_Str"+ numArgs);
    }
    return null;
  }
  if (!fnType.hasVarargs() && numArgs > abstractInputs.size()) {
    if (throwOnFail) {
      throw new TypeMismatchException(context,"String_Node_Str" + "String_Node_Str" + overload.id.originalName() + "String_Node_Str"+ abstractInputs.size()+ "String_Node_Str"+ numArgs);
    }
    return null;
  }
  if (fnType.hasVarargs()) {
    return expandVarArgs(abstractInputs,numArgs);
  }
 else {
    return abstractInputs.subList(0,numArgs);
  }
}

Fixed version (ground truth):
/** 
 * Match abstract argument types to provided argument expressions, producing a list of argument types of the same length as the number of input arguments. Expand variable-length arguments or omit optional arguments if needed.
 * @param context
 * @param overload
 * @param argTypes
 * @param throwOnFail on failure, return null if falseor throw exception if true
 * @return
 * @throws TypeMismatchException
 */
private static List<Type> matchArgs(Context context,FnOverload overload,List<Type> argTypes,boolean throwOnFail) throws TypeMismatchException {
  FunctionType fnType=overload.type;
  DefaultVals<Var> defaultVals=overload.defaultVals;
  List<Type> abstractInputs=fnType.getInputs();
  int numArgs=argTypes.size();
  boolean fixedLength=!defaultVals.hasAnyDefaults() && !fnType.hasVarargs();
  int minNumArgs;
  if (defaultVals.hasAnyDefaults()) {
    minNumArgs=defaultVals.firstDefault();
  }
 else   if (fnType.hasVarargs()) {
    minNumArgs=fnType.getInputs().size() - 1;
  }
 else {
    minNumArgs=fnType.getInputs().size();
  }
  if (numArgs < minNumArgs) {
    if (throwOnFail) {
      throw new TypeMismatchException(context,"String_Node_Str" + "String_Node_Str" + overload.id.originalName() + "String_Node_Str"+ (fixedLength ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ minNumArgs+ "String_Node_Str"+ numArgs);
    }
    return null;
  }
  if (!fnType.hasVarargs() && numArgs > abstractInputs.size()) {
    if (throwOnFail) {
      throw new TypeMismatchException(context,"String_Node_Str" + "String_Node_Str" + overload.id.originalName() + "String_Node_Str"+ abstractInputs.size()+ "String_Node_Str"+ numArgs);
    }
    return null;
  }
  if (fnType.hasVarargs()) {
    return expandVarArgs(abstractInputs,numArgs);
  }
 else {
    return abstractInputs.subList(0,numArgs);
  }
}