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
Comment before a let in the right-hand side of an infix operator is lost #3522
A comment on its own line before a let (also use, let!) in the right-hand side of an infix operator is removed, when Fantomas adds in to the binding (#1461).
Matters not: the operator (&&, ||, +), line or block comment, first or later binding, top level or inside a let. Default settings.
The comment is kept when there is no binding after the operator (if, match, an application), when it is after the last binding, or when it is on the operator's line (&& // c).
Regression: 6.3.16 and 7.0.6 keep it, 8.0.0-alpha-001 to 8.0.7 drop it. Probable cause: genExprInMultilineInfixExpr (CodePrinter.fs) builds a new BindingNode and ExprCompExprBodyNode to add in, without the trivia of the originals. 7.x printed the original nodes with genNode.
Also, a && let c = b in c without a comment is not idempotent on main.
Found in IsSigExactMatch in the F# compiler's MethodOverrides.fs, which loses 19 comment lines. Maybe related: #1512.
Extra information
The formatted result breaks my code.
The formatted result gives compiler warnings.
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-06T23:08:00Z - 6276e9e
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
Keep a comment before a let after an infix operator
Use samples Fantomas still gets wrong in the validation tests
Use samples Fantomas still gets wrong in the validation tests
Use samples Fantomas still gets wrong in the validation tests
Use samples Fantomas still gets wrong in the validation tests
Bump the packages group with 10 updates (#280)
Use samples Fantomas still gets wrong in the validation tests
Use samples Fantomas still gets wrong in the validation tests
Use samples Fantomas still gets wrong in the validation tests
Use samples Fantomas still gets wrong in the validation tests
Use samples Fantomas still gets wrong in the validation tests