Skip to content

Commit bfd9a59

Browse files
leandrocpJosé Valim
authored andcommitted
Adjust specs to the standard (#237)
As also defined in GenServer
1 parent 974b82d commit bfd9a59

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/gen_stage.ex

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ defmodule GenStage do
12141214
12151215
This function will return `:ok` if the info message is successfully queued.
12161216
"""
1217-
@spec sync_info(stage, msg :: term(), timeout) :: :ok
1217+
@spec sync_info(stage, msg :: term, timeout) :: :ok
12181218
def sync_info(stage, msg, timeout \\ 5_000) do
12191219
call(stage, {:"$info", msg}, timeout)
12201220
end
@@ -1229,7 +1229,7 @@ defmodule GenStage do
12291229
This call returns `:ok` regardless if the info has been successfully
12301230
queued or not. It is typically called from the stage itself.
12311231
"""
1232-
@spec async_info(stage, msg :: term()) :: :ok
1232+
@spec async_info(stage, msg :: term) :: :ok
12331233
def async_info(stage, msg) do
12341234
cast(stage, {:"$info", msg})
12351235
end
@@ -1321,7 +1321,7 @@ defmodule GenStage do
13211321
13221322
See `sync_subscribe/2` for options and more information.
13231323
"""
1324-
@spec sync_resubscribe(stage, subscription_tag, term, subscription_options, timeout) ::
1324+
@spec sync_resubscribe(stage, subscription_tag, reason :: term, subscription_options, timeout) ::
13251325
{:ok, subscription_tag} | {:error, :not_a_consumer} | {:error, {:bad_opts, String.t()}}
13261326
def sync_resubscribe(stage, subscription_tag, reason, opts, timeout \\ 5000) do
13271327
sync_subscribe(stage, {subscription_tag, reason}, opts, timeout)
@@ -1400,7 +1400,8 @@ defmodule GenStage do
14001400
It accepts the same options as `Process.send/3`, and returns the same value as
14011401
`Process.send/3`.
14021402
"""
1403-
@spec ask(from, non_neg_integer, [:noconnect | :nosuspend]) :: :ok | :noconnect | :nosuspend
1403+
@spec ask(from, demand :: non_neg_integer, [:noconnect | :nosuspend]) ::
1404+
:ok | :noconnect | :nosuspend
14041405
def ask(producer_subscription, demand, opts \\ [])
14051406

14061407
def ask({_pid, _ref}, 0, _opts) do
@@ -1434,7 +1435,7 @@ defmodule GenStage do
14341435
is useful when working across nodes. This function returns
14351436
the same value as `Process.send/3`.
14361437
"""
1437-
@spec cancel(from, term, [:noconnect | :nosuspend]) :: :ok | :noconnect | :nosuspend
1438+
@spec cancel(from, reason :: term, [:noconnect | :nosuspend]) :: :ok | :noconnect | :nosuspend
14381439
def cancel({pid, ref} = _producer_subscription, reason, opts \\ []) do
14391440
Process.send(pid, {:"$gen_producer", {self(), ref}, {:cancel, reason}}, opts)
14401441
end
@@ -1542,7 +1543,7 @@ defmodule GenStage do
15421543
If the reason is any other than `:normal`, `:shutdown` or
15431544
`{:shutdown, _}`, an error report is logged.
15441545
"""
1545-
@spec stop(stage, term, timeout) :: :ok
1546+
@spec stop(stage, reason :: term, timeout) :: :ok
15461547
def stop(stage, reason \\ :normal, timeout \\ :infinity) do
15471548
:gen.stop(stage, reason, timeout)
15481549
end
@@ -1601,7 +1602,7 @@ defmodule GenStage do
16011602
All other options that would be given for `start_link/3` are
16021603
also accepted.
16031604
"""
1604-
@spec from_enumerable(Enumerable.t(), keyword()) :: GenServer.on_start()
1605+
@spec from_enumerable(Enumerable.t(), keyword) :: GenServer.on_start()
16051606
def from_enumerable(stream, opts \\ []) do
16061607
case Keyword.pop(opts, :link, true) do
16071608
{true, opts} -> start_link(GenStage.Streamer, {stream, opts}, opts)

0 commit comments

Comments
 (0)