From 930ba9323d8f6d890ab32618904eeb9ffdfe18d3 Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Mon, 8 Nov 2021 18:32:03 +0100 Subject: [PATCH] Add ticks to mod identifier. Fixes #1960. (#1963) --- src/Fantomas.Tests/SignatureTests.fs | 19 +++++++++++++++++++ src/Fantomas/SourceParser.fs | 1 + 2 files changed, 20 insertions(+) diff --git a/src/Fantomas.Tests/SignatureTests.fs b/src/Fantomas.Tests/SignatureTests.fs index 40491bb2b3..b9c214c3ac 100644 --- a/src/Fantomas.Tests/SignatureTests.fs +++ b/src/Fantomas.Tests/SignatureTests.fs @@ -1601,3 +1601,22 @@ type Foo = Qux: string } static member Baz: int """ + +[] +let ``mod name in val, 1960`` () = + formatSourceString + true + """ +module X + +val ``mod``: t -> t -> t +""" + config + |> prepend newline + |> should + equal + """ +module X + +val ``mod``: t -> t -> t +""" diff --git a/src/Fantomas/SourceParser.fs b/src/Fantomas/SourceParser.fs index 6ec91d0e0e..a70ad751eb 100644 --- a/src/Fantomas/SourceParser.fs +++ b/src/Fantomas/SourceParser.fs @@ -35,6 +35,7 @@ let (|Ident|) (s: Ident) = | "not" -> "not" | "params" -> "``params``" | "parallel" -> "``parallel``" + | "mod" -> "``mod``" | _ -> if IsActivePatternName ident then sprintf "(%s)" (DecompileOpName ident)