private static Type computeElementType(final Expression[] value) { Type widestElementType = Type.INT; for (final Expression elem : value) { if (elem == null) { widestElementType = widestElementType.widest(Type.OBJECT); // no way to represent undefined as number break; } final Type type = elem.getType().isUnknown() ? Type.OBJECT : elem.getType(); if (type.isBoolean()) { // TODO fix this with explicit boolean types widestElementType = widestElementType.widest(Type.OBJECT); break; } widestElementType = widestElementType.widest(type); if (widestElementType.isObject()) { break; } } return widestElementType; }