this repo has no description
1
fork

Configure Feed

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

feat(odoc): render mode annotations and jkind on type expressions

- Var with jkind: renders ('a : float64) with parentheses and colon
- Arrow with modes: renders src @ local unique -> dst after the arg type
- RawOptional arrows left unchanged (error display)

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

+22 -6
+22 -6
src/document/generator.ml
··· 441 441 if needs_parentheses then enclose ~l:"(" res ~r:")" else res 442 442 in 443 443 match t with 444 - | Var (s, _jkind) -> type_var (Syntax.Type.var_prefix ^ s) 444 + | Var (s, None) -> type_var (Syntax.Type.var_prefix ^ s) 445 + | Var (s, Some jkind) -> 446 + enclose ~l:"(" ~r:")" 447 + (type_var (Syntax.Type.var_prefix ^ s) 448 + ++ O.txt " " ++ O.keyword ":" ++ O.txt " " ++ O.txt jkind) 445 449 | Any -> type_var Syntax.Type.any 446 450 | Alias (te, alias) -> 447 451 enclose_parens_if_needed 448 452 (type_expr ~needs_parentheses:true te 449 453 ++ O.txt " " ++ O.keyword "as" ++ O.txt " '" ++ O.txt alias) 450 - | Arrow (None, src, dst, _modes) -> 454 + | Arrow (None, src, dst, modes) -> 455 + let mode_suffix = match modes with 456 + | [] -> O.noop 457 + | ms -> 458 + O.txt " " ++ O.keyword "@" ++ O.txt " " 459 + ++ O.txt (String.concat ~sep:" " ms) 460 + in 451 461 let res = 452 462 O.span 453 - ((O.box_hv @@ type_expr ~needs_parentheses:true src) 463 + ((O.box_hv @@ type_expr ~needs_parentheses:true src ++ mode_suffix) 454 464 ++ O.txt " " ++ Syntax.Type.arrow) 455 465 ++ O.sp ++ type_expr dst 456 - (* ++ O.end_hv *) 457 466 in 458 467 if not needs_parentheses then res else enclose ~l:"(" res ~r:")" 459 468 | Arrow (Some (RawOptional _ as lbl), _src, dst, _modes) -> ··· 466 475 ++ O.sp ++ type_expr dst 467 476 in 468 477 if not needs_parentheses then res else enclose ~l:"(" res ~r:")" 469 - | Arrow (Some lbl, src, dst, _modes) -> 478 + | Arrow (Some lbl, src, dst, modes) -> 479 + let mode_suffix = match modes with 480 + | [] -> O.noop 481 + | ms -> 482 + O.txt " " ++ O.keyword "@" ++ O.txt " " 483 + ++ O.txt (String.concat ~sep:" " ms) 484 + in 470 485 let res = 471 486 O.span 472 487 ((O.box_hv 473 488 @@ label lbl ++ O.txt ":" ++ O.cut 474 - ++ (O.box_hv @@ type_expr ~needs_parentheses:true src)) 489 + ++ (O.box_hv @@ type_expr ~needs_parentheses:true src) 490 + ++ mode_suffix) 475 491 ++ O.txt " " ++ Syntax.Type.arrow) 476 492 ++ O.sp ++ type_expr dst 477 493 in