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

0 votes
in Clojure by

`
user> some?

function[clojure.core/some?]

user> (.hashCode map)
72400056
user> (.hashCode str)
ClassCastException clojure.core$str cannot be cast to java.lang.String /eval39172 (form-init3428514420830954023.clj:5793)
user> (.hashCode (fn []))
1715179801
user> (.hashCode some?)
ClassCastException clojure.core$someQMARK cannot be cast to java.lang.Boolean /eval39178 (form-init3428514420830954023.clj:5797)
user> (.hashCode #'some?)
1955712430
user> (.hashCode @#'some?)
1726569843
`

4 Answers

0 votes
by

Comment made by: bronsa

This happens because some? and str have type hints on the Var to signal the type returned by their invocations, but the Compiler thinks those type hints apply to the Var object itself aswell.

An easy fix would be to move those type hints from the Var (old-style) to the argvec (new-style)

0 votes
by

Comment made by: gshayban

agreed with nicola's suggestion - change type hints. This is a dup of CLJ-140 where :tag causes confusion when a var is being invoked vs used in expr context

0 votes
by

Comment made by: wagjo

Patch attached

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1955 (reported by alex+import)
...