Skip to content

Commit b1b1f43

Browse files
authored
Fix #410: resolve cross-ns defrecord/deftype type symbol via alias (#411)
A defrecord/deftype type symbol referenced through a namespace alias (e.g. (instance? r/Foo x)) failed to resolve, a regression from #408. Fixed in SCI; bump to ebd5cfacda272eabf91f3168d56d08b64f770a80.
1 parent c735fcf commit b1b1f43

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ For a list of breaking changes, check [here](#breaking-changes).
44

55
[Nbb](https://github.com/babashka/nbb): Scripting in Clojure on Node.js using [SCI](https://github.com/babashka/sci)
66

7+
## Unreleased
8+
9+
- [#410](https://github.com/babashka/nbb/issues/410): fix regression where a `defrecord`/`deftype` type symbol referenced via a namespace alias (e.g. `(instance? r/Foo x)`) failed to resolve
10+
711
## 1.4.207 (2026-04-09)
812

913
- [#408](https://github.com/babashka/nbb/issues/408): support `IFn` on `defrecord` and `reify`

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#_{:local/root "../babashka/sci"}
1717
#_{:mvn/version "0.12.51"}
1818
{:git/url "https://github.com/babashka/sci"
19-
:git/sha "9bc5ee7371ddd24a6715066e47573f80addc98e7"}
19+
:git/sha "ebd5cfacda272eabf91f3168d56d08b64f770a80"}
2020
org.clojure/tools.cli {:mvn/version "1.0.214"}
2121
com.cognitect/transit-cljs {:mvn/version "0.8.280"}
2222
#_#_prismatic/schema {:mvn/version "1.3.0"}

test/nbb/main_test.cljs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,19 @@ result")
362362
(.then (fn [val]
363363
(is (= 1 val))))))
364364

365+
(deftest-async cross-ns-record-symbol-test
366+
;; https://github.com/babashka/nbb/issues/410: a defrecord/deftype type symbol
367+
;; referenced via a namespace alias must resolve.
368+
(-> (nbb/load-string "(ns myrec)
369+
(defrecord Foo [a])
370+
(deftype Bar [b])
371+
(ns main (:require [myrec :as r]))
372+
[(instance? r/Foo (r/->Foo 1))
373+
(instance? r/Bar (r/->Bar 2))
374+
(into {} (r/Foo. 3))]")
375+
(.then (fn [val]
376+
(is (= [true true {:a 3}] val))))))
377+
365378
(defn init []
366379
(t/run-tests 'nbb.main-test 'nbb.test-test))
367380

0 commit comments

Comments
 (0)