You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9ceeb96
Browse filesBrowse the repository at this point in the historyBrowse files
Keep the header of a let with locally abstract types on one line (#9082)
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.
Format modified (let with locally abstract types):
Example:
let rec eval: type a. expr<a> => a = e =>
switch e {
| Int(n) => n
| Bool(b) => b
}
Before (rescript):
let rec eval:
type a. expr<a> => a =
e =>
switch e {
| Int(n) => n
| Bool(b) => b
}
After (rescript):
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`.
Fixes: #9070
Claude-Session: https://claude.ai/code/session_01Kbf3gLMawVgtmiKy3TMBc3
Claude-Session: https://claude.ai/code/session_01Kr4cjoUi2f5VpMvE6wT9bo
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- The formatter keeps `let f: type a. t => a = x =>` on one line when it fits, instead of breaking after `:` and `=` whenever the body spans several lines.
0 commit comments