Skip to content

Commit 4da9a31

Browse files
committed
WIP
1 parent 657ba7d commit 4da9a31

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/syntax/src/res_printer.ml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3223,7 +3223,14 @@ and print_expression ~state (e : Parsetree.expression) cmt_tbl =
32233223
* b: 2,
32243224
* }` -> record is written on multiple lines, break the group *)
32253225
let force_break =
3226-
e.pexp_loc.loc_start.pos_lnum < e.pexp_loc.loc_end.pos_lnum
3226+
match (spread_expr, rows) with
3227+
| Some expr, _ ->
3228+
(* If there's a spread, compare with spread expression's location *)
3229+
e.pexp_loc.loc_start.pos_lnum < expr.pexp_loc.loc_start.pos_lnum
3230+
| None, first_row :: _ ->
3231+
(* Otherwise, compare with the first row's location *)
3232+
e.pexp_loc.loc_start.pos_lnum < first_row.lid.loc.loc_start.pos_lnum
3233+
| None, [] -> false
32273234
in
32283235
let punning_allowed =
32293236
match (spread_expr, rows) with

0 commit comments

Comments
 (0)