Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit c0b81aa

Browse files
Revert "CLJ-1024: Check for invalid varags/destrucuring uses."
This reverts commit ed9670b.
1 parent ed99515 commit c0b81aa

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/clj/clojure/core_deftype.clj

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,6 @@
1616
[ns]
1717
(.replace (str ns) \- \_))
1818

19-
(defn ^:private throw-on-varargs
20-
"Throws an exception if arglist contains a varargs declaration.
21-
Protocol/interface method impls defined with deftype, defrecord, and reify
22-
don't support varags."
23-
[arglist]
24-
(when (some #(= '& %) arglist)
25-
(throw (IllegalArgumentException.
26-
"No varargs support for definterface and defprotocol method sigs;
27-
ditto for method impls defined with deftype, defrecord, and reify."))))
28-
29-
(defn ^:private throw-on-varargs-or-destr
30-
"Throws an exception if arglist contains a varargs declaration or a
31-
destructuring form.
32-
Protocol/interface method signatures shouldn't use varargs/destructuring."
33-
[arglist]
34-
(when (some #(or (= '& %) (coll? %)) arglist)
35-
(throw (IllegalArgumentException.
36-
"No varargs nor destructuring support for definterface and defprotocol method sigs."))))
37-
3819
;for now, built on gen-interface
3920
(defmacro definterface
4021
"Creates a new Java interface with the given name and method sigs.
@@ -48,7 +29,6 @@ ditto for method impls defined with deftype, defrecord, and reify."))))
4829
[name & sigs]
4930
(let [tag (fn [x] (or (:tag (meta x)) Object))
5031
psig (fn [[name [& args]]]
51-
(throw-on-varargs-or-destr args)
5232
(vector name (vec (map tag args)) (tag name) (map meta args)))
5333
cname (with-meta (symbol (str (namespace-munge *ns*) "." name)) (meta name))]
5434
`(let []
@@ -81,7 +61,6 @@ ditto for method impls defined with deftype, defrecord, and reify."))))
8161
(disj 'Object 'java.lang.Object)
8262
vec)
8363
methods (map (fn [[name params & body]]
84-
(throw-on-varargs params)
8564
(cons name (maybe-destructured params body)))
8665
(apply concat (vals impls)))]
8766
(when-let [bad-opts (seq (remove #{:no-print} (keys opts)))]
@@ -626,8 +605,6 @@ ditto for method impls defined with deftype, defrecord, and reify."))))
626605
(if (vector? (first rs))
627606
(recur (conj as (first rs)) (next rs))
628607
[(seq as) (first rs)]))]
629-
(doseq [arglist arglists]
630-
(throw-on-varargs-or-destr arglist))
631608
(when (some #{0} (map count arglists))
632609
(throw (IllegalArgumentException. (str "Protocol fn: " mname " must take at least one arg"))))
633610
(assoc m (keyword mname)

0 commit comments

Comments
 (0)