Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lib/elixir/lib/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ defmodule Application do
of all loaded applications. Returns `nil` if
the module is not listed in any application spec.
"""
@spec get_application(atom) :: atom | nil
@spec get_application(module) :: app | nil
def get_application(module) when is_atom(module) do
case :application.get_application(module) do
{:ok, app} -> app
Expand Down Expand Up @@ -814,7 +814,7 @@ defmodule Application do
stick after the application is loaded and also on application reload.
"""
@spec put_env(app, key, value, timeout: timeout, persistent: boolean) :: :ok
def put_env(app, key, value, opts \\ []) when is_atom(app) do
def put_env(app, key, value, opts \\ []) when is_atom(app) and is_list(opts) do
maybe_warn_on_app_env_key(app, key)
:application.set_env(app, key, value, opts)
end
Expand Down Expand Up @@ -856,7 +856,7 @@ defmodule Application do
It receives the same options as `put_env/4`. Returns `:ok`.
"""
@spec delete_env(app, key, timeout: timeout, persistent: boolean) :: :ok
def delete_env(app, key, opts \\ []) when is_atom(app) do
def delete_env(app, key, opts \\ []) when is_atom(app) and is_list(opts) do
maybe_warn_on_app_env_key(app, key)
:application.unset_env(app, key, opts)
end
Expand Down Expand Up @@ -921,11 +921,11 @@ defmodule Application do
{:ok, [app]} | {:error, term}
def ensure_all_started(app_or_apps, type_or_opts \\ [])

def ensure_all_started(app, type) when is_atom(type) do
ensure_all_started(app, type: type)
def ensure_all_started(app_or_apps, type) when is_atom(type) do
ensure_all_started(app_or_apps, type: type)
end

def ensure_all_started(app, opts) when is_atom(app) do
def ensure_all_started(app, opts) when is_atom(app) and is_list(opts) do
ensure_all_started([app], opts)
end

Expand Down Expand Up @@ -1056,7 +1056,8 @@ defmodule Application do
Returns a list with information about the applications which are currently running.
"""
@spec started_applications(timeout) :: [{app, description :: charlist(), vsn :: charlist()}]
def started_applications(timeout \\ 5000) do
def started_applications(timeout \\ 5000)
when timeout == :infinity or (is_integer(timeout) and timeout >= 0) do
:application.which_applications(timeout)
end

Expand Down