Skip to content

Commit

Permalink
Bringing typespecs in line with Elixir.Process.get/2
Browse files Browse the repository at this point in the history
replacing any() with term()
  • Loading branch information
jbsf2 committed Feb 23, 2024
1 parent 6804177 commit 78873fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/process_tree.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule ProcessTree do
Returns the first non-nil value found in the tree. If no value is found, returns `nil`.
"""
@spec get(term()) :: any()
@spec get(term()) :: term()
def get(key) do
case Process.get(key) do
nil ->
Expand Down Expand Up @@ -63,7 +63,7 @@ defmodule ProcessTree do
value = ProcessTree.get(:some_key, default: default_value)
```
"""
@spec get(term(), default: any()) :: any()
@spec get(term(), default: term()) :: term()
def get(key, default: default_value) do
case get(key) do
nil ->
Expand Down Expand Up @@ -200,7 +200,7 @@ defmodule ProcessTree do
defp process_info_parent(_pid), do: nil
end

@spec ancestor_value(any(), id(), [id()]) :: any()
@spec ancestor_value(term(), id(), [id()]) :: term()
defp ancestor_value(key, pid_or_name, dictionary_ancestors) do
cond do
(value = get_dictionary_value(pid_or_name, key)) != nil ->
Expand All @@ -220,7 +220,7 @@ defmodule ProcessTree do
end
end

@spec get_dictionary_value(id(), atom()) :: any()
@spec get_dictionary_value(id(), atom()) :: term()
defp get_dictionary_value(nil, _key), do: nil

defp get_dictionary_value(name, _key) when is_atom(name) do
Expand Down

0 comments on commit 78873fb

Please sign in to comment.