I've found two odd cases. The first seems like a bug :
In trying to annotate a multi-ariadic function I had some difficulty
digging up the syntax. (all of these examples came from working with
quartzite , a clojure wrapper around the Quartz library).
My incorrect annotation looked like this (The "Fn" should be "IFn" -icore-typed reports that "First argument to TApp must be TFn, actual: Fn").:
(t/ann loaded-triggers (t/Fn [ -> TriggerReport] [String -> TriggerReport]))
(defn loaded-triggers"
([] (loaded-triggers ""))
([triggerGroupName] ... ))
When I was first working with this I had the annotation marked as
:no-check. What was surprising was that with no-check on core-typed
seems to accept what looks like a syntax error.
Second issue - I've run into a typing puzzle I cannot figure out how to solve, also related to the same library.
Quartz defines a Job interface
Job that just defines an execute function. The quartzite library defines a macro,
defjob, that provides a wrapper for this:
(defmacro defjob
[jtype args & body]
`(defrecord ~jtype []
org.quartz.Job
(execute [this ~@args]
I can't see how to annotate this, as it seems to refer to the macro
expansion (?) e.g.
(t/ann-record ReportJob [execute :- [t/Any JobExecutionContext]])
(defjob MyJob [^JobExecutionContext ctx] ... body that will run in job execute)
gives:
deftype MyJob fields do not match annotation. Expected: [execute], Actual: [__meta __extmap]
I'd be happy to mark this as no-check but I can't even really
understand what it's supposed to be.
Any suggestions appreciated.
Thanks,
Steve Benjamin