The form is invalid in Clojure 1.13 alpha3, so clj-kondo was correct to report :rebilling and :repeat.
clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha3"}}}' \
-M -e '(let [{:keys [& :rebilling :repeat] referralamount :amount
:or {referralamount 0 :rebilling false :repeat false}}
{:amount 13}]
[referralamount])'
Result:
Syntax error macroexpanding clojure.core/let at (REPL:1:1).
:rebilling - failed: simple-symbol? at:
[:bindings :form :map-destructure :or 0]
spec: :clojure.core.specs.alpha/or
:repeat - failed: simple-symbol? at:
[:bindings :form :map-destructure :or 0]
spec: :clojure.core.specs.alpha/or
It expects simple symbols, as clj-kondo reports.
repro.clj:6:13: error: Keys in :or should be simple symbols.
repro.clj:7:14: error: Keys in :or should be simple symbols.
This behavior changed in alpha6 as part of the new destructuring work. In alpha6, the literal keys can be used in :or:
clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.13.0-alpha6"}}}' \
-M -e '(let [{:keys [& :rebilling :repeat] referralamount :amount
:or {referralamount 0 :rebilling false :repeat false}}
{:amount 13}]
[referralamount])'
Result:
[13]
With :all, the complete map can be accessed through data:
(let [{:keys [& :rebilling :repeat]
referralamount :amount
:or {referralamount 0
:rebilling false
:repeat false}
:all data}
{:amount 13}]
[referralamount
(:rebilling data)
(:repeat data)])
;; => [13 false false]
So this is not a false positive in alpha3/alpha4 support. It is an alpha6 compatibility gap. I think that the :or change should be implemented together with alpha6 :all supportThanks! Can you make a Github issue?
:or destructuring with keys (alpha4) https://github.com/clj-kondo/clj-kondo/issues/2925
:all supporting (alpha6): https://github.com/clj-kondo/clj-kondo/issues/2924
Hmm, I thought Kondo was all caught up on Alpha 5 and hadn't seen it flag the new :or features before, which I thought we had already used in a few places... but I guess we hadn't adopted that before. Only :all is new in Alpha 6, and I knew that wouldn't be accepted by Kondo.
if people keep releasing new clojure versions after I publish kondo, there's not much I can do about it, but I'll make those changes soon
:)
I wasn't aware that there were new syntax changes when I released it
I thought I'd tested it more thoroughly at the time, so I'll take responsibility for not spotting that "missing" change in an early alpha against clj-kondo.
(and if it's any consolation, I've had to change the code at work several times as I've updated the Clojure alpha versions!)