Skip to content

Commit 32c39f8

Browse files
committed
Rb yield splat fix
PullRequest: truffleruby/744
2 parents 0ff328a + 82f726c commit 32c39f8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/truffle/truffle/cext.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ def rb_yield(value)
10911091
end
10921092

10931093
def rb_yield_splat(values)
1094-
Truffle.invoke_primitive(:interop_call_c_with_mutex, rb_block_proc, [values])
1094+
Truffle.invoke_primitive(:interop_call_c_with_mutex, rb_block_proc, values)
10951095
end
10961096

10971097
def rb_ivar_lookup(object, name, default_value)

spec/ruby/optional/capi/kernel_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@
244244
@s.rb_yield_splat([1, 2]) { |x, y| x + y }.should == 3
245245
end
246246

247+
it "passes arguments to a block accepting splatted args" do
248+
@s.rb_yield_splat([1, 2]) { |*v| v }.should == [1, 2]
249+
end
250+
247251
it "raises LocalJumpError when no block is given" do
248252
lambda { @s.rb_yield_splat([1, 2]) }.should raise_error(LocalJumpError)
249253
end

0 commit comments

Comments
 (0)