Skip to content

return error for non-comparable key in get builtin#972

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

return error for non-comparable key in get builtin#972
netliomax25-code wants to merge 1 commit into
expr-lang:masterfrom
netliomax25-code:get-map-key-comparable

Conversation

@netliomax25-code
Copy link
Copy Markdown

Noticed get indexes a map with reflect.Value.MapIndex(reflect.ValueOf(i)) but never checks the key is comparable. When the map key type is dynamic, e.g. groupBy returns map[any][]any, a slice key passes the checker and hits a raw "hash of unhashable type" panic at runtime, so get(groupBy([1,2,3], # % 2), [1]) blows up. Since get returns errors directly, return a clean "not comparable" error before the lookup, same as the groupBy fix.

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.

1 participant