This kind of thing happens when you redefine a type (with deftype
or defrecord
) but somewhere there's a use of the previously existing class hanging around, in your case in the type hint.
I couldn't reproduce the behavior you describe with CountercClockwise's CtrlAltS, but it does appear evaluating the following expressions in a fresh REPL, so it might somehow help to diagnose your specific situation.
(defprotocol TestProt
(geta [this])
(getb [this]))
(deftype TestType [a b]
TestProt
(geta [this] a)
(getb [this] b))
(defn test-function [^TestType a-testtype]
(print (.geta a-testtype)))
(def test-tt (TestType. 1 1))
(println :first (test-function test-tt))
;= :first 1
;; redefine the type...
(deftype TestType [a b]
TestProt
(geta [this] a)
(getb [this] b))
;; ...and the test-tt var with the new version
(def test-tt (TestType. 1 1))
(println :second (test-function test-tt))
;= ClassCastException user.TestType cannot be cast to user.TestType user/test-function (NO_SOURCE_FILE:89)