fsprojects / fantomas

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

Fantomas corrupts an explicit constructor with `then` clause #3074

Closed xperiandri closed 2 months ago

xperiandri commented 2 months ago

Issue created from fantomas-online

image

Code

type CreateBuildingViewModel =
    inherit ResizeArray

    new (items) as vm
        =
        let p = ""
        {
            inherit ResizeArray(seq {
                yield p
                yield! items
            })
        }
        then
            vm.program <- p

    [<DefaultValue>]
    val mutable program : string

Result

type CreateBuildingViewModel =
    inherit ResizeArray

    new(items) as vm =
        let p = ""

        { inherit
            ResizeArray(
                seq {
                    yield p
                    yield! items
                }
            ) }

        vm.program <- p

    [<DefaultValue>]
    val mutable program: string

Problem description

then keyword is removed which corrupts code logic and results in compile time error

Extra information

Options

Fantomas 6.3.0

nojaf commented 2 months ago

Hi, thank for the report. Your .editorconfig is irrelevant to this problem, so please don't bring it up as it only adds to the cognitive load.

xperiandri commented 2 months ago

Removed. Thanks!