Skip to content
Snippets Groups Projects
Commit b2a6ddc2 authored by Tomáš Zezula's avatar Tomáš Zezula
Browse files

[GR-9410] TCK tests failing due to attempt to unbox RComplexVector.

PullRequest: fastr/1482
parents 798c13d2 874986d1
No related branches found
No related tags found
No related merge requests found
......@@ -325,11 +325,25 @@ public final class RAbstractVectorAccessFactory implements StandardFactory {
@Override
public Object execute(VirtualFrame frame) {
RAbstractVector arg = (RAbstractVector) ForeignAccess.getReceiver(frame);
return arg.getLength() == 1;
return arg.getLength() == 1 && isUnBoxable(arg);
}
});
}
private static boolean isUnBoxable(RAbstractVector vector) {
Object o = vector.getDataAtAsObject(0);
return isPrimitive(o);
}
private static boolean isPrimitive(Object element) {
if (element == null) {
return false;
}
final Class<?> elementType = element.getClass();
return elementType == String.class || elementType == Character.class || elementType == Boolean.class || elementType == Byte.class || elementType == Short.class ||
elementType == Integer.class || elementType == Long.class || elementType == Float.class || elementType == Double.class;
}
@Override
public CallTarget accessHasSize() {
return Truffle.getRuntime().createCallTarget(new InteropRootNode() {
......
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