summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2009-11-12 09:10:33 -0500
committerRich Hickey <richhickey@gmail.com>2009-11-12 09:10:33 -0500
commit451390fc83bcd3a35144d62a173553572b7ad6d4 (patch)
tree8d1cf9de6d06626c1f7490c764e71fd82a0767f8
parent41f93f64a701f4a3a6ea8ecae23dc6f294d19e58 (diff)
throw on protocol sig with no args, must be at least one
-rw-r--r--src/clj/clojure/core_deftype.clj2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/clj/clojure/core_deftype.clj b/src/clj/clojure/core_deftype.clj
index 470535c4..7cf2e318 100644
--- a/src/clj/clojure/core_deftype.clj
+++ b/src/clj/clojure/core_deftype.clj
@@ -315,6 +315,8 @@
fx (nth s 2 nil)
doc (when (string? fx) fx)
mopts (apply hash-map (nthnext s (if (string? fx) 3 2)))]
+ (when (some #{0} (map count arglists))
+ (throw (IllegalArgumentException. (str "Protocol fn: " mname " must take at least one arg"))))
(assoc m (keyword mname)
(merge mopts
{:name (vary-meta mname assoc :doc doc :arglists arglists)