Skip to content

Commit bb902bc

Browse files
authored
Change DynamicSupervisor doc to avoid confusions (#13678)
1 parent c08a9b3 commit bb902bc

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/elixir/lib/dynamic_supervisor.ex

+11-6
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,7 @@ defmodule DynamicSupervisor do
215215
extra_arguments: [term()]
216216
}
217217

218-
@typedoc "Options given to `start_link` functions"
219-
@type option :: GenServer.option()
220-
221-
@typedoc "Options given to `start_link` and `init/1` functions"
218+
@typedoc "Options given to `start_link/1` and `init/1` functions"
222219
@type init_option ::
223220
{:strategy, strategy()}
224221
| {:max_restarts, non_neg_integer()}
@@ -345,9 +342,11 @@ defmodule DynamicSupervisor do
345342
specified in the child spec given to `start_child/2`. Defaults to
346343
an empty list.
347344
345+
* Any of the standard [GenServer options](`t:GenServer.option/0`)
346+
348347
"""
349348
@doc since: "1.6.0"
350-
@spec start_link([option | init_option]) :: Supervisor.on_start()
349+
@spec start_link([init_option | GenServer.option()]) :: Supervisor.on_start()
351350
def start_link(options) when is_list(options) do
352351
keys = [:extra_arguments, :max_children, :max_seconds, :max_restarts, :strategy]
353352
{sup_opts, start_opts} = Keyword.split(options, keys)
@@ -381,9 +380,15 @@ defmodule DynamicSupervisor do
381380
Note that a supervisor started with this function is linked to the parent
382381
process and exits not only on crashes but also if the parent process exits
383382
with `:normal` reason.
383+
384+
## Options
385+
386+
This function accepts any regular [`GenServer` options](`t:GenServer.option/0`).
387+
Options specific to `DynamicSupervisor` must be returned from the `c:init/1`
388+
callback.
384389
"""
385390
@doc since: "1.6.0"
386-
@spec start_link(module, term, [option]) :: Supervisor.on_start()
391+
@spec start_link(module, term, [GenServer.option()]) :: Supervisor.on_start()
387392
def start_link(module, init_arg, opts \\ []) do
388393
GenServer.start_link(__MODULE__, {module, init_arg, opts[:name]}, opts)
389394
end

0 commit comments

Comments
 (0)