diff options
author | José Valim <jose.valim@dashbit.co> | 2021-12-30 23:42:25 +0100 |
---|---|---|
committer | José Valim <jose.valim@dashbit.co> | 2021-12-30 23:42:25 +0100 |
commit | 6d803edf73cb5cfb0fef333949055c96c6769093 (patch) | |
tree | 32a11e62cde1a03a1d762982c1621551a63cf02a | |
parent | 43aa30d26395fa35db295843c640947d5bf82ea3 (diff) | |
download | elixir-6d803edf73cb5cfb0fef333949055c96c6769093.tar.gz |
Access callbacks always receive structs
-rw-r--r-- | lib/elixir/lib/access.ex | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/elixir/lib/access.ex b/lib/elixir/lib/access.ex index 4bc8e067d..7dfe056ff 100644 --- a/lib/elixir/lib/access.ex +++ b/lib/elixir/lib/access.ex @@ -94,8 +94,7 @@ defmodule Access do @type container :: keyword | struct | map @type nil_container :: nil - @type any_container :: any - @type t :: container | nil_container | any_container + @type t :: container | nil_container | any @type key :: any @type value :: any @@ -153,7 +152,7 @@ defmodule Access do """ @callback get_and_update(data, key, (value | nil -> {current_value, new_value :: value} | :pop)) :: {current_value, new_data :: data} - when current_value: value, data: container | any_container + when current_value: value, data: container @doc """ Invoked to "pop" the value under `key` out of the given data structure. @@ -167,7 +166,7 @@ defmodule Access do See the implementations for `Map.pop/3` or `Keyword.pop/3` for more examples. """ - @callback pop(data, key) :: {value, data} when data: container | any_container + @callback pop(data, key) :: {value, data} when data: container defmacrop raise_undefined_behaviour(exception, module, top) do quote do |