Skip to content

Commit 3f936f2

Browse files
CopilotT-Gro
andcommitted
Update XmlDocTests to expect FS3879 warning for misplaced /// comments
Updated all 14 failing tests to include the new FS3879 warning that triggers when /// XML doc comments appear after other tokens on the same line. The warning appears before the existing FS3520 informational message about XML comments not being on valid language elements. Co-authored-by: T-Gro <[email protected]>
1 parent a560672 commit 3f936f2

File tree

1 file changed

+42
-9
lines changed

1 file changed

+42
-9
lines changed

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

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ and ///B1
404404
(checkXml "B" [|"B1"; "B2"|])
405405
(fun parseResults ->
406406
parseResults |>
407-
checkParsingErrors [|Information 3520, Line 8, Col 4, Line 8, Col 9, "XML comment is not placed on a valid language element."|]
407+
checkParsingErrors [|
408+
Warning 3879, Line 5, Col 4, Line 5, Col 7, "XML documentation comments should be the first non-whitespace text on a line."
409+
Information 3520, Line 8, Col 4, Line 8, Col 9, "XML comment is not placed on a valid language element."
410+
|]
408411

409412
match parseResults.ParseTree with
410413
| Types(range, [_; TypeRange(typeRange2, synComponentRange2)])
@@ -428,7 +431,10 @@ and ///B2
428431
(checkXml "B" [|"B1"|])
429432
(fun parseResults ->
430433
parseResults |>
431-
checkParsingErrors [|Information 3520, Line 6, Col 4, Line 6, Col 9, "XML comment is not placed on a valid language element."|]
434+
checkParsingErrors [|
435+
Warning 3879, Line 6, Col 4, Line 6, Col 7, "XML documentation comments should be the first non-whitespace text on a line."
436+
Information 3520, Line 6, Col 4, Line 6, Col 9, "XML comment is not placed on a valid language element."
437+
|]
432438

433439
match parseResults.ParseTree with
434440
| Types(range, [_; TypeRange(typeRange2, synComponentRange2)])
@@ -451,7 +457,10 @@ type ///A2
451457
(checkXml "A" [|"A1"|])
452458
(fun parseResults ->
453459
parseResults |>
454-
checkParsingErrors [|Information 3520, Line 5, Col 5, Line 5, Col 10, "XML comment is not placed on a valid language element."|]
460+
checkParsingErrors [|
461+
Warning 3879, Line 5, Col 5, Line 5, Col 8, "XML documentation comments should be the first non-whitespace text on a line."
462+
Information 3520, Line 5, Col 5, Line 5, Col 10, "XML comment is not placed on a valid language element."
463+
|]
455464

456465
match parseResults.ParseTree with
457466
| Types(range, [TypeRange(typeRange, synComponentRange)])
@@ -607,7 +616,10 @@ let ///X
607616
|> checkXml "x" [||]
608617

609618
parseResults
610-
|> checkParsingErrors [|Information 3520, Line 2, Col 4, Line 2, Col 8, "XML comment is not placed on a valid language element."|]
619+
|> checkParsingErrors [|
620+
Warning 3879, Line 2, Col 4, Line 2, Col 7, "XML documentation comments should be the first non-whitespace text on a line."
621+
Information 3520, Line 2, Col 4, Line 2, Col 8, "XML comment is not placed on a valid language element."
622+
|]
611623

612624
match parseResults.ParseTree with
613625
| LetBindings(range, [binding]) ->
@@ -691,7 +703,10 @@ let ///X2
691703
|> checkXml "x" [|"X1"|]
692704

693705
parseResults
694-
|> checkParsingErrors [|Information 3520, Line 3, Col 4, Line 3, Col 9, "XML comment is not placed on a valid language element."|]
706+
|> checkParsingErrors [|
707+
Warning 3879, Line 3, Col 4, Line 3, Col 7, "XML documentation comments should be the first non-whitespace text on a line."
708+
Information 3520, Line 3, Col 4, Line 3, Col 9, "XML comment is not placed on a valid language element."
709+
|]
695710

696711
match parseResults.ParseTree with
697712
| LetBindings(range, [binding]) ->
@@ -736,7 +751,10 @@ and ///G1
736751
|> checkXml "g" [|"G1"; "G2"|]
737752

738753
parseResults
739-
|> checkParsingErrors [|Information 3520, Line 6, Col 4, Line 6, Col 9, "XML comment is not placed on a valid language element."|]
754+
|> checkParsingErrors [|
755+
Warning 3879, Line 3, Col 4, Line 3, Col 7, "XML documentation comments should be the first non-whitespace text on a line."
756+
Information 3520, Line 6, Col 4, Line 6, Col 9, "XML comment is not placed on a valid language element."
757+
|]
740758

741759
match parseResults.ParseTree with
742760
| LetBindings(range, [binding1; binding2]) ->
@@ -758,7 +776,10 @@ and ///G2
758776
|> checkXml "g" [|"G1"|]
759777

760778
parseResults
761-
|> checkParsingErrors [|Information 3520, Line 4, Col 4, Line 4, Col 9, "XML comment is not placed on a valid language element."|]
779+
|> checkParsingErrors [|
780+
Warning 3879, Line 4, Col 4, Line 4, Col 7, "XML documentation comments should be the first non-whitespace text on a line."
781+
Information 3520, Line 4, Col 4, Line 4, Col 9, "XML comment is not placed on a valid language element."
782+
|]
762783

763784
match parseResults.ParseTree with
764785
| LetBindings(range, [binding1; binding2]) ->
@@ -826,6 +847,7 @@ type A =
826847

827848
parseResults
828849
|> checkParsingErrors [|
850+
Warning 3879, Line 3, Col 19, Line 3, Col 22, "XML documentation comments should be the first non-whitespace text on a line."
829851
Information 3520, Line 3, Col 19, Line 3, Col 24, "XML comment is not placed on a valid language element."
830852
Information 3520, Line 9, Col 4, Line 9, Col 9, "XML comment is not placed on a valid language element."
831853
|]
@@ -886,6 +908,9 @@ type B =
886908

887909
parseResults
888910
|> checkParsingErrors [|
911+
Warning 3879, Line 5, Col 11, Line 5, Col 14, "XML documentation comments should be the first non-whitespace text on a line."
912+
Warning 3879, Line 7, Col 16, Line 7, Col 19, "XML documentation comments should be the first non-whitespace text on a line."
913+
Warning 3879, Line 9, Col 16, Line 9, Col 19, "XML documentation comments should be the first non-whitespace text on a line."
889914
Information 3520, Line 5, Col 11, Line 5, Col 16, "XML comment is not placed on a valid language element."
890915
Information 3520, Line 7, Col 16, Line 7, Col 22, "XML comment is not placed on a valid language element."
891916
Information 3520, Line 9, Col 16, Line 9, Col 22, "XML comment is not placed on a valid language element."
@@ -938,7 +963,10 @@ type A ///CTOR1
938963
]
939964

940965
parseResults
941-
|> checkParsingErrors [|Information 3520, Line 5, Col 7, Line 5, Col 15, "XML comment is not placed on a valid language element."|]
966+
|> checkParsingErrors [|
967+
Warning 3879, Line 2, Col 7, Line 2, Col 10, "XML documentation comments should be the first non-whitespace text on a line."
968+
Information 3520, Line 5, Col 7, Line 5, Col 15, "XML comment is not placed on a valid language element."
969+
|]
942970

943971
match parseResults.ParseTree with
944972
| Members([SynMemberDefn.ImplicitCtor(range = range)]) ->
@@ -1054,6 +1082,7 @@ module ///M2
10541082
(fun parseResults ->
10551083
parseResults |>
10561084
checkParsingErrors [|
1085+
Warning 3879, Line 3, Col 7, Line 3, Col 10, "XML documentation comments should be the first non-whitespace text on a line."
10571086
Information 3520, Line 3, Col 7, Line 3, Col 12, "XML comment is not placed on a valid language element."
10581087
|]
10591088

@@ -1228,6 +1257,7 @@ exception ///E4
12281257
(fun parseResults ->
12291258
parseResults |>
12301259
checkParsingErrors [|
1260+
Warning 3879, Line 8, Col 10, Line 8, Col 13, "XML documentation comments should be the first non-whitespace text on a line."
12311261
Information 3520, Line 7, Col 0, Line 7, Col 5, "XML comment is not placed on a valid language element."
12321262
Information 3520, Line 8, Col 10, Line 8, Col 15, "XML comment is not placed on a valid language element."
12331263
|]
@@ -1250,7 +1280,10 @@ exception ///E
12501280
(checkXml "E" [||])
12511281
(fun parseResults ->
12521282
parseResults |>
1253-
checkParsingErrors [|Information 3520, Line 4, Col 10, Line 4, Col 14, "XML comment is not placed on a valid language element."|]
1283+
checkParsingErrors [|
1284+
Warning 3879, Line 4, Col 10, Line 4, Col 13, "XML documentation comments should be the first non-whitespace text on a line."
1285+
Information 3520, Line 4, Col 10, Line 4, Col 14, "XML comment is not placed on a valid language element."
1286+
|]
12541287

12551288
match parseResults.ParseTree with
12561289
| Exception(exnRange, exnDefnRange, exnDefnReprRange) ->

0 commit comments

Comments
 (0)