Skip to content

Commit 4d21cca

Browse files
committed
Fix JSRuntime.typeof of BigInteger and Long.
1 parent eb79b80 commit 4d21cca

File tree

2 files changed

+4
-2
lines changed
  • graal-js/src

2 files changed

+4
-2
lines changed

graal-js/src/com.oracle.truffle.js.test/src/com/oracle/truffle/js/test/runtime/JSRuntimeTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ private static Object[] createValues(JSRealm realm) {
254254
JSBigInt.create(ctx, realm, BigInt.ZERO),
255255
new ForeignNull(),
256256
new ForeignTestMap(),
257-
env.asGuestValue(new Object[]{3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9})};
257+
env.asGuestValue(new Object[]{3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 9}),
258+
env.asGuestValue(BigInteger.valueOf(Long.MAX_VALUE).shiftLeft(1)),
259+
Long.MAX_VALUE};
258260
}
259261

260262
@Test

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/JSRuntime.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public static TruffleString typeof(Object value) {
220220
return Undefined.TYPE_NAME;
221221
} else if (Strings.isTString(value)) {
222222
return JSString.TYPE_NAME;
223-
} else if (isNumber(value)) {
223+
} else if (isNumber(value) || value instanceof Long) {
224224
return JSNumber.TYPE_NAME;
225225
} else if (isBigInt(value)) {
226226
return JSBigInt.TYPE_NAME;

0 commit comments

Comments
 (0)