this repo has no description
0
fork

Configure Feed

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

odoc loader: suppress return modes on inner arrow types

When the return type of an arrow is itself a Tarrow, the return mode
is implied by the argument mode (a closure capturing a local value is
necessarily local). Eliding it matches Printtyp's behaviour.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+8 -1
+8 -1
odoc/src/loader/cmi.cppo.ml
··· 621 621 else Var (nm, None) 622 622 | Tarrow((lbl, marg, mret), arg, res, _) -> 623 623 let arg_modes = extract_arg_modes marg in 624 - let ret_modes = extract_arg_modes mret in 624 + (* Suppress return modes when the return type is itself a function. 625 + A closure capturing a local argument is necessarily local, so 626 + the return mode is always implied. Showing it is redundant. 627 + This matches the elision logic in Printtyp.tree_of_modes. *) 628 + let ret_modes = match Compat.get_desc res with 629 + | Tarrow _ -> [] 630 + | _ -> extract_arg_modes mret 631 + in 625 632 #else 626 633 | Tvar _ -> 627 634 let name = name_of_type typ in