Skip to content

Commit 75ebc77

Browse files
committed
Fix multi-arity
1 parent 605679b commit 75ebc77

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/basilisp/core.lpy

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7122,14 +7122,22 @@
71227122
([arg1] ...)
71237123
([arg1 & others] ...))"
71247124
[class-and-interfaces args & fs]
7125-
(let [formatted-arity (fn [method-name [arg-vec & body]]
7125+
(let [formatted-single (fn [method-name [arg-vec & body]]
7126+
[(munge method-name)
7127+
(apply list 'fn method-name (vec (concat ['this] arg-vec)) body)])
7128+
formatted-multi (fn [method-name & arities]
71267129
[(munge method-name)
7127-
(apply list 'fn method-name (vec (concat ['this] arg-vec)) body)])
7128-
methods (mapcat (fn [[method-name & body]]
7129-
(if (vector? (first body))
7130-
(formatted-arity method-name body)
7131-
(mapcat (partial formatted-arity method-name) body)))
7132-
fs)]
7130+
(apply list
7131+
'fn
7132+
method-name
7133+
(map (fn [[arg-vec & body]]
7134+
(apply list (vec (concat ['this] arg-vec)) body))
7135+
arities))])
7136+
methods (mapcat (fn [[method-name & body]]
7137+
(if (vector? (first body))
7138+
(formatted-single method-name body)
7139+
(apply formatted-multi method-name body)))
7140+
fs)]
71337141
#_(println methods)
71347142
`((get-proxy-class ~@class-and-interfaces) ~(apply hash-map methods) ~@args)))
71357143

tests/basilisp/test_proxies.lpy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@
4141
([arg1 & args] (str "i am rest " arg1 " " args))))]
4242
(is (= "hi i am 0" (.to-string p)))
4343
(is (= "i am 1 yes" (.to-string p "yes")))
44-
(is (= "i am rest first " (.to-string p "first")))
4544
(is (= "i am rest first (:yes)" (.to-string p "first" :yes))))))

0 commit comments

Comments
 (0)