js-interop icon indicating copy to clipboard operation
js-interop copied to clipboard

Bug in 2-arity `get-in`: Don't know how to create ISeq from: clojure.lang.Symbol when the keys are coming from a var

Open rap1ds opened this issue 3 years ago • 0 comments

Steps to reproduce:

Type to CLJS REPL:

cljs.user> (def o #js {"foo" 1})
;; => #'cljs.user/o
cljs.user> (def ks [:foo])
;; => #'cljs.user/ks
cljs.user> (j/get-in o ks)
Compile Exception: Don't know how to create ISeq from: clojure.lang.Symbol  

Expected: (j/get-in o ks) to return 1

Actual: Exception is thrown.

Note that the following works just fine:

cljs.user> (def o #js {"foo" 1})
;; => #'cljs.user/o
cljs.user> (j/get-in o [:foo])
;; => 1
cljs.user> (def o #js {"foo" 1})
;; => #'cljs.user/o
cljs.user> (def ks [:foo])
;; => #'cljs.user/ks
cljs.user> (j/get-in o ks "not found, but the 3-arity version works just fine")
;; => 1

rap1ds avatar Apr 12 '23 13:04 rap1ds