diff --git a/lib/elixir/lib/kernel.ex b/lib/elixir/lib/kernel.ex index d5054eb6bcb..b823b909f42 100644 --- a/lib/elixir/lib/kernel.ex +++ b/lib/elixir/lib/kernel.ex @@ -3392,7 +3392,7 @@ defmodule Kernel do Converts the argument to a string according to the `String.Chars` protocol. - This is the function invoked when there is string interpolation. + This is invoked when there is string interpolation. ## Examples diff --git a/lib/elixir/lib/kernel/special_forms.ex b/lib/elixir/lib/kernel/special_forms.ex index ae4e9f0a7d6..e914072b3e9 100644 --- a/lib/elixir/lib/kernel/special_forms.ex +++ b/lib/elixir/lib/kernel/special_forms.ex @@ -1372,6 +1372,18 @@ defmodule Kernel.SpecialForms do ...> end {:sum, [], [1, 2, 3, 4, 5]} + Also can be used in block context, outside of function arguments. + Though, it is still required to be wrapped into parentheses. + + iex> requires = for module <- [Integer, Logger] do + ...> quote do + ...> require unquote(module) + ...> end + ...> end + iex> block = quote do: (unquote_splicing(requires)) + iex> Macro.to_string(block) + "require Integer\\nrequire Logger" + """ defmacro unquote(:unquote_splicing)(expr), do: error!([expr])