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
typeT()=member_.Xwith get ()=1// getandset(_:int)=()
Result
typeT()=member_.Xwith get ()=1andset(_:int)=()
Problem description
A comment after the body of a property accessor is removed. The output is valid F#, but the comment is gone.
It needs only the default settings. The same happens:
after the setter (and set (_: int) = () // set),
with a block comment ((* get *)) instead of a line comment,
with a setter alone (member _.X with set (_: int) = () // set).
The comment is kept:
with a getter alone, which becomes member _.X = 1 // get,
when the comment is on its own line above with.
It is not a regression: 8.0.7, 7.0.6, 6.3.16 and 5.2.4 drop the comment too, and so does main.
Trivia assignment puts the comment after the PropertyGetSetBindingNode of the accessor, but genProperty in the MemberDefn.PropertyGetSet case of CodePrinter.fs prints that node without genNode, so its trivia is never written. #1009 was about comments on members with get/set too.
Found while testing the comment search of #1353, which refuses this output.
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 after a property accessor
Bump the packages group with 10 updates (#280)