diff --git a/lib/elixir/lib/regex.ex b/lib/elixir/lib/regex.ex index ddb9fdfe58b..83d88479336 100644 --- a/lib/elixir/lib/regex.ex +++ b/lib/elixir/lib/regex.ex @@ -748,7 +748,7 @@ defmodule Regex do "Abcadc" """ - @spec replace(t, String.t(), String.t() | (... -> String.t()), [{:global, boolean()}]) :: + @spec replace(t, String.t(), String.t() | (... -> String.t()), global: boolean()) :: String.t() def replace(%Regex{} = regex, string, replacement, options \\ []) when is_binary(string) and is_list(options) do diff --git a/lib/elixir/pages/references/typespecs.md b/lib/elixir/pages/references/typespecs.md index a34bb09f55c..95eb40253f2 100644 --- a/lib/elixir/pages/references/typespecs.md +++ b/lib/elixir/pages/references/typespecs.md @@ -200,6 +200,14 @@ def start_link(opts) do end ``` +The following spec syntaxes are equivalent: + +```elixir +@type options [{:name, String.t} | {:max, pos_integer} | {:min, pos_integer}] + +@type options [name: String.t, max: pos_integer, min: pos_integer] +``` + ### User-defined types The `@type`, `@typep`, and `@opaque` module attributes can be used to define new types: