Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array#fill not compliant with MRI #7648

Closed
klobuczek opened this issue Feb 10, 2023 · 2 comments
Closed

Array#fill not compliant with MRI #7648

klobuczek opened this issue Feb 10, 2023 · 2 comments

Comments

@klobuczek
Copy link

Expected Behavior

2.6.4 :001 > [:foo].fill(nil,2,0)
 => [:foo, nil]
3.1.3 :001 > [:foo].fill(nil,2,0)
 => [:foo, nil]

Actual Behavior

jruby-9.3.9.0 :001 > [:foo].fill(nil,2,0)
 => [:foo]
jruby-9.4.1.0 :006 > [:foo].fill(nil,2,0)
 => [:foo]
k77ch7 added a commit to k77ch7/jruby that referenced this issue Feb 11, 2023
If start >= array.size, array#fill should extends self with nil.

Fixes jruby#7648
k77ch7 added a commit to k77ch7/jruby that referenced this issue Feb 11, 2023
If start >= array.size and length = 0, array#fill should extends self with nil.

Fixes jruby#7648
@headius
Copy link
Member

headius commented Feb 11, 2023

This is fixed by @k77ch7 but wow what a weird case! Did you run into this in real code?

@headius headius added this to the JRuby 9.3.11.0 milestone Feb 11, 2023
@headius headius closed this as completed Feb 11, 2023
@klobuczek
Copy link
Author

@headius yes I did here https://github.com/neo4jrb/activegraph/blob/master/lib/active_graph/node/scope.rb#L80
Tried to refactor:
query_params.fill(nil, query_params.length..proc.arity - 1)
to simpler
query_params.fill(nil, proc.arity, 0)

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

No branches or pull requests

2 participants