Skip to content

Commit

Permalink
Only convert to long when having BigInteger
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jan 11, 2024
1 parent 5f9ec79 commit 2d54494
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.enso.base.polyglot;

import java.math.BigInteger;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.graalvm.polyglot.Value;
Expand Down Expand Up @@ -34,11 +35,11 @@ public static Object convertPolyglotValue(Value item) {
if (item.isException()) {
throw new WrappedDataflowError(item);
}
if (item.fitsInLong()) {
var ret = item.as(Object.class);
if (ret instanceof BigInteger && item.fitsInLong()) {
return item.asLong();
}

return item.as(Object.class);
return ret;
}

/**
Expand Down

0 comments on commit 2d54494

Please sign in to comment.