Skip to content

Commit 09b269c

Browse files
committed
Drop name metadata from conditionally defined var
1 parent a2c7273 commit 09b269c

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ For a list of breaking changes, check [here](#breaking-changes)
77
- Fix [#817](https://github.com/babashka/sci/issues/817): mutation of `deftype` field should be visible in protocol method
88
- Fix [#816](https://github.com/babashka/sci/issues/816): restore recur target exception in do
99
- Fix [#819](https://github.com/babashka/sci/issues/819): don't use metadata in record implementation
10+
- Drop name metadata from conditionally defined var
1011

1112
## v0.5.34 (2022-10-18)
1213

src/sci/impl/analyzer.cljc

+3-4
Original file line numberDiff line numberDiff line change
@@ -669,10 +669,9 @@
669669
(assoc the-current-ns name
670670
(doto (sci.lang.Var. nil (symbol (str cnn)
671671
(str name))
672-
(assoc (meta name)
673-
:name name
674-
:ns @utils/current-ns
675-
:file @utils/current-file)
672+
{:name name
673+
:ns @utils/current-ns
674+
:file @utils/current-file}
676675
false
677676
false)
678677
(vars/unbind)))

test/sci/core_test.cljc

+4
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,10 @@
16141614
(deftest type-test
16151615
(is (= :user/foo (sci/eval-string "(def x ^{:type ::foo} []) (type x)"))))
16161616

1617+
(deftest conditional-var-test
1618+
;; NOTE: :file is not conform Clojure JVM, maybe fix this another day
1619+
(is (= [:name :ns :file] (sci/eval-string "(when false (def ^:foobar x)) (keys (meta #'x))"))))
1620+
16171621
;;;; Scratch
16181622

16191623
(comment

0 commit comments

Comments
 (0)