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
Multiline tuple in the middle of a function type gives invalid code #3556
typeT= a -> int * LongTypeNameNumberOneLongTypeNameNumberTwoLongTypeNameNumberThreeLongTypeNameNumberFourLongTypeNameNumberFive -> unit
Result
typeT=
a
-> int *
LongTypeNameNumberOneLongTypeNameNumberTwoLongTypeNameNumberThreeLongTypeNameNumberFourLongTypeNameNumberFive
-> unit
Problem description
Fantomas found this wrong with its result:
The result is not valid F#
Fantomas cannot parse the code it produced. The diagnostics are about that code.
When a tuple is a middle operand of a function type and does not fit on its line, Fantomas breaks it after * and puts the next item in the column of the outer -> lines. The -> unit that follows is then read as part of the tuple and does not parse.
Fails: a tuple as a middle operand, in a type abbreviation or in a parameter annotation (let f (x: a -> int * X -> unit) = ()).
Passes: the tuple as the first operand (int * X -> unit stays on one line), or as the last one (a -> int * X).
A parenthesized function type as the second tuple item, as in string -> int * (A -> B -> C) -> unit, fails the same way.
Fails on 7.0.6, 8.0.10, main, and the 9.0.0-alpha-001 preview.
I or my company would be willing to help fix this.
I would like a release if this problem is solved.
Options
Fantomas main branch at 2026-10-20T12:59:18Z - 79babfa
Default Fantomas configuration
Did you know that you can ignore files when formatting by using a .fantomasignore file? PS: It's unlikely that someone else will solve your specific issue, as it's something that you have a personal stake in.
Activity
Indent a multiline tuple after the arrow of a function type