File tree 2 files changed +10
-1
lines changed
test/clojure/test_clojure
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2022,7 +2022,9 @@ else if(v == Boolean.FALSE)
2022
2022
return NumberExpr .parse ((Number )v );
2023
2023
else if (v instanceof String )
2024
2024
return new StringExpr ((String ) v );
2025
- else if (v instanceof IPersistentCollection && ((IPersistentCollection ) v ).count () == 0 )
2025
+ else if (v instanceof IPersistentCollection
2026
+ && (((IPersistentCollection ) v ).count () == 0 )
2027
+ && (!(v instanceof IObj ) || ((IObj ) v ).meta () == null ))
2026
2028
return new EmptyExpr (v );
2027
2029
else
2028
2030
return new ConstantExpr (v );
Original file line number Diff line number Diff line change 51
51
(def ^{:a 1 } foo 0 )
52
52
#'foo)]
53
53
(is (= 1 (-> v meta :a )))))
54
+ (testing " const vars preserve metadata"
55
+ (let [[v1 v2] (eval-in-temp-ns
56
+ (def ^:const foo ^:foo [])
57
+ (def ^:const bar ^:foo [:bar ])
58
+ [(meta foo) (meta bar)])]
59
+ (is (= {:foo true } v1))
60
+ (is (= {:foo true } v2))))
54
61
#_ (testing " subsequent declare doesn't overwrite metadata"
55
62
(let [v (eval-in-temp-ns
56
63
(def ^{:b 2 } bar 0 )
You can’t perform that action at this time.
0 commit comments