Skip to content

Preserve values for map keys containing NaN - #119

Merged
k0kubun merged 2 commits into
k0kubun:masterfrom
yuefdev:fix/nan-map-values-sol
Oct 21, 2026
Merged

k0kubun merged 2 commits into
k0kubun:masterfrom
yuefdev:fix/nan-map-values-sol

Conversation

@yuefdev

@yuefdev yuefdev commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Iterate over map entries directly when collecting sorted keys and values. Looking up each key again with MapIndex loses values for non-reflexive keys, such as NaN, and prints nil instead.

The regression fails before the fix for float, complex and array keys containing NaN. Full tests, vet and changed-file gofmt pass.

Comment thread sort_test.go

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming this to sort_test.go to clarify that it's testing sort.go?

@k0kubun k0kubun Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To save your time, I'll do so myself here.

@k0kubun
k0kubun merged commit e15c025 into k0kubun:master Oct 21, 2026
5 checks 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.

2 participants