Skip to content

reject non-comparable keys in fromPairs#964

Open
netliomax25-code wants to merge 1 commit into
expr-lang:masterfrom
netliomax25-code:frompairs-non-comparable-key
Open

reject non-comparable keys in fromPairs#964
netliomax25-code wants to merge 1 commit into
expr-lang:masterfrom
netliomax25-code:frompairs-non-comparable-key

Conversation

@netliomax25-code

Copy link
Copy Markdown

fromPairs builds a map[any]any, so a pair whose key is a slice or
map hits a raw "hash of unhashable type" runtime panic. Check the
key is comparable before SetMapIndex and return an error instead,
matching the groupBy handling added in #940.

@netliomax25-code

Copy link
Copy Markdown
Author

gentle ping

@sanmaxdev sanmaxdev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verified that fromPairs now returns a descriptive error for slice keys instead of panicking.

Checks passed:

  • go test ./...
  • go test -race .
  • go test -tags=expr_debug -run=TestDebugger -v ./vm
  • GOARCH=386 go build
  • git diff --check origin/master...HEAD

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