You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
checker: check nested overloaded calls in linear time (#1010)
An overloaded function, such as the replace, join or sort builtins, checks
its arguments once per overload it tries. Nested calls multiplied this at
every level, so compile time grew exponentially with nesting depth: 42
nested replace calls never finished compiling.
While overloads are being tried, cache the natures of call and builtin
nodes for the rest of the pass, so trying the next overload doesn't check
them again. The cache is cleared on reset, at the start of every pass.
Fixes#1008
feat(builtin): add merge() for combining maps (#947)
Add a variadic merge() builtin that shallow-merges two or more maps.
Later maps override earlier ones (last-write-wins). Returns a new map
without modifying inputs. Keys keep their original type, so the result
is map[any]any, the same type fromPairs() returns.
The copy loop uses MapRange rather than MapKeys plus MapIndex, because
MapIndex looks a key up by equality and so drops any key that is not
equal to itself, such as NaN.
Fixes#895
Co-authored-by: Anton Medvedev <anton@medv.io>