Project

General

Profile

Actions

Feature #18621

closed

Fiber.yield loses the fact it was kwargs from Fiber#resume

Added by Eregon (Benoit Daloze) about 3 years ago. Updated about 3 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:107829]

Description

f = Fiber.new do
  args = Fiber.yield
  args
end
f.resume
args = f.resume(a: 1)
Hash.ruby2_keywords_hash?(args) # => false, but should be true, isn't it?

This also means if there is foo(*args) later and foo would require kwargs it would fail:

def foo(a: 1) = a

f = Fiber.new do
  args = Fiber.yield
  args
end
f.resume
args = f.resume(a: 1)
foo(*args)
# =>
# -:1:in `foo': wrong number of arguments (given 1, expected 0) (ArgumentError)
# 	from -:9:in `<main>'

cc @jeremyevans0 (Jeremy Evans) @mame (Yusuke Endoh)

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0