FSharpLint icon indicating copy to clipboard operation
FSharpLint copied to clipboard

TupleCommaSpacing false positive

Open Leaxe opened this issue 3 years ago • 1 comments

Description

TupleCommaSpacing rule triggers when the tuple comma spacing is correct in named optional parameter assignments.

Repro steps

type TestClass(arg1 : int, ?arg2 : int) =
    class end

let x = TestClass(1, ?arg2 = Some(2))

Expected behavior

No lint error.

Actual behavior

Comma in tuple instantiation should be followed by single space.
Error on line 45 starting at column 19
let x = TestClass(1, ?arg = Some(2))

Known workarounds

Removing the space in the tuple removes the error:

///...
let x = TestClass(1,?arg = Some(2))

Related information

  • Operating system - macOS
  • Branch - version 0.21.2
  • .NET Runtime, CoreCLR or Mono Version - .NET SDK 6.0.302

Leaxe avatar Sep 14 '22 16:09 Leaxe

Additional false positive: TupleIndentation when using named optional parameter assignments:

type TestClass(arg1 : int, ?arg2 : int) =
    class end

let x = TestClass(
    1,
    ?arg2 = Some(2)
)

Results in:

Sub-expressions of tuple on different lines should have consistent indentation.
Error on line 72 starting at column 8
        1,
        ^ 

I'm not sure what the workaround is for this one.

Leaxe avatar Sep 14 '22 17:09 Leaxe