Skip to content

Commit 82a60e6

Browse files
committed
Inline List.duplicate/2
1 parent 1f49d86 commit 82a60e6

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/elixir/lib/list.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ defmodule List do
166166
167167
If `n` is `0`, an empty list is returned.
168168
169+
Inlined by the compiler.
170+
169171
## Examples
170172
171173
iex> List.duplicate("hello", 0)

lib/elixir/src/elixir_rewrite.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ rewrite(Receiver, DotMeta, Right, Meta, Args) ->
243243
?rewrite(?float, to_charlist, [Arg], erlang, float_to_list, [Arg, [short]]);
244244
?rewrite(?float, to_string, [Arg], erlang, float_to_binary, [Arg, [short]]);
245245
?rewrite(?kernel, is_map_key, [Map, Key], erlang, is_map_key, [Key, Map]);
246+
?rewrite(?list, duplicate, [Elem, N], lists, duplicate, [N, Elem]);
246247
?rewrite(?map, delete, [Map, Key], maps, remove, [Key, Map]);
247248
?rewrite(?map, fetch, [Map, Key], maps, find, [Key, Map]);
248249
?rewrite(?map, 'fetch!', [Map, Key], maps, get, [Key, Map]);

0 commit comments

Comments
 (0)