this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix toplevel output position for multi-definition phrases

When a cell contains multiple let bindings without ;; separators,
the OCaml toplevel groups them into a single Ptop_def with multiple
structure items. The output_at loc was using the first item's
pstr_loc, placing all val outputs after the first definition.

Now uses the last item's loc so output appears after the final
definition in the group.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+5 -3
+5 -3
lib/impl.cppo.ml
··· 638 638 let phr = !Toploop.parse_toplevel_phrase lb in 639 639 let phr = Toploop.preprocess_phrase Format.err_formatter phr in 640 640 ignore (Toploop.execute_phrase true pp_result phr : bool); 641 - (* Get location from phrase AST *) 641 + (* Get location from phrase AST — use the last 642 + structure item so output appears after all defs *) 642 643 let loc = match phr with 643 - | Parsetree.Ptop_def ({ pstr_loc; _ } :: _) -> 644 - pstr_loc.loc_end.pos_cnum 644 + | Parsetree.Ptop_def (_ :: _ as items) -> 645 + let last = List.nth items (List.length items - 1) in 646 + last.pstr_loc.loc_end.pos_cnum 645 647 | Parsetree.Ptop_dir { pdir_loc; _ } -> 646 648 pdir_loc.loc_end.pos_cnum 647 649 | _ -> lb.lex_curr_p.pos_cnum