ŹR
Size: a a a
ŹR
ŹR
Е
Е
Е
Е
{a, b, c} = foo()
{a, b, c, _} = foo()
D
Е
Е
D
defmodule Foo do
@spec inc(a :: integer()) :: integer()
def inc(nil), do: nil
def inc(a), do: {a + 1, a + 2}
end
e @spec for the function does not match the success typing of the function.то есть не надо писать вариант с ... | nil оно итак предполагает nil
Function:
Foo.inc/1
Success typing:
@spec inc(nil | number()) :: nil | {number(), number()}
ŹR
defmodule Foo do
@spec inc(a :: integer()) :: integer()
def inc(nil), do: nil
def inc(a), do: {a + 1, a + 2}
end
e @spec for the function does not match the success typing of the function.то есть не надо писать вариант с ... | nil оно итак предполагает nil
Function:
Foo.inc/1
Success typing:
@spec inc(nil | number()) :: nil | {number(), number()}
Е
defmodule Foo do
@spec inc(a :: integer()) :: integer()
def inc(nil), do: nil
def inc(a), do: {a + 1, a + 2}
end
e @spec for the function does not match the success typing of the function.то есть не надо писать вариант с ... | nil оно итак предполагает nil
Function:
Foo.inc/1
Success typing:
@spec inc(nil | number()) :: nil | {number(), number()}
defmodule Foo do
@spec inc(a :: integer() | :error) :: integer() | :error
def inc(:error), do: :error
def inc(a), do: {a + 1, a + 2}
end
Е
D
defmodule Foo do
@spec inc(a :: integer() | :error) :: integer() | :error
def inc(:error), do: :error
def inc(a), do: {a + 1, a + 2}
end
D
D
D
elixir -v
Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.10.4 (compiled with Erlang/OTP 23)
Е
defmodule Foo do
@spec inc(a :: integer() | :error) :: integer() | :error
def inc(:error), do: :error
def inc(a), do: {a + 1, a + 2}
end
Е
elixir -v
Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.10.4 (compiled with Erlang/OTP 23)
D