From d97f353bc10b12095475d390fbaf7f2662daecd7 Mon Sep 17 00:00:00 2001 From: Marko Mindek Date: Sat, 14 Sep 2024 01:05:19 +0200 Subject: [PATCH] erl_syntax_lib annotate else_expr correctly --- lib/syntax_tools/src/erl_syntax_lib.erl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/syntax_tools/src/erl_syntax_lib.erl b/lib/syntax_tools/src/erl_syntax_lib.erl index 41c9e89126de..035f189f1c8b 100644 --- a/lib/syntax_tools/src/erl_syntax_lib.erl +++ b/lib/syntax_tools/src/erl_syntax_lib.erl @@ -474,6 +474,8 @@ vann(Tree, Env) -> vann_maybe_match_expr(Tree, Env); case_expr -> vann_case_expr(Tree, Env); + else_expr -> + vann_else_expr(Tree, Env); if_expr -> vann_if_expr(Tree, Env); receive_expr -> @@ -578,6 +580,12 @@ vann_case_expr(Tree, Env) -> Tree1 = rewrite(Tree, erl_syntax:case_expr(E1, Cs1)), {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}. +vann_else_expr(Tree, Env) -> + Cs = erl_syntax:else_expr_clauses(Tree), + {Cs1, {Bound, Free}} = vann_clauses(Cs, Env), + Tree1 = rewrite(Tree, erl_syntax:else_expr(Cs1)), + {ann_bindings(Tree1, Env, Bound, Free), Bound, Free}. + vann_if_expr(Tree, Env) -> Cs = erl_syntax:if_expr_clauses(Tree), {Cs1, {Bound, Free}} = vann_clauses(Cs, Env),