Hello,
I am having trouble understanding Dialyzer here:
Code that works fine:
def foo(_ref, pid) do
a = :random.uniform(1) == 1
b = Process.alive?(pid)
a and b
end
Code that pisses Dialyzer off:
def foo(ref, pid) do
a = Process.demonitor(ref)
b = Process.alive?(pid)
a and b
end
The pattern can never match the type.
Pattern:
false
Type:
true
I think I’ve distilled the problem down to the fact that dialyzer thinks Process.demonitor(ref)
call is always true
, and passing that value to and
is as redundant as saying true && bar()
.
However, why is Process.demonitor(ref)
considered to always return true? The spec clearly states boolean()
type.