Semantic Diff

#9082 Keep the header of a let with locally abstract types on one line

1 commit

09be8ce7a562ad0347ccd63a8973b87df51de80c..pr-9082

3a28be258 · cknitt + Claude · Oct 27, 2026, 12:50 UTC

Keep the header of a let with locally abstract types on one line

Why

A binding annotated with type a. was printed as one group, so a line break in its body, such as a switch, broke the header after : and = as well and indented the body twice. This is how every function over a GADT is written. The header now stays on one line when its first line fits, as for other annotated bindings.

modifiedFormat let with locally abstract types

let rec eval: type a. expr<a> => a = e =>  switch e {  | Int(n) => n  | Bool(b) => b  }
rescript
Before
After
let rec eval: type a. expr<a> => a = e => switch e { | Int(n) => n | Bool(b) => b }let rec eval: type a. expr<a> => a = e => switch e { | Int(n) => n | Bool(b) => b }

Review

  • What happens to a header that doesn't fit? It is printed as before, broken after : and =; the printer fixture keeps such a case, also with attributes in front, which stay outside the layout choice so that the header's width is measured from the let.