assert typecheck!(
[x],
cond do
is_integer(x) or is_boolean(x) -> {:one, x}
true -> {:two, x}
end
) == opt_union(
tuple([atom([:one]), opt_union(integer(), boolean())]),
tuple([atom([:two]), negation(opt_union(integer(), boolean()))])
)
As far as I know, none of them do it today. And it is tricky because is_integer(x) or is_boolean(y) gets a different result. We already have this machinery in guards, but we need to repurpose it.
Originally posted by @josevalim in #15450