似乎 unchecked-math 并不会将 (long) 转换为 (unchecked-long),但它对 (int) 确实如此。我认为这是一个错误,如果不是的话,我也不确定为什么,因为作为一个用户,我期望 unchecked-math 标志将所有具有等效 unchecked 变体的 fn 转换为那个类型。
(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))));
记录: https://clojure.atlassian.net/browse/CLJ-2551