From 4d7a22ec1ab5f469627120459e7c44a6b331f264 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 5 Jun 2022 21:46:42 -1100 Subject: [PATCH 1/3] Add Regression test for variants with modules lose comments --- src/Fantomas.Core.Tests/UnionTests.fs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Fantomas.Core.Tests/UnionTests.fs b/src/Fantomas.Core.Tests/UnionTests.fs index 79722d0634..681793e72e 100644 --- a/src/Fantomas.Core.Tests/UnionTests.fs +++ b/src/Fantomas.Core.Tests/UnionTests.fs @@ -879,6 +879,25 @@ type Foo = // comment 1 """ +[] +let ``comment after variants with modules`` () = + formatSourceString + false + """ +type X = + | A of int // This comment survives + | B of C.D // This comment survives +""" + config + |> prepend newline + |> should + equal + """ +type X = + | A of int // This comment survives + | B of C.D // This comment survives +""" + [] let ``comment after equals in union`` () = formatSourceString From 9f0bc0aaeef2ac4dfd52ce2db41d2d55496e20af Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Tue, 7 Jun 2022 16:33:40 -1100 Subject: [PATCH 2/3] Update test name wirth a more meaninful one and update ChangeLog.md --- CHANGELOG.md | 3 +++ src/Fantomas.Core.Tests/UnionTests.fs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f33640ea0..d42766d19b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +## Changed +* Trivia not restored after long identifier in SynField. [#2290](https://github.com/fsprojects/fantomas/pull/2290) + ### Fixed * Explicit interface with SpaceBeforeClassConstructor. [#2226](https://github.com/fsprojects/fantomas/issues/2226) * Spaces around binary operators in units of measure. [#2207](https://github.com/fsprojects/fantomas/issues/2207) diff --git a/src/Fantomas.Core.Tests/UnionTests.fs b/src/Fantomas.Core.Tests/UnionTests.fs index 681793e72e..07d110ff6f 100644 --- a/src/Fantomas.Core.Tests/UnionTests.fs +++ b/src/Fantomas.Core.Tests/UnionTests.fs @@ -880,7 +880,7 @@ type Foo = // comment """ [] -let ``comment after variants with modules`` () = +let ``trivia not restored after long identifier in SynField, 2103`` () = formatSourceString false """ From b0f8096ffe98a238df07401ffb7d6b3a165123a3 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Tue, 7 Jun 2022 16:46:53 -1100 Subject: [PATCH 3/3] Update ChangeLog --- CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d42766d19b..4f7a297ba0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,10 @@ ## [Unreleased] -## Changed -* Trivia not restored after long identifier in SynField. [#2290](https://github.com/fsprojects/fantomas/pull/2290) - ### Fixed * Explicit interface with SpaceBeforeClassConstructor. [#2226](https://github.com/fsprojects/fantomas/issues/2226) * Spaces around binary operators in units of measure. [#2207](https://github.com/fsprojects/fantomas/issues/2207) +* Trivia not restored after long identifier in SynField. [#2290](https://github.com/fsprojects/fantomas/pull/2290) ## [5.0.0-alpha-008] - 2022-05-28