From 12a2562ba95d1694c21d9b4b6fbffd33b1fd9d69 Mon Sep 17 00:00:00 2001 From: Alexander Taggart Date: Sat, 8 Oct 2011 00:22:18 -0700 Subject: [PATCH] Fix CLJ-845: Ignoring namespace portion of symbols used to name methods in extend-type and extend-protocol. --- src/clj/clojure/core_deftype.clj | 2 +- test/clojure/test_clojure/protocols.clj | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/src/clj/clojure/core_deftype.clj b/src/clj/clojure/core_deftype.clj index d5eceaa..ca8ab2e 100644 --- a/src/clj/clojure/core_deftype.clj +++ b/src/clj/clojure/core_deftype.clj @@ -711,7 +711,7 @@ (cons (apply vector (vary-meta target assoc :tag c) args) body)) specs)))] - [p (zipmap (map #(-> % first keyword) fs) + [p (zipmap (map #(-> % first name keyword) fs) (map #(cons 'fn (hint (drop 1 %))) fs))])) (defn- emit-extend-type [c specs] diff --git a/test/clojure/test_clojure/protocols.clj b/test/clojure/test_clojure/protocols.clj index 1613291..45ac9f9 100644 --- a/test/clojure/test_clojure/protocols.clj +++ b/test/clojure/test_clojure/protocols.clj @@ -544,3 +544,26 @@ (is (= 2 (.hinted r 1))) (is (= "xoxo" (.hinted r "xo"))))))) + +; see CLJ-845 +(defprotocol SyntaxQuoteTestProtocol + (sqtp [p])) + +(defmacro try-extend-type [c] + `(extend-type ~c + SyntaxQuoteTestProtocol + (sqtp [p#] p#))) + +(defmacro try-extend-protocol [c] + `(extend-protocol SyntaxQuoteTestProtocol + ~c + (sqtp [p#] p#))) + +(try-extend-type String) +(try-extend-protocol clojure.lang.Keyword) + +(deftest test-no-ns-capture + (is (= "foo" (sqtp "foo"))) + (is (= :foo (sqtp :foo)))) + + -- 1.7.3.5