Skip to content

Commit 772832a

Browse files
committedJul 17, 2018
Wow seemingly I did not compile my last commit locally since I passed 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.
1 parent 785f34b commit 772832a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,17 @@ private static IRubyObject[] prepareBlockArgsInternal(ThreadContext context, Blo
17481748

17491749
switch (block.type) {
17501750
case LAMBDA:
1751-
block.getBody().getSignature().checkArity(context.runtime, args);
1751+
// FIXME: passing a lambda to each_with_index via enumerator seems to need this.
1752+
// This is fairly complicated but we should try and eliminate needing this arg spreading
1753+
// here (test_enum.rb:test_cycle):
1754+
// cond = ->(x, i) {a << x}
1755+
// @obj.each_with_index.cycle(2, &cond)
1756+
org.jruby.runtime.Signature sig = block.getBody().getSignature();
1757+
if (sig.arityValue() != -1 && sig.required() != 1) {
1758+
args = toAry(context, args);
1759+
}
1760+
1761+
sig.checkArity(context.runtime, args);
17521762
return args;
17531763
case PROC:
17541764
return prepareProcArgs(context, block, args);

0 commit comments

Comments
 (0)
Please sign in to comment.