From 8edc730edc77dbb215ba930fc99b9804e7be7ad0 Mon Sep 17 00:00:00 2001 From: Qqwy/Wiebe-Marten Wijnja Date: Mon, 27 May 2019 14:28:13 +0200 Subject: [PATCH 1/2] Fixes #9081 by improving documentation of GenServer.server() type. --- lib/elixir/lib/gen_server.ex | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/elixir/lib/gen_server.ex b/lib/elixir/lib/gen_server.ex index 5ac5130cad6..7aaa5292a69 100644 --- a/lib/elixir/lib/gen_server.ex +++ b/lib/elixir/lib/gen_server.ex @@ -717,8 +717,13 @@ defmodule GenServer do @typedoc "Debug options supported by the `start*` functions" @type debug :: [:trace | :log | :statistics | {:log_to_file, Path.t()}] - @typedoc "The server reference" - @type server :: pid | name | {atom, node} + @typedoc """ + The server reference. + + This is either a plain PID or a value representing a registered name. + See the 'Name registration' section of this document for more information. + """ + @type server :: pid | name | {atom, node} | {:via, registry :: atom(), key :: term()} @typedoc """ Tuple describing the client of a call request. @@ -1022,6 +1027,9 @@ defmodule GenServer do not yet connected to the caller one, the semantics differ depending on the used Erlang/OTP version. + `server` can be any of the values described in the "Name registration" + section of the documentation for this module. + Before Erlang/OTP 21, the call is going to block until a connection happens. This was done to guarantee ordering. Starting with Erlang/OTP 21, both Erlang and Elixir do From 1da1407bab87b7f270dd6bbb492901e3c454ca70 Mon Sep 17 00:00:00 2001 From: Fernando Tapia Rico Date: Mon, 27 May 2019 15:54:39 +0200 Subject: [PATCH 2/2] Update gen_server.ex --- lib/elixir/lib/gen_server.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/elixir/lib/gen_server.ex b/lib/elixir/lib/gen_server.ex index 7aaa5292a69..21316850b8b 100644 --- a/lib/elixir/lib/gen_server.ex +++ b/lib/elixir/lib/gen_server.ex @@ -721,9 +721,9 @@ defmodule GenServer do The server reference. This is either a plain PID or a value representing a registered name. - See the 'Name registration' section of this document for more information. + See the "Name registration" section of this document for more information. """ - @type server :: pid | name | {atom, node} | {:via, registry :: atom(), key :: term()} + @type server :: pid | name | {atom, node} | {:via, registry :: module(), key :: term()} @typedoc """ Tuple describing the client of a call request.