Skip to content

Commit

Permalink
* :op :quote should be :literal? true
Browse files Browse the repository at this point in the history
* map, vector, quote tests
  • Loading branch information
swannodette committed Nov 17, 2024
1 parent 2c92f31 commit 66487bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main/clojure/cljs/analyzer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2571,6 +2571,7 @@
(throw (error env "Wrong number of args to quote")))
(let [expr (analyze-const env x)]
{:op :quote
:literal? true
:expr expr
:env env
:form form
Expand Down
15 changes: 12 additions & 3 deletions src/test/clojure/cljs/analyzer/spec_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@
x))))]
(is (s/valid? ::a/node node))))

;; map
(deftest test-map
(let [node (no-warn (analyze ns-env '{:foo 1 :bar 2}))]
(is (= :map (:op node)))
(is (s/valid? ::a/node node))))

(deftest test-new
(let [node (no-warn (analyze ns-env '(new String)))]
Expand All @@ -162,7 +165,10 @@

;; ns*

;; quote
(deftest test-quote
(let [node (analyze ns-env ''(1 2 3))]
(is (= :quote (:op node)))
(is (s/valid? ::a/node node))))

(deftest test-recur
(let [node (no-warn (analyze ns-env '(fn [x] (recur (inc x)))))]
Expand All @@ -183,7 +189,10 @@

;; var

;; vector
(deftest test-map
(let [node (no-warn (analyze ns-env '[1 2]))]
(is (= :vector (:op node)))
(is (s/valid? ::a/node node))))

;; with-meta

Expand Down

0 comments on commit 66487bb

Please sign in to comment.