I'm not sure how to describe it by words but the code is clear. This construct is heavily used in dry and ROM.
To reproduce:
def demo(*args)
yield(*args, type_spec: true)
end
demo do |*args, type_spec:|
puts *args
puts type_spec
end
Error:
block.rb:5:in `block in <main>': missing keyword: type_spec (ArgumentError)
from block.rb:2:in `demo'
from block.rb:5:in `<main>'
@chrisseaton please, make this as a high priority for RC14. This solves many issues in dry and ROM land
I don't think our yield handles keyword arguments properly. It's kind of a parallel to the usual method call, but with all the same complexity and less-well tested.
@chrisseaton: can be this fixed in RC15, please? I've added testing TruffleRuby in Travis CI for other several dry-rb gems and this would fixed a lot of the rest issues.
Is there any change to be this fixed in RC15?
@eregon Hello, is there any change to get fixed this into RC15?
Sorry this hasn't managed to go into RC15, but we have a lot of time scheduled this month to look at this issue backlog.
馃樋
I should be able to get you a build with it in a week or so though.
I'm working with this spec for this at the moment
describe "taking |*a, b:|" do
it "assigns the keyword argument and nothing in rest" do
@y.k { |*a, b:| [a, b] }.should == [[], true]
end
end
This is probably more precisely the problem
describe "taking a splat and a keyword argument" do
it "passes it as an array of a hash" do
@y.k([1, 2]) { |*a| a }.should == [1, 2, {:b=>true}] # [[1, 2, {:b=>true}]] on TruffleRuby
end
end
A fix for this is on the way.
@chrisseaton If possible to make a new nightly build for me after fixing this, please?
Fixed in 0c71a5bf5d2681cf2acbb875fd779c505f6f55b8.