I’m surprised dialyzer doesn’t complain about the following code. Since fun_b
returns either :ok
or :error
I would hope it would point out that all return values aren’t handled by the case
matches.
Am I doing something wrong, or is this just some type of limitation?
def fun_a() do
case fun_b() do
:ok -> :ok
end
end
@spec fun_b :: :ok | :error
def fun_b() do
case :rand.uniform(2) do
1 -> :ok
2 -> :error
end
end