Skip to content
Snippets Groups Projects
Commit ff85f0be authored by Zbyněk Šlajchrt's avatar Zbyněk Šlajchrt
Browse files

Merge pull request #437 in G/fastr from ~ZBYNEK.SLAJCHRT_ORACLE.COM/fastr:quantBaseFix to master

* commit 'e10a0540':
  The cast pipeline in Quantifier (the base class of All and Any builtin) fixed
parents c0994d48 e10a0540
Branches
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@
*/
package com.oracle.truffle.r.nodes.builtin.base;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.integerValue;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.*;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.logicalValue;
import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.toBoolean;
......@@ -44,6 +44,7 @@ import com.oracle.truffle.r.runtime.data.RArgsValuesAndNames;
import com.oracle.truffle.r.runtime.data.RMissing;
import com.oracle.truffle.r.runtime.data.RNull;
import com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector;
import com.oracle.truffle.r.runtime.data.model.RAbstractVector;
import com.oracle.truffle.r.runtime.ops.na.NACheck;
public abstract class Quantifier extends RBuiltinNode {
......@@ -70,7 +71,8 @@ public abstract class Quantifier extends RBuiltinNode {
private void createArgCast(int index) {
CastBuilder argCastBuilder = new CastBuilder();
argCastBuilder.arg(0).allowNull().shouldBe(integerValue().or(logicalValue()), RError.Message.COERCING_ARGUMENT, argTypeName, "logical").asLogicalVector();
argCastBuilder.arg(0).allowNull().shouldBe(integerValue().or(logicalValue()).or(instanceOf(RAbstractVector.class).and(size(0))), RError.Message.COERCING_ARGUMENT, argTypeName,
"logical").asLogicalVector();
argCastNodes[index] = insert(argCastBuilder.getCasts()[0]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment