@@ -1716,7 +1716,7 @@ and print_spread_dict_expr ~state parts (expr : Parsetree.expression) cmt_tbl =
17161716 in
17171717 let spread_doc =
17181718 let doc = print_expression ~state spread_expr cmt_tbl in
1719- match Parens. expr ~allow_coercion: true spread_expr with
1719+ match Parens. expr_allowing_coercion spread_expr with
17201720 | Parens. Parenthesized -> add_parens doc
17211721 | Braced braces -> print_braces doc spread_expr braces
17221722 | Nothing -> doc
@@ -3044,7 +3044,7 @@ and print_expression_with_comments_and_parens ~state expr cmt_tbl =
30443044and print_expression_args ~state (args : Parsetree.expression list ) cmt_tbl =
30453045 let print_arg expr =
30463046 let doc = print_expression_with_comments ~state expr cmt_tbl in
3047- match Parens. expr ~allow_coercion: true expr with
3047+ match Parens. expr_allowing_coercion expr with
30483048 | Parens. Parenthesized -> add_parens doc
30493049 | Braced braces -> print_braces doc expr braces
30503050 | Nothing -> doc
@@ -3270,7 +3270,7 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
32703270 Doc. line;
32713271 Doc. dotdotdot;
32723272 (let doc = print_expression_with_comments ~state expr cmt_tbl in
3273- match Parens. expr ~allow_coercion: true expr with
3273+ match Parens. expr_allowing_coercion expr with
32743274 | Parens. Parenthesized -> add_parens doc
32753275 | Braced braces -> print_braces doc expr braces
32763276 | Nothing -> doc);
@@ -3292,7 +3292,7 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
32923292 let doc =
32933293 print_expression_with_comments ~state expr cmt_tbl
32943294 in
3295- match Parens. expr ~allow_coercion: true expr with
3295+ match Parens. expr_allowing_coercion expr with
32963296 | Parens. Parenthesized -> add_parens doc
32973297 | Braced braces -> print_braces doc expr braces
32983298 | Nothing -> doc)
@@ -3324,7 +3324,7 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
33243324 let doc =
33253325 print_expression_with_comments ~state expr cmt_tbl
33263326 in
3327- match Parens. expr ~allow_coercion: true expr with
3327+ match Parens. expr_allowing_coercion expr with
33283328 | Parens. Parenthesized -> add_parens doc
33293329 | Braced braces -> print_braces doc expr braces
33303330 | Nothing -> doc)
@@ -3353,7 +3353,7 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
33533353 let doc =
33543354 print_expression_with_comments ~state expr cmt_tbl
33553355 in
3356- match Parens. expr ~allow_coercion: true expr with
3356+ match Parens. expr_allowing_coercion expr with
33573357 | Parens. Parenthesized -> add_parens doc
33583358 | Braced braces -> print_braces doc expr braces
33593359 | Nothing -> doc)
@@ -3387,7 +3387,7 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
33873387 Doc. concat
33883388 [
33893389 Doc. dotdotdot;
3390- (match Parens. expr ~allow_coercion: true expr with
3390+ (match Parens. expr_allowing_coercion expr with
33913391 | Parens. Parenthesized -> add_parens doc
33923392 | Braced braces -> print_braces doc expr braces
33933393 | Nothing -> doc);
@@ -3737,14 +3737,10 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
37373737 print_cases ~state cases cmt_tbl;
37383738 ]
37393739 | Pexp_coerce (expr , () , typ ) ->
3740- let doc_expr = print_expression_with_comments ~state expr cmt_tbl in
3741- let doc_typ = print_typ_expr ~state typ cmt_tbl in
37423740 let doc_expr =
3743- match Parens. expr expr with
3744- | Parens. Parenthesized -> add_parens doc_expr
3745- | Braced braces -> print_braces doc_expr expr braces
3746- | Nothing -> doc_expr
3741+ print_expression_with_comments_and_parens ~state expr cmt_tbl
37473742 in
3743+ let doc_typ = print_typ_expr ~state typ cmt_tbl in
37483744 let doc = Doc. concat [doc_expr; Doc. text " :> " ; doc_typ] in
37493745 (* Keep attributes on the coercion rather than its operand. *)
37503746 if Parsetree_viewer. has_printable_attributes e.pexp_attributes then
@@ -4250,7 +4246,7 @@ and print_array_spread_apply ~state sub_lists cmt_tbl =
42504246 (* Print expression without leading comments (they're already extracted) *)
42514247 let expr_doc =
42524248 let doc = print_expression ~state expr cmt_tbl in
4253- match Parens. expr ~allow_coercion: true expr with
4249+ match Parens. expr_allowing_coercion expr with
42544250 | Parens. Parenthesized -> add_parens doc
42554251 | Braced braces -> print_braces doc expr braces
42564252 | Nothing -> doc
@@ -4282,7 +4278,7 @@ and print_array_spread_apply ~state sub_lists cmt_tbl =
42824278 (List. map
42834279 (fun expr ->
42844280 let doc = print_expression_with_comments ~state expr cmt_tbl in
4285- match Parens. expr ~allow_coercion: true expr with
4281+ match Parens. expr_allowing_coercion expr with
42864282 | Parens. Parenthesized -> add_parens doc
42874283 | Braced braces -> print_braces doc expr braces
42884284 | Nothing -> doc)
@@ -4317,7 +4313,7 @@ and print_list_spread_apply ~state sub_lists cmt_tbl =
43174313 comma_before_spread;
43184314 Doc. dotdotdot;
43194315 (let doc = print_expression_with_comments ~state expr cmt_tbl in
4320- match Parens. expr ~allow_coercion: true expr with
4316+ match Parens. expr_allowing_coercion expr with
43214317 | Parens. Parenthesized -> add_parens doc
43224318 | Braced braces -> print_braces doc expr braces
43234319 | Nothing -> doc);
@@ -4338,7 +4334,7 @@ and print_list_spread_apply ~state sub_lists cmt_tbl =
43384334 (List. map
43394335 (fun expr ->
43404336 let doc = print_expression_with_comments ~state expr cmt_tbl in
4341- match Parens. expr ~allow_coercion: true expr with
4337+ match Parens. expr_allowing_coercion expr with
43424338 | Parens. Parenthesized -> add_parens doc
43434339 | Braced braces -> print_braces doc expr braces
43444340 | Nothing -> doc)
@@ -4438,7 +4434,7 @@ and print_pexp_apply ~state expr cmt_tbl =
44384434 let member =
44394435 let member_doc =
44404436 let doc = print_expression_with_comments ~state member_expr cmt_tbl in
4441- match Parens. expr ~allow_coercion: true member_expr with
4437+ match Parens. expr_allowing_coercion member_expr with
44424438 | Parens. Parenthesized -> add_parens doc
44434439 | Braced braces -> print_braces doc member_expr braces
44444440 | Nothing -> doc
@@ -4485,7 +4481,7 @@ and print_pexp_apply ~state expr cmt_tbl =
44854481 let member =
44864482 let member_doc =
44874483 let doc = print_expression_with_comments ~state member_expr cmt_tbl in
4488- match Parens. expr ~allow_coercion: true member_expr with
4484+ match Parens. expr_allowing_coercion member_expr with
44894485 | Parens. Parenthesized -> add_parens doc
44904486 | Braced braces -> print_braces doc member_expr braces
44914487 | Nothing -> doc
@@ -5138,7 +5134,7 @@ and print_arguments ~state ~partial
51385134 | [(Nolabel , arg)] when Parsetree_viewer. is_huggable_expression arg ->
51395135 let arg_doc =
51405136 let doc = print_expression_with_comments ~state arg cmt_tbl in
5141- match Parens. expr ~allow_coercion: true arg with
5137+ match Parens. expr_allowing_coercion arg with
51425138 | Parens. Parenthesized -> add_parens doc
51435139 | Braced braces -> print_braces doc arg braces
51445140 | Nothing -> doc
@@ -5252,7 +5248,7 @@ and print_argument ~state (arg_lbl, arg) cmt_tbl =
52525248 in
52535249 let printed_expr =
52545250 let doc = print_expression_with_comments ~state expr cmt_tbl in
5255- match Parens. expr ~allow_coercion: true expr with
5251+ match Parens. expr_allowing_coercion expr with
52565252 | Parenthesized -> add_parens doc
52575253 | Braced braces -> print_braces doc expr braces
52585254 | Nothing -> doc
0 commit comments