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

change: make nil_safe_casecmp judge compatible for nil-nil comparison #1760

Merged
merged 1 commit into from Mar 21, 2024

Conversation

mtasaka
Copy link
Contributor

@mtasaka mtasaka commented Nov 26, 2023

Ruby returns 0 (not nil) for nil <=> nil, i.e. nil and nil are judged as equal for comparison, and so returns nil_safe_compare . ref: #1476

To make the behavior of nil_safe_casecmp consistent with nil_safe_compare , change nil_safe_casecmp so that comparison between nil <=> nil return 0 (equal).

Also change testsuite to reflect this change.

Fixes #1759 .

@ianks
Copy link
Contributor

ianks commented Dec 9, 2023

This makes sense to me and seems like the correct behavior. @samdoiron thoughts?

@ianks
Copy link
Contributor

ianks commented Dec 10, 2023

@mtasaka I think there is a linting failure in CI

Ruby returns 0 (not nil) for nil <=> nil, i.e. nil and nil are judged
as equal for comparison, and so returns nil_safe_compare .
ref: Shopify#1476

To make the behavior of nil_safe_casecmp consistent with
nil_safe_compare , change nil_safe_casecmp so that comparison between
nil <=> nil return 0 (equal).

Also change testsuite to reflect this change.

Fixes Shopify#1759 .
@mtasaka
Copy link
Contributor Author

mtasaka commented Dec 15, 2023

@mtasaka I think there is a linting failure in CI

@ianks I've force-pushed my PR with indentation fixed. Would you recheck this?

@ianks ianks self-requested a review March 21, 2024 19:37
@ianks ianks merged commit dba7330 into Shopify:main Mar 21, 2024
1 check passed
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.

Test fails with Fedora glibc -2.38.9000-20.fc40 and onwards, perhaps due to qsort behavior change
3 participants