if(!argumentType.isSubtypeOf(parameterType))
throw new ceylon.language.meta.model.IncompatibleTypeException("Invalid argument "+parameter.getName()+", expected type "+parameterType+" but got "+argumentType);
}else{
// make sure it has a default value
if(!parameter.isDefaulted())
throw new InvocationException("Missing value for non-defaulted parameter "+parameter.getName());
// we need to fetch the default value
value = defaultValueProvider.getDefaultParameterValue(parameter, values, parameterIndex);
argumentMap.remove(parameter.getName());
}
values.set(parameterIndex++, value);
}
// do we have extra unknown/unused parameters left?
if(!argumentMap.isEmpty()){
for(String name : argumentMap.keySet()){
throw new InvocationException("No such parameter "+name);
}
}
// FIXME: don't we need to spread any variadic param?
// now do a regular invocation