Skip to content

Commit 629bea9

Browse files
fix crash with inline record type variable
1 parent 354bd47 commit 629bea9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Fmt_ast.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3649,6 +3649,9 @@ and fmt_constructor_arguments ?vars c ctx ~pre = function
36493649
in
36503650
pre $ vars $ typs
36513651
| Pcstr_record (loc, lds) ->
3652+
let vars =
3653+
match vars with Some vars -> space_break $ vars | None -> noop
3654+
in
36523655
let p = Params.get_record_type c.conf in
36533656
let fmt_ld ~first ~last x =
36543657
fmt_if (not first) p.sep_before
@@ -3658,7 +3661,7 @@ and fmt_constructor_arguments ?vars c ctx ~pre = function
36583661
(str " ")
36593662
$ fmt_if (not last) p.sep_after
36603663
in
3661-
pre
3664+
pre $ vars
36623665
$ Cmts.fmt c loc ~pro:(break 1 0) ~epi:noop
36633666
@@ wrap p.docked_before p.docked_after
36643667
@@ wrap p.break_before p.break_after

test/passing/tests/record.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,4 @@ let x = A(B).a
8989

9090
let x = (1).a
9191

92+
type 'a t = A : 'b. {a: 'a} -> 'a t

0 commit comments

Comments
 (0)