Welcome! Please see the About page for a little more info on how this works.

0 votes
in Compiler by
edited by

It seems that unchecked-math does not turn (long) into (unchecked-long), but it does for (int). I believe this is a bug, or if not, I'm not sure why, since as a user, I'd expect the unchecked-math flag to turn all fns that have an equivalent unchecked- variant into that one.

(set! *unchecked-math* true)
(decompile (int (nth [1 2 3] 1)))
;; RT.uncheckedIntCast(RT.nth(const__5, RT.uncheckedIntCast(1L)));
(decompile (long (nth [1 2 3] 1)))
;; Numbers.num(RT.longCast(RT.nth(const__5, RT.uncheckedIntCast(1L))));

(set! *unchecked-math* false)
(decompile (int (nth [1 2 3] 1)))
;; RT.intCast(RT.nth(const__5, RT.intCast(1L)));
(decompile (long (nth [1 2 3] 1)))
;; Numbers.num(RT.longCast(RT.nth(const__5, RT.intCast(1L))));

Logged: https://clojure.atlassian.net/browse/CLJ-2551

1 Answer

0 votes

Logged in jira