Skip to content

Commit c5e0887

Browse files
tonskydnolen
authored and
dnolen
committed
CLJS-1432 '$ and '. symbols collision under advanced
1 parent e55493f commit c5e0887

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@
378378
name (if (keyword? value)
379379
(subs (str value) 1)
380380
(str value))
381-
name (-> name (string/replace "-" "_DASH_") (munge) (string/replace "." "$"))]
381+
name (if (= "." name)
382+
"_DOT_"
383+
(-> name (string/replace "-" "_DASH_") (munge) (string/replace "." "$")))]
382384
(symbol (str prefix name))))
383385

384386
(defn- register-constant!

src/test/cljs/cljs/core_test.cljs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,11 @@
306306
(is (= :a (keyword "a")))
307307
(is (= :a (keyword 'a)))
308308
(is (= :a/b (keyword 'a 'b)))
309-
(is (= :a (keyword :a)))))
309+
(is (= :a (keyword :a))))
310+
311+
(testing "Testing name munging CLJS-1432"
312+
(is (not= :$ :.))
313+
(is (not= '$ '.))))
310314

311315
(deftest test-map-operations
312316
(testing "Test basic map collection operations"

src/test/clojure/cljs/analyzer_tests.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@
342342
;; munge turns - into _, must preserve the dash first
343343
(is (not= (a/gen-constant-id :test-kw)
344344
(a/gen-constant-id :test_kw))))
345+
346+
(deftest test-symbols-munge-cljs-1432
347+
(is (not= (a/gen-constant-id :$)
348+
(a/gen-constant-id :.)))
349+
(is (not= (a/gen-constant-id '$)
350+
(a/gen-constant-id '.))))
345351
;; Constants
346352

347353
(deftest test-constants

0 commit comments

Comments
 (0)