Skip to content

Commit d5995f4

Browse files
author
James Hamlin
committed
Fix attachment of metadata to literal collections
Signed-off-by: James Hamlin <[email protected]>
1 parent fa96298 commit d5995f4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pkg/compiler/analyze.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ func (a *Analyzer) analyzeVector(form IPersistentVector, env Env) (*ast.Node, er
162162
n.Sub = &ast.VectorNode{
163163
Items: items,
164164
}
165-
return n, nil
165+
166+
return a.wrappingMeta(n)
166167
}
167168

168169
// analyzeMap performs semantic analysis on the given map,
@@ -190,7 +191,8 @@ func (a *Analyzer) analyzeMap(v IPersistentMap, env Env) (*ast.Node, error) {
190191
Keys: keys,
191192
Vals: vals,
192193
}
193-
return n, nil
194+
195+
return a.wrappingMeta(n)
194196
}
195197

196198
// analyzeSet performs semantic analysis on the given set,
@@ -209,7 +211,8 @@ func (a *Analyzer) analyzeSet(v IPersistentSet, env Env) (*ast.Node, error) {
209211
n.Sub = &ast.SetNode{
210212
Items: items,
211213
}
212-
return n, nil
214+
215+
return a.wrappingMeta(n)
213216
}
214217

215218
// analyzeSeq performs semantic analysis on the given sequence,

test/glojure/test_glojure/basic.glj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
(is (= [1 2 3] (defn-keys {:a 1 :b 2 :c 3}))))
105105

106106
(deftest literal-meta
107-
(is (= (meta ^:foo []) {:foo true}))
108-
(is (= (meta ^:foo {}) {:foo true})))
107+
(is (:foo (meta ^:foo [])))
108+
(is (:foo (meta ^:foo #{})))
109+
(is (:foo (meta ^:foo {}))))
109110

110111
(run-tests)

0 commit comments

Comments
 (0)