From 74e591bc4da39ad5b91118dec79e05ad37969f4d Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Fri, 4 Mar 2022 18:59:40 +0100 Subject: [PATCH] Add regression test for comment after match keyword. Fixes #1851. (#2127) --- CHANGELOG.md | 1 + src/Fantomas.Tests/PatternMatchingTests.fs | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c48c15f7f2..157d518134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed * Comment after equals is remove in anonymous record. [#1921](https://github.com/fsprojects/fantomas/issues/1921) * Comment after equals in record type is lost. [#2001](https://github.com/fsprojects/fantomas/issues/2001) +* Comment after match keyword is lost. [#1851](https://github.com/fsprojects/fantomas/issues/1851) ## [4.7.0] - 2022-03-04 diff --git a/src/Fantomas.Tests/PatternMatchingTests.fs b/src/Fantomas.Tests/PatternMatchingTests.fs index 9d64801fc9..059a7a852a 100644 --- a/src/Fantomas.Tests/PatternMatchingTests.fs +++ b/src/Fantomas.Tests/PatternMatchingTests.fs @@ -2123,3 +2123,30 @@ match! match! a with // foo | B b -> () """ + +[] +let ``comment after match keyword, 1851`` () = + formatSourceString + false + """ +match // foo + a with +| _ -> () + +match! // foo! + a with +| _ -> () +""" + config + |> prepend newline + |> should + equal + """ +match // foo + a with +| _ -> () + +match! // foo! + a with +| _ -> () +"""