Skip to content

Commit

Permalink
Closes #79: fixed bug introduced by recent enhancement #69
Browse files Browse the repository at this point in the history
  • Loading branch information
jaccomoc committed Dec 19, 2024
1 parent 435af87 commit 3b65d72
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/io/jactl/compiler/MethodCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3483,8 +3483,9 @@ private Void castToNumber(SourceLocation location) {
}
if (peek().is(ANY)) {
expect(1);
loadConst(true); // captureStackTrace
loadLocation(location);
invokeMethod(RuntimeUtils.class, "castToNumber", Object.class, String.class, Integer.TYPE);
invokeMethod(RuntimeUtils.class, RuntimeUtils.CAST_TO_NUMBER, Object.class, boolean.class, String.class, int.class);
return null;
}
error("Cannot convert " + peek() + " to Number", (Token)location);
Expand Down
1 change: 1 addition & 0 deletions src/test/java/io/jactl/BuiltinFunctionTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,7 @@ public class BuiltinFunctionTests extends BaseTest {
testError("-4.0D.pow(0.5)", "illegal request");
testError("-4L.pow(0.5)", "illegal request");
test("6.map{ it as long }.map{ (it+1).pow(4) }.reduce(1){ p,it -> p * it }", 268738560000L);
test("def x = 2\n12 / 2.pow(x)", 3);
}

@Test public void asyncCollectionClosures() {
Expand Down

0 comments on commit 3b65d72

Please sign in to comment.