throw Error.incorrectNumberOfMethodCallArguments(comparison);
}
// Validate that the switch value's type matches the comparison method's
// left hand side parameter type.
final ParameterInfo leftArg = parameters.get(0);
final ParameterInfo rightArg = parameters.get(1);
for (int i = 0, n = cases.size(); i < n; i++) {
final SwitchCase c = cases.get(i);
validateSwitchCaseType(c.getBody(), customType, resultType, "cases");
final ExpressionList<? extends Expression> testValues = c.getTestValues();
for (int j = 0, m = testValues.size(); j < m; j++) {
// When a comparison method is provided, test values can have different type but have to
// be reference assignable to the right hand side parameter of the method.
final Type rightOperandType = testValues.get(j).getType();
if (!parameterIsAssignable(rightArg.getParameterType(), rightOperandType)) {
throw Error.testValueTypeDoesNotMatchComparisonMethodParameter(
rightOperandType,
rightArg.getParameterType()
);
}
}
}