Skip to content

Commit fc54caa

Browse files
kkraussepuredanger
authored andcommitted
allow string keys to contain a slash
fixes https://clojure.atlassian.net/browse/MATCH-129 Signed-off-by: Alex Miller <alex.miller@cognitect.com>
1 parent 357f885 commit fc54caa

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/main/clojure/clojure/core/match.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,9 @@ col with the first column and compile the result"
11691169
(vec (map #(specialize-map-pattern-row % env) rows)))
11701170

11711171
(defn gen-map-pattern-ocr [ocr k]
1172-
(gensym (str (name ocr) "_" (.replace (name k) "." "_DOT_") "__")))
1172+
(gensym (str (name ocr) "_" (-> (name k)
1173+
(.replace "." "_DOT_")
1174+
(.replace "/" "_SLASH_")) "__")))
11731175

11741176
(defn map-pattern-matrix-ocr-sym [k env]
11751177
(let [focr (:focr env)

src/test/clojure/clojure/core/match/test/core.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,3 +970,9 @@
970970
(match [m]
971971
[{:a.b _}] :a0))
972972
:a0)))
973+
974+
(deftest match-93
975+
(is (= (let [m {"a/b" "a"}]
976+
(match [m]
977+
[{"a/b" "a"}] :a))
978+
:a)))

0 commit comments

Comments
 (0)