varargs not passed properly

Description

The following is broken as of 3196 (3165 is still working correctly)

Environment

None

Activity

Show:
import
April 22, 2015, 1:18 AM

Comment made by: sfnelson

This only occurs with defns that have multiple bodies, it does not occur with fns or with defns with a single body, or when the defn is called via apply rather than directly. Seems like it might be an off-by-one error in the calculation of required arguments in the defn dispatcher function. Test case:

test/dispatch_test.cljs

In the compiled javascript the default case of the dispatcher only pulls one argument off before calling the variadic body, whereas the applyTo body pulls two off. Seems like the dispatcher is at fault.

test/dispatch_test.js

Karsten Schmidt
April 22, 2015, 11:20 AM

You're right, Stephen! I've narrowed down the first occurrence, it's starting at r3178 - most likely with the changes done to cljs.core in this commit: https://github.com/clojure/clojurescript/commit/576fb6e054dd50ec458a3c9e4172a5a0002c7aea

will dig more & attempt a patch later today...

David Nolen
April 23, 2015, 6:34 AM

I have a fix for this, just a simple error around computing the max fixed arity.

David Nolen
April 23, 2015, 6:39 AM
David Nolen
April 23, 2015, 6:51 AM

Cut 0.0-3211 with this fix.

Assignee

David Nolen

Reporter

Karsten Schmidt

Labels

Approval

None

Patch

None

Fix versions

Affects versions

Priority

Critical
Configure