Metadata isn't being preserved on conj
In jank:
% ./build/jank repl
Bottom of clojure.core
clojure.core=> (meta ^:meta {})
{:meta true}
clojure.core=> (meta (conj ^:meta {} [:k :v]))
nil
clojure.core=>
In clj:
% clj
Clojure 1.12.0
user=> (meta ^:meta {})
{:meta true}
user=> (meta (conj ^:meta {} [:k :v]))
{:meta true}
user=>
I haven't investigated further, but this might apply to other operations and collection types.
Yep, you're right about this. Meta preservation is likely missing in a lot of places, since metadata was implemented pretty late. We do have all of the behaviors for it now, though. Just need to identify where it's needed.
@jeaye Should this one be closed?
user=> (meta (conj ^:meta {} [:k :v]))
{:meta true}
And I see Chris already worked on it in one of his previous PR.
I suppose this also could do with a few new test cases in the test suite?
Yes, we should make sure that meta preservation is tested as well. This is something we're lacking, for coverage.
It looks like this still requires some work after all:
user=> (let [meta-data {:foo 42} \
user=>... apply-meta #(-> % (with-meta meta-data) (conj [:k :v]) meta)] \
user=>... (apply-meta '()))
nil