Details
Description
Type hints don't work as expected in binding forms.
The following form results in a reflection warning:
(let [^{:tag (Class/forName "[Ljava.lang.Object;")} a (make-array Object 2)]
(aget a 0))
However, hinting does appear to work correctly on vars:
(def ^{:tag (Class/forName "[Ljava.lang.Object;")} a (make-array Object 2))
(aget a 0) ;; no reflection warning
It's a little more insidious than type hinting: the compiler doesn't evaluate metadata in the binding vec.
This doesn't throw the necessary exception...
(let [^{:foo (Class/forName "not real")} bar 42]
bar)
neither this...
(let [^{gyorgy ligeti} a 42]
a)
Gyorgy Ligeti never resolves.
These two equivalent examples don't reflect:
(let [^objects a (make-array Object 2)]
(aget a 0))
(let [a ^objects (make-array Object 2)]
(aget a 0))