diff --git a/bootstrap/ISBPL.java b/bootstrap/ISBPL.java index 6c74786..c2c9663 100644 --- a/bootstrap/ISBPL.java +++ b/bootstrap/ISBPL.java @@ -1126,10 +1126,28 @@ public class ISBPL { else typeError("array", "matching-array"); for (int i = 0 ; i < isbplArray.length ; i++) { - Array.set(array, i, fromISBPL(isbplArray[i])); + Array.set(array, i, fromISBPL(isbplArray[i], expectedType.getComponentType())); } return array; } + if(expectedType.isPrimitive()) { + if(expectedType == long.class) + return o.toLong(); + if(expectedType == int.class) + return (int) o.toLong(); + if(expectedType == double.class) + return o.toDouble(); + if(expectedType == float.class) + return (float) o.toDouble(); + if(expectedType == short.class) + return (short) o.toLong(); + if(expectedType == boolean.class) + return o.isTruthy(); + if(expectedType == char.class) + return (char) o.toLong(); + if(expectedType == byte.class) + return (byte) o.toLong(); + } if(!expectedType.isAssignableFrom(o.object.getClass())) typeError(o.type.name, expectedType.getName()); return o.object;