Details
-
Type:
Enhancement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Completed
-
Affects Version/s: Release 1.3
-
Fix Version/s: Release 1.5
-
Component/s: None
-
Labels:None
-
Environment:OS X
-
Patch:Code
-
Approval:Ok
Description
If you forget to include the argument vector for deftype, i.e.
(deftype second-request-handler
HttpServer.RequestHandler
(canRespond [this request] true)
(getResponse [this request] nil))
which should be...
(deftype second-request-handler []
HttpServer.RequestHandler
(canRespond [this request] true)
(getResponse [this request] nil))
I get the error message..
Don't know how to create ISeq from: clojure.lang.Symbol (main.clj:1)
When in fact the error is coming from (second-request-handler.clj:3). Can this error message be improved and give the actually location of the error?
The problem is that deftype and defrecord use destructuring in the argument vector, so the error pops up before the macro is actually running.
The attached patch removes the destructuring form (but keeps the nice syntax in :arglists) and adds a vector? check to validate-fields.
All tests pass, and the example above now errors with "AssertionError No fields vector given."