Skip to content

metadata is not forwarded to bound symbols in p/let #155

@lilactown

Description

@lilactown

I have in a ClojureScript project something akin to:

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions