Skip to content

Commit c2112c5

Browse files
Copilotabonie
andcommitted
Add test for DU cases with /// after case definition
Added test "Discriminated Union - triple slash after case definition should warn" to verify that FS3879 warning is correctly emitted when /// XML doc comments appear after discriminated union case definitions on the same line. Co-authored-by: abonie <[email protected]>
1 parent d4b6661 commit c2112c5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/FSharp.Compiler.Service.Tests/XmlDocTests.fs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,3 +1617,22 @@ type Class2() =
16171617
parseResults |> checkParsingErrors [||]
16181618
checkResults |> checkXmlSymbols [ Parameter "MyRather.MyDeep.MyNamespace.Class1.X", [|"x"|] ]
16191619
checkResults |> checkXmlSymbols [ Parameter "MyRather.MyDeep.MyNamespace.Class1", [|"class1"|] ]
1620+
1621+
[<Fact>]
1622+
let ``Discriminated Union - triple slash after case definition should warn``(): unit =
1623+
checkSignatureAndImplementation """
1624+
module Test
1625+
1626+
type MyDU =
1627+
| CaseA of int /// This should trigger FS3879
1628+
| CaseB /// This should also trigger FS3879
1629+
/// This is correct
1630+
| CaseC
1631+
"""
1632+
(fun _ _ -> ())
1633+
(fun parseResults ->
1634+
parseResults |>
1635+
checkParsingErrors [|
1636+
Warning 3879, Line 5, Col 19, Line 5, Col 22, "XML documentation comments should be the first non-whitespace text on a line."
1637+
Warning 3879, Line 6, Col 11, Line 6, Col 14, "XML documentation comments should be the first non-whitespace text on a line."
1638+
|])

0 commit comments

Comments
 (0)