Skip to content
Snippets Groups Projects
Commit f5591ec4 authored by Mick Jordan's avatar Mick Jordan
Browse files

correct error for switch with > 1 length character vector

parent 0ff03b9e
No related branches found
No related tags found
No related merge requests found
......@@ -47,9 +47,12 @@ public abstract class Switch extends RBuiltinNode {
private final ConditionProfile returnValueProfile = ConditionProfile.createBinaryProfile();
private final BranchProfile notIntType = BranchProfile.create();
@Specialization(guards = "isLengthOne(x)")
@Specialization
protected Object doSwitch(VirtualFrame frame, RAbstractStringVector x, RArgsValuesAndNames optionalArgs) {
controlVisibility();
if (x.getLength() != 1) {
throw RError.error(this, RError.Message.EXPR_NOT_LENGTH_ONE);
}
return prepareResult(doSwitchString(frame, x, optionalArgs));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment