Skip to content

Commit

Permalink
Do not print units in lhs of sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kM committed Aug 20, 2024
1 parent cb67d9e commit a33f48d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/PrintMiniRust.ml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ and print_expression_with_block env (e: expr): document =

and print_statements env (e: expr): document =
match e with
| Let ({ typ = Unit; _ }, Unit, e2) ->
(* Special-case: if we have a unit (probably due to an erased node), we omit it *)
print_statements (push env (`GoneUnit)) e2
| Let ({ typ = Unit; _ }, e1, e2) ->
print_expr env max_int e1 ^^ semi ^^ hardline ^^
print_statements (push env (`GoneUnit)) e2
Expand Down

0 comments on commit a33f48d

Please sign in to comment.