Skip to content

Commit

Permalink
Remove one more Function$ from printer.
Browse files Browse the repository at this point in the history
  • Loading branch information
cristianoc committed Dec 12, 2024
1 parent 2df3b30 commit a5f002d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions compiler/syntax/src/res_parens.ml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ let rhs_binary_expr_operand parent_operator rhs =
| _ -> false

let flatten_operand_rhs parent_operator rhs =
let rhs = Ast_uncurried.remove_fun rhs in
match rhs.Parsetree.pexp_desc with
| Parsetree.Pexp_apply
( {
Expand All @@ -179,10 +180,8 @@ let flatten_operand_rhs parent_operator rhs =
let prec_parent = ParsetreeViewer.operator_precedence parent_operator in
let prec_child = ParsetreeViewer.operator_precedence operator in
prec_parent >= prec_child || rhs.pexp_attributes <> []
| Pexp_construct ({txt = Lident "Function$"}, Some _) -> true
| Pexp_constraint ({pexp_desc = Pexp_pack _}, {ptyp_desc = Ptyp_package _}) ->
false
| Pexp_fun _ when ParsetreeViewer.is_underscore_apply_sugar rhs -> false
| Pexp_fun _ | Pexp_newtype _ | Pexp_setfield _ | Pexp_constraint _ -> true
| _ when ParsetreeViewer.is_ternary_expr rhs -> true
| _ -> false
Expand Down

0 comments on commit a5f002d

Please sign in to comment.