Program: 132567
Project: 132567
Buggy source:
private static FnMatch concretiseInputsNonOverloaded(Context context,FnOverload overload,List<Type> argTypes,boolean throwOnFail) throws TypeMismatchException {
  List<Type> expandedInArgs=matchArgs(context,overload,argTypes,throwOnFail);
  if (expandedInArgs == null) {
    return null;
  }
  assert(expandedInArgs.size() == argTypes.size());
  List<Type> concreteArgTypes=new ArrayList<Type>(argTypes.size());
  MultiMap<String,Type> tvConstraints=new MultiMap<String,Type>();
  for (int i=0; i < argTypes.size(); i++) {
    Type exp=expandedInArgs.get(i);
    Type act=argTypes.get(i);
    Type exp2=narrowArgType(context,overload.id,i,exp,act,tvConstraints,throwOnFail);
    if (exp2 == null) {
      assert(!throwOnFail);
      return null;
    }
    concreteArgTypes.add(exp2);
  }
  LogHelper.trace(context,"String_Node_Str" + overload.id.uniqueName() + "String_Node_Str"+ concreteArgTypes+ "String_Node_Str"+ tvConstraints);
  Map<String,List<Type>> bindings=unifyTypeVarConstraints(context,overload.id,overload.type.getTypeVars(),tvConstraints,throwOnFail);
  LogHelper.trace(context,"String_Node_Str" + overload.id.uniqueName() + "String_Node_Str"+ tvConstraints);
  List<FunctionType> possibilities=findPossibleFunctionTypes(context,overload.id,overload.type,concreteArgTypes,bindings);
  LogHelper.trace(context,"String_Node_Str" + overload.id.uniqueName() + "String_Node_Str"+ possibilities);
  if (possibilities.size() == 0) {
    if (throwOnFail) {
      throw new TypeMismatchException(context,"String_Node_Str" + "String_Node_Str" + overload.id.originalName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ overload.type.getInputs()+ "String_Node_Str"+ "String_Node_Str"+ argTypes);
    }
    return null;
  }
  return new FnMatch(overload,possibilities);
}

Fixed version (ground truth):
static FnMatch concretiseInputsNonOverloaded(Context context,FnOverload overload,List<Type> argTypes,boolean throwOnFail) throws TypeMismatchException {
  List<Type> expandedInArgs=matchArgs(context,overload,argTypes,throwOnFail);
  if (expandedInArgs == null) {
    return null;
  }
  assert(expandedInArgs.size() == argTypes.size());
  List<Type> concreteArgTypes=new ArrayList<Type>(argTypes.size());
  MultiMap<String,Type> tvConstraints=new MultiMap<String,Type>();
  for (int i=0; i < argTypes.size(); i++) {
    Type exp=expandedInArgs.get(i);
    Type act=argTypes.get(i);
    Type exp2=narrowArgType(context,overload.id,i,exp,act,tvConstraints,throwOnFail);
    if (exp2 == null) {
      assert(!throwOnFail);
      return null;
    }
    concreteArgTypes.add(exp2);
  }
  LogHelper.trace(context,"String_Node_Str" + overload.id.uniqueName() + "String_Node_Str"+ concreteArgTypes+ "String_Node_Str"+ tvConstraints);
  Map<String,List<Type>> bindings=unifyTypeVarConstraints(context,overload.id,overload.type.getTypeVars(),tvConstraints,throwOnFail);
  LogHelper.trace(context,"String_Node_Str" + overload.id.uniqueName() + "String_Node_Str"+ tvConstraints);
  List<FunctionType> possibilities=findPossibleFunctionTypes(context,overload.id,overload.type,concreteArgTypes,bindings);
  LogHelper.trace(context,"String_Node_Str" + overload.id.uniqueName() + "String_Node_Str"+ possibilities);
  if (possibilities.size() == 0) {
    if (throwOnFail) {
      throw new TypeMismatchException(context,"String_Node_Str" + "String_Node_Str" + overload.id.originalName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ overload.type.getInputs()+ "String_Node_Str"+ "String_Node_Str"+ argTypes);
    }
    return null;
  }
  return new FnMatch(overload,possibilities);
}