Skip to content

Conditional directives before expression leads to invalid code with Stroustrup #2517

Closed
@sergey-tihon

Description

Issue created from fantomas-online

Code

    let inline skipNoFail count (source: seq<_>) =
#if FABLE_COMPILER
        seq {
          let mutable i = 0
          let e = source.GetEnumerator ()
          while e.MoveNext () do
            if i < count
            then
              i <- i + 1
            else
              yield e.Current
        }
#else
        Enumerable.Skip(source, count)
#endif

Result

let inline skipNoFail count (source: seq<_>) =
#if FABLE_COMPILER
seq {
    let mutable i = 0
    let e = source.GetEnumerator()

    while e.MoveNext() do
        if i < count then i <- i + 1 else yield e.Current
}
#else
    Enumerable.Skip(source, count)
#endif

Problem description

Incorrect indentation inside #if FABLE_COMPILER block.
Check out our Contribution Guidelines.

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.

Options

Fantomas master branch at 2022-09-17T05:39:07Z - c1a99d4

    { config with
                MultilineBlockBracketsOnSameColumn = true
                ExperimentalStroustrupStyle = true }

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions