summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSon Ho2022-02-03 21:28:17 +0100
committerSon Ho2022-02-03 21:28:17 +0100
commit1b9e19381744d94c722adcd73186432fccbcb216 (patch)
treeb87b7e086fc791766ac3aa864e6563a564c05091 /src
parent1aa2d3e0584d9f360e085f6d81ecf5a3e741ad94 (diff)
Improve the extraction of `if ... then ... else ...`
Diffstat (limited to 'src')
-rw-r--r--src/ExtractToFStar.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ExtractToFStar.ml b/src/ExtractToFStar.ml
index 60bc472d..3a5d2c7a 100644
--- a/src/ExtractToFStar.ml
+++ b/src/ExtractToFStar.ml
@@ -773,16 +773,20 @@ let rec extract_texpression (ctx : extraction_ctx) (fmt : F.formatter)
(* Extract the branches *)
let extract_branch (is_then : bool) (e_branch : texpression) : unit =
F.pp_print_space fmt ();
- (* Open a box for the branch *)
+ (* Open a box for the then/else+branch *)
F.pp_open_hovbox fmt ctx.indent_incr;
let then_or_else = if is_then then "then" else "else" in
F.pp_print_string fmt then_or_else;
F.pp_print_space fmt ();
+ (* Open a box for the branch *)
+ F.pp_open_hvbox fmt 0;
let parenth = PureUtils.expression_requires_parentheses e_branch in
if parenth then F.pp_print_string fmt "(";
extract_texpression ctx fmt false e_branch;
if parenth then F.pp_print_string fmt ")";
(* Close the box for the branch *)
+ F.pp_close_box fmt ();
+ (* Close the box for the then/else+branch *)
F.pp_close_box fmt ()
in
extract_branch true e_then;