Skip to content

Commit abd54ba

Browse files
committed
Inline Map.merge/3
1 parent 8f696d0 commit abd54ba

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/elixir/lib/map.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ defmodule Map do
639639
`map2`). The value returned by `fun` is used as the value under `key` in
640640
the resulting map.
641641
642+
Inlined by the compiler.
643+
642644
## Examples
643645
644646
iex> Map.merge(%{a: 1, b: 2}, %{a: 3, d: 4}, fn _k, v1, v2 ->

lib/elixir/src/elixir_rewrite.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ rewrite(Receiver, DotMeta, Right, Meta, Args) ->
251251
?rewrite(?map, fetch, [Map, Key], maps, find, [Key, Map]);
252252
?rewrite(?map, 'fetch!', [Map, Key], maps, get, [Key, Map]);
253253
?rewrite(?map, 'has_key?', [Map, Key], maps, is_key, [Key, Map]);
254+
?rewrite(?map, merge, [Map1, Map2, Fun], maps, merge_with, [Fun, Map1, Map2]);
254255
?rewrite(?map, put, [Map, Key, Value], maps, put, [Key, Value, Map]);
255256
?rewrite(?map, 'replace!', [Map, Key, Value], maps, update, [Key, Value, Map]);
256257
?rewrite(?port, monitor, [Arg], erlang, monitor, [port, Arg]);

0 commit comments

Comments
 (0)