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

MatchData#values_at drops nil with range #2783

Closed
djberg96 opened this issue Nov 13, 2022 · 2 comments
Closed

MatchData#values_at drops nil with range #2783

djberg96 opened this issue Nov 13, 2022 · 2 comments

Comments

@djberg96
Copy link
Contributor

truffleruby 22.3.0, like ruby 3.0.3, GraalVM CE Native [x86_64-darwin]

The MatchData#values_at method appears to be dropping nil when a range is larger than the number of matched values:

matchdata = /\w+/.match('hello')
p matchdata.values_at(0, 1) # => ["hello", nil] # ok
p matchdata.values_at(0..1) # => ["hello"]      # oops, expected ["hello", nil]
@andrykonchin
Copy link
Member

Thank you for reporting!

The issue can be reproduced easily. Will work on a fix.

@andrykonchin andrykonchin self-assigned this Nov 14, 2022
@andrykonchin
Copy link
Member

Fixed in 2596a23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants