Skip to content

Fix Enumerator::Lazy value packing of source yields#9466

Draft
sampokuokkanen wants to merge 1 commit into
jruby:masterfrom
sampokuokkanen:fix-lazy-value-packing
Draft

Fix Enumerator::Lazy value packing of source yields#9466
sampokuokkanen wants to merge 1 commit into
jruby:masterfrom
sampokuokkanen:fix-lazy-value-packing

Conversation

@sampokuokkanen
Copy link
Copy Markdown
Contributor

Lazy.make_proc was an arity-faithful passthrough (yield yielder, *x) instead of applying CRuby's rb_enum_values_pack rule (enum.c): 0 args -> nil, 1 arg -> the value, N args -> Array. Pipeline stages downstream expect the packed form, so a zero-argument source yield surfaced as [] and a multi-argument yield surfaced as separate block args, both diverging from MRI.

Specced via Enumerable#take / Enumerator::Lazy#take shared examples in ruby/spec#1363.

Lazy.make_proc was an arity-faithful passthrough (`yield yielder, *x`) instead of applying CRuby's rb_enum_values_pack rule (enum.c): 0 args -> nil, 1 arg -> the value, N args -> Array. Pipeline stages downstream expect the packed form, so a zero-argument source yield surfaced as `[]` and a multi-argument yield surfaced as separate block args, both diverging from MRI.

Specced via Enumerable#take / Enumerator::Lazy#take shared examples in ruby/spec.
@sampokuokkanen
Copy link
Copy Markdown
Contributor Author

This needs a bigger Java-based refactor with something like LazyYielder. Will turn the PR into a draft for now.

@sampokuokkanen sampokuokkanen marked this pull request as draft May 28, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant