From 3ba916530a14779fa7f4a72d5a5d61ed3af35d25 Mon Sep 17 00:00:00 2001 From: Radu Grigore Date: Mon, 5 Jul 2021 11:38:44 -0700 Subject: [PATCH] [erl-frontend] Adjust translation of expression Case Summary: There should be no change in semantics: - before: the "crash node" modelling throwing an exception was connected directly to the exit of the procedure - now: the "crash node" goes to exit_failure, which should end up being connected to the exit of the procedure by the `translate_one_function` The latter is closer to what we'd need to do when we eventually model throwing and catching exceptions (rather than just reporting an error the moment we see them thrown). Differential Revision: D29540834 fbshipit-source-id: c4de4c391 --- infer/src/erlang/ErlangTranslator.ml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/infer/src/erlang/ErlangTranslator.ml b/infer/src/erlang/ErlangTranslator.ml index 30b246f95..563f6fe44 100644 --- a/infer/src/erlang/ErlangTranslator.ml +++ b/infer/src/erlang/ErlangTranslator.ml @@ -393,10 +393,9 @@ let rec translate_expression env {Ast.line; simple_expression} = let expr_block = translate_expression {env with result= Present (Exp.Var id)} expression in let blocks = Block.any env (List.map ~f:(translate_case_clause env [id]) cases) in let crash_node = Node.make_pattern_fail env in - let {Block.start; exit_success; exit_failure} = Block.all env [expr_block; blocks] in blocks.exit_failure |~~> [crash_node] ; - crash_node |~~> [Procdesc.get_exit_node procdesc] ; - {start; exit_success; exit_failure} + let blocks = {blocks with exit_failure= crash_node} in + Block.all env [expr_block; blocks] | Cons {head; tail} -> let head_var = Ident.create_fresh Ident.knormal in let tail_var = Ident.create_fresh Ident.knormal in