Skip to content

Commit 24369d5

Browse files
author
José Valim
committed
Ensure we can still receive [term()] in start_child spec, closes #7138
1 parent 3d20f04 commit 24369d5

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lib/elixir/lib/supervisor.ex

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ defmodule Supervisor do
592592
## Options
593593
594594
* `:strategy` - the restart strategy option. It can be either
595-
`:one_for_one`, `:rest_for_one`, `:one_for_all`, or
595+
`:one_for_one`, `:rest_for_one`, `:one_for_all`, or the deprecated
596596
`:simple_one_for_one`.
597597
598598
* `:max_restarts` - the maximum number of restarts allowed in
@@ -722,14 +722,6 @@ defmodule Supervisor do
722722
#=> %{id: {Agent, 1},
723723
#=> start: {Agent, :start_link, [fn -> :ok end]}}
724724
725-
It may also be used when there is a need to change the number
726-
of arguments when starting a module under a `:simple_one_for_one`
727-
strategy, since most args may be given dynamically:
728-
729-
Supervisor.child_spec(Agent, start: {Agent, :start_link, []})
730-
#=> %{id: Agent,
731-
#=> start: {Agent, :start_link, []}}
732-
733725
"""
734726
@spec child_spec(child_spec() | {module, arg :: term} | module, keyword) :: child_spec()
735727
def child_spec(module_or_map, overrides)
@@ -821,13 +813,13 @@ defmodule Supervisor do
821813
returns `{:error, error}` where `error` is a term containing information about
822814
the error and child specification.
823815
"""
824-
@spec start_child(supervisor, :supervisor.child_spec() | {module, term} | module) ::
816+
@spec start_child(supervisor, :supervisor.child_spec() | {module, term} | module | [term]) ::
825817
on_start_child
826818
def start_child(supervisor, {_, _, _, _, _, _} = child_spec) do
827819
call(supervisor, {:start_child, child_spec})
828820
end
829821

830-
# TODO: Deprecate this on Elixir v1.8
822+
# TODO: Deprecate this on Elixir v1.8. Remove and update typespec on v2.0.
831823
def start_child(supervisor, args) when is_list(args) do
832824
call(supervisor, {:start_child, args})
833825
end

0 commit comments

Comments
 (0)