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

Misleading error message on condp predicate arity mismatch #1505

Open
krajj7 opened this issue Feb 26, 2023 · 1 comment
Open

Misleading error message on condp predicate arity mismatch #1505

krajj7 opened this issue Feb 26, 2023 · 1 comment

Comments

@krajj7
Copy link

krajj7 commented Feb 26, 2023

Tested with v1.1.173

Babashka produces a misleading error message for the code below. In the code an invalid number of args is passed to the "pred" function (it's supposed to be a binary predicate for condp), but babashka says the problem is with the "myfn" call instead. Ideally babashka should point to the condp call and name the "pred" function.

Code:

(defn pred [x]
  (= x 5))

(defn myfn [a]
  (condp pred a
    1 :a
    :b))

(myfn 1)

Error produced:

----- Error --------------------------------------------------------------------
Type:     clojure.lang.ArityException
Message:  Wrong number of args (2) passed to: user/myfn
Location: /home/jan/bug.bb:9:1

----- Context ------------------------------------------------------------------
5:   (condp pred a
6:     1 :a
7:     :b))
8: 
9: (myfn 1)
   ^--- Wrong number of args (2) passed to: user/myfn

----- Stack trace --------------------------------------------------------------
user/myfn - /home/jan/bug.bb:4:1
user      - /home/jan/bug.bb:9:1
@borkdude
Copy link
Collaborator

Thanks for the issue, I'll see what I can do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants