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

Lint/RedundantSafeNavigation is not safe to correct for .to_i #11929

Closed
jcoyne opened this issue Jun 5, 2023 · 1 comment
Closed

Lint/RedundantSafeNavigation is not safe to correct for .to_i #11929

jcoyne opened this issue Jun 5, 2023 · 1 comment

Comments

@jcoyne
Copy link

jcoyne commented Jun 5, 2023

Autocorrect for Lint/RedundantSafeNavigation changes the behavior of the code when the value is nil.

This code before autocorrect:

nillable = nil
nil&.to_i
# =>  nil

And after autocorrect

nillable = nil
nil.to_i
# =>  0
@koic
Copy link
Member

koic commented Jun 5, 2023

This issue is a dup with #11927 and resolved by #11915.

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

2 participants