Let us consider an expression E = fun () -> A = B = f(C = 1), f(A + B + C) end for example.
By extract_match_expr, expression E is converted to fun () -> C = 1, B = f(1), A = f(1), f(A + B + C) end (= E').
By expr_of_erlang_expr' and expr_of_erlang_exprs, expression E' is converted to:
fun () ->
case 1 of
C -> case f(1) of
B -> case f(1) of
A -> f(A + B + C)
end
end
end
end
Although f(1) is called multiple times, I suspect it is no problem because fialyzer is a type checker, not a compiler/interpreter.
resolves #81
I added support for match expressions.
algorithm
Let us consider an expression E =
fun () -> A = B = f(C = 1), f(A + B + C) end
for example. Byextract_match_expr
, expression E is converted tofun () -> C = 1, B = f(1), A = f(1), f(A + B + C) end
(= E'). Byexpr_of_erlang_expr'
andexpr_of_erlang_exprs
, expression E' is converted to:Although
f(1)
is called multiple times, I suspect it is no problem because fialyzer is a type checker, not a compiler/interpreter.minimum prototype
https://gist.github.com/amutake/0dc3e07a58511fed494a5676904d4eea