final int arity = params.size();
final FunctionSignature sig = getFunctionSignature(arity);
final Type[] expectedTypes = sig.getArgumentTypes();
assert (expectedTypes.length == arity);
for(int i = 0; i < arity; i++) {
Type expected = expectedTypes[i];
XQExpression expr = params.get(i);
Type actual = expr.getType();
if(!TypeUtil.subtypeOf(actual, expected)) {// REVIEWME ok
throw new TypeError("err:XPTY0004", i + "th parameter type '" + actual
+ "' does not match to the expected argument type '" + expected + '\'');
}
}