fsprojects / fantomas

FSharp source code formatter
https://fsprojects.github.io/fantomas
Other
772 stars 194 forks source link

Compiled operators names are replaced with source names #409

Closed auduchinok closed 5 years ago

auduchinok commented 5 years ago

Sometimes using compiled name is preferred as source name produces a warning in this particular case. The problem is FCS replaces all source names with compiled names in AST idents and we don't know whether compiled or source name was used in the actual code.

Issue created from fantomas-ui.

Code

type T() =
    static member op_LessThan(a, b) = a < b

Result

type T() =
    static member (<) (a, b) = a < b

Options

Fantomas 2.9.1

Name Value
IndentSpaceNum 4
PageWidth 80
PreserveEndOfLine true
SemicolonAtEndOfLine false
SpaceBeforeArgument true
SpaceBeforeColon true
SpaceAfterComma true
SpaceAfterSemicolon true
IndentOnTryWith false
ReorderOpenDeclaration false
SpaceAroundDelimiter true
StrictMode false
nojaf commented 5 years ago

Hi, I have a fix for this in https://github.com/fsprojects/fantomas/pull/434/commits/112452e20b0f53b098594054f9ab7be7589f2215. However, I'm not 100% sure I covered all the possible cases here. Let me know if you find scenarios where it is still a problem.