Issue created from fantomas-online
Code
module Bug
type Cont = SuccessCont
[<Struct>]
type ContStackFrame =
val Cont: Cont
new cont = { Cont = cont }
Result
module Bug
type Cont = SuccessCont
[<Struct>]
type ContStackFrame =
val Cont: Cont
new newcont = { Cont = cont }
Problem description
Fantomas renames the struct constructor parameter cont to newcont by prepending new to the identifier. The record initialization { Cont = cont } still references the original parameter name, so the formatted code fails to compile with:
error FS0039: The value or constructor 'cont' is not defined.
This is also an idempotency issue. Each subsequent format pass prepends another new:
Pass 1: new cont → new newcont
Pass 2: new newcont → new newnewcont
Pass 3: new newnewcont → new newnewnewcont
This appears to happen when the constructor parameter name matches the field name (differing only in case): val Cont: Cont + new cont = .... Fantomas seems to confuse the parameter with the new keyword and merges them.
Extra information
Options
Default Fantomas configuration
Issue created from fantomas-online
Code
Result
Problem description
Fantomas renames the struct constructor parameter cont to newcont by prepending new to the identifier. The record initialization { Cont = cont } still references the original parameter name, so the formatted code fails to compile with:
error FS0039: The value or constructor 'cont' is not defined.
This is also an idempotency issue. Each subsequent format pass prepends another new:
Pass 1: new cont → new newcont
Pass 2: new newcont → new newnewcont
Pass 3: new newnewcont → new newnewnewcont
This appears to happen when the constructor parameter name matches the field name (differing only in case): val Cont: Cont + new cont = .... Fantomas seems to confuse the parameter with the new keyword and merges them.
Extra information
Options
Default Fantomas configuration