Skip to content

Fix invalid recur arity#1034

Merged
borkdude merged 5 commits intobabashka:masterfrom
vieirandre:fix-1950
Mar 19, 2026
Merged

Fix invalid recur arity#1034
borkdude merged 5 commits intobabashka:masterfrom
vieirandre:fix-1950

Conversation

@vieirandre
Copy link
Contributor

@vieirandre vieirandre commented Mar 18, 2026


Addressing #834 and #1950, this fixes invalid recur arity handling.

SCI was accepting malformed recur calls in functions, especially variadic ones like (fn [f & args] ...), where (recur r) should be rejected because recur must supply values for both f and args

This change adds the missing arity validation in the analyzer so SCI now matches Clojure and fails fast with Mismatched argument count to recur

In this PR I'm also adding regression coverage for invalid fixed-arity and variadic recur calls, plus a positive trampoline-style case (took from the issue creator).

@borkdude
Copy link
Collaborator

The tests in impl/analyzer could just live in core_test like the others

@vieirandre
Copy link
Contributor Author

Got it. I moved the valid case and removed the other two (redundant).

@vieirandre
Copy link
Contributor Author

vieirandre commented Mar 19, 2026

I added a loop test for your case in #834 as well (and a reference to the issue in the PR description).

@borkdude borkdude merged commit 9995c93 into babashka:master Mar 19, 2026
6 checks passed
@borkdude
Copy link
Collaborator

Thanks!

@vieirandre vieirandre deleted the fix-1950 branch March 22, 2026 01:04
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

Successfully merging this pull request may close these issues.

2 participants