Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when passing two pairs with schema.core/optional-key as key to extra-key-schema in schema.core/defrecord #1844

Closed
myuk11 opened this issue Oct 19, 2022 · 1 comment
Projects

Comments

@myuk11
Copy link

myuk11 commented Oct 19, 2022

version
clj-kondo v2022.10.14
This problem did not occur in v2020.11.07, but seemed to have occurred since v2020.12.12.

macro usage
n/a

platform
MacOS from brew (compiled)

editor
Cursive
However, this problem also occurred when I ran it from the console.

problem

Error when passing two pairs with schema.core/optional-key as key to extra-key-schema in schema.core/defrecord.

repro

(ns repro
  (:require
   [schema.core :as s]))

(s/defrecord Record1
  [_]
  {(s/optional-key :a) s/Int}) ;; ok

(s/defrecord Record2
  [_]
  {:a s/Int
   :b s/Int}) ;; ok

(s/defrecord ErrorRecord
  [_]
  {(s/optional-key :a) s/Int
   (s/optional-key :b) s/Int}) ;; error

% clj-kondo --lint repro.clj 
repro.clj::: error: More than one function overload with arity null.
repro.clj:17:4: error: Function arguments should be wrapped in vector.
repro.clj:17:24: error: Invalid function body.
linting took 23ms, errors: 3, warnings: 0

config
This error occurred without config.

expected behavior
I expect that passing two pairs with schema.core/optional-key as keys to extra-key-schema in schema.core/defrecord will not cause an error.

@borkdude
Copy link
Member

I can reproduce this locally. You can suppress this with:

#_:clj-kondo/ignore
(s/defrecord ErrorRecord
    [_]
  {(s/optional-key :a) s/Int
   (s/optional-key :b) s/Int})

for now.

@borkdude borkdude added this to Needs triage in clj-kondo via automation Oct 19, 2022
@borkdude borkdude moved this from Needs triage to High priority (next release) in clj-kondo Oct 19, 2022
@borkdude borkdude moved this from High priority (next release) to In progress in clj-kondo Nov 2, 2022
clj-kondo automation moved this from In progress to Done Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
clj-kondo
  
Done
Development

No branches or pull requests

2 participants