Fork me on GitHub
#clojure-dev
<
2017-02-15
>
alexmiller21:02:15

@bronsa in the process of testing the new async code, I’ve run into a problem with the ASYNC-138 patch, which I’ve described at http://dev.clojure.org/jira/browse/ASYNC-138

alexmiller21:02:24

I’ve reverted the change for now

alexmiller21:02:51

seems fixable

alexmiller21:02:17

happy to take a second look tomorrow if you have something

bronsa21:02:09

@alexmiller i think i can fix it in like 10 minutes

bronsa21:02:23

switching the type hint from the local to the init

alexmiller21:02:27

well, don’t rush :)

alexmiller21:02:37

I’m off to other things for now

alexmiller21:02:43

but will pick it up again tomorrow

bronsa21:02:02

e.g. (let [^foo a (a')]) -> (let [a ^foo (a')]) should make prim type hints valid not going to work for primitives, need to explicitely unbox

alexmiller21:02:18

yeah, that makes sense

bronsa21:02:11

altho I'll have to double check that that unboxes the local correctly

bronsa21:02:15

i'll add a bunch of test cases

bronsa22:02:18

tfw I just found another type hinting related bug in Compiler.java :(

bronsa23:02:26

user=> (set! *warn-on-reflection* true)
true
user=> (let [a ^int (identity ((fn [] 1)))] (Integer/valueOf a))
1
user=> (let [a ^int ((fn [] 1))] (Integer/valueOf a))
Reflection warning, NO_SOURCE_PATH:3:27 - call to static method valueOf on java.lang.Integer can't be resolved (argument types: unknown).
1

bronsa23:02:36

first one only works when direct linking is enabled, when direct linking is disabled both cause a reflection warning

bronsa23:02:15

I've argued in the past that that's an incorrect type hinting usage as that's unboxing and not hinting

bronsa23:02:31

and we should use (int ((fn [] 1))) instead

bronsa23:02:38

so I'm just going to ignore it