Skip to content

Commit

Permalink
Wow seemingly I did not compile my last commit locally since I passed…
Browse files Browse the repository at this point in the history
… all tests.

Add back in spreading args in prepareBlockArgsInternal with an example of
how it fails.  We may be able to change how we call higher up stream so this
spreading happens elsewhere.
  • Loading branch information
enebo committed Jul 17, 2018
1 parent 785f34b commit 772832a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Expand Up @@ -1748,7 +1748,17 @@ private static IRubyObject[] prepareBlockArgsInternal(ThreadContext context, Blo

switch (block.type) {
case LAMBDA:
block.getBody().getSignature().checkArity(context.runtime, args);
// FIXME: passing a lambda to each_with_index via enumerator seems to need this.
// This is fairly complicated but we should try and eliminate needing this arg spreading
// here (test_enum.rb:test_cycle):
// cond = ->(x, i) {a << x}
// @obj.each_with_index.cycle(2, &cond)
org.jruby.runtime.Signature sig = block.getBody().getSignature();
if (sig.arityValue() != -1 && sig.required() != 1) {
args = toAry(context, args);
}

sig.checkArity(context.runtime, args);
return args;
case PROC:
return prepareProcArgs(context, block, args);
Expand Down

0 comments on commit 772832a

Please sign in to comment.