funcool / funcool/promesa

metadata is not forwarded to bound symbols in `p/let`

Open
#155 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Clojure
Stars
547
Forks
64
PR merge metrics
No merged PRs in 30d

Description

I have in a ClojureScript project something akin to:

```clojure
(ns app.foo
(:require
[promesa.core :as p]))

(deftype Foo [bar baz])

(defn foo
[bar baz]
(->Foo bar baz))

(p/let [x (foo "bar" "baz")]
(set! (.-bar foo) "qux")))
```

shadow-cljs compiles the code with a warning "Cannot infer target type in expression: (set! (.-bar foo) "qux")". Changing the code to use `let` instead of `p/let` fixes the issue.

I believe (via our Slack thread) that this is because `x` does not get the correct metadata attached to it when `p/let` is constructing the bindings.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.