We're updating the issue view to help you get more done. 

Oddity in type tag usage for primInvoke

Description

Some odd behavior demonstrated in Clojure 1.6.0 REPL below. Why does the (Math/abs (f2 -3)) call issue a reflection warning? It seems like perhaps it should not, given the other examples.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 user=> (clojure-version) "1.6.0" user=> (set! *warn-on-reflection* true) true user=> (defn ^{:tag 'long} f1 [x] (inc x)) #'user/f1 user=> (Math/abs (f1 -3)) 2 user=> (defn ^{:tag 'long} f2 [^long x] (inc x)) #'user/f2 user=> (Math/abs (f2 -3)) Reflection warning, NO_SOURCE_PATH:6:1 - call to static method abs on java.lang.Math can't be resolved (argument types: java.lang.Object). 2 user=> (defn ^{:tag 'long} f3 ^long [^long x] (inc x)) #'user/f3 user=> (Math/abs (f3 -3)) 2

Cause: invokePrim path does not take into account var or form meta

Approach: apply var and form meta to invokePrim expression

Patch: clj-1533-2.patch

Screened by: Alex Miller

Environment

None

Status

Assignee

Unassigned

Reporter

Andy Fingerhut

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Affects versions

Release 1.6

Priority

Critical