This is a bug with core.match, or (far less likely) with the macro expansion in Clojure.
This code:
`
(let (link: foo [:bar :baz)]
(match foo
(link: :bar boo) boo
:else :got-else))
`
returns :baz
. While this code:
`
(let (link: foo [:bar :baz)]
(match foo
(link: :bar foo) foo
:else :got-else))
`
returns :got-else
.
They should be equal, since the foo
in the match should shadow the foo
in
the let. In fact, when running macroexpand-1
on these forms, they only differ in
the gensym numbers and the letter f
vs b
in foo
and bar
.
I have created a repo that reproduces the bug:
https://github.com/magnars/bug-examples/tree/core-match-shadow-bindings