From 66487bb783aabbaaf540389aeccdda5834d75fb7 Mon Sep 17 00:00:00 2001 From: davidnolen Date: Sun, 17 Nov 2024 09:55:47 -0500 Subject: [PATCH] * :op :quote should be :literal? true * map, vector, quote tests --- src/main/clojure/cljs/analyzer.cljc | 1 + src/test/clojure/cljs/analyzer/spec_tests.clj | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/clojure/cljs/analyzer.cljc b/src/main/clojure/cljs/analyzer.cljc index f1182116f..47bb73dc4 100644 --- a/src/main/clojure/cljs/analyzer.cljc +++ b/src/main/clojure/cljs/analyzer.cljc @@ -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 diff --git a/src/test/clojure/cljs/analyzer/spec_tests.clj b/src/test/clojure/cljs/analyzer/spec_tests.clj index 4947a1860..55e5b6f4a 100644 --- a/src/test/clojure/cljs/analyzer/spec_tests.clj +++ b/src/test/clojure/cljs/analyzer/spec_tests.clj @@ -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)))] @@ -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)))))] @@ -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