From 68d360e2b1f55395c6d32b0220f15e53187edb4c Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 30 Jan 2024 17:28:15 +0100 Subject: [PATCH 1/4] PrettyNaming: remove the extra checks in `AddBackticksToIdentifierIfNeeded` --- src/Compiler/SyntaxTree/PrettyNaming.fs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Compiler/SyntaxTree/PrettyNaming.fs b/src/Compiler/SyntaxTree/PrettyNaming.fs index 3000297d866..1d7b5b9c0a0 100755 --- a/src/Compiler/SyntaxTree/PrettyNaming.fs +++ b/src/Compiler/SyntaxTree/PrettyNaming.fs @@ -531,8 +531,6 @@ let DoesIdentifierNeedBackticks (name: string) : bool = let AddBackticksToIdentifierIfNeeded (name: string) : string = if DoesIdentifierNeedBackticks name - && not (name.StartsWithOrdinal("`")) - && not (name.EndsWithOrdinal("`")) then "``" + name + "``" else From e9603c0415e50094b95e34f08a50c3301e1e526b Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 1 Feb 2024 13:20:47 +0100 Subject: [PATCH 2/4] Fantomas --- src/Compiler/SyntaxTree/PrettyNaming.fs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Compiler/SyntaxTree/PrettyNaming.fs b/src/Compiler/SyntaxTree/PrettyNaming.fs index 1d7b5b9c0a0..12e0a84d7f1 100755 --- a/src/Compiler/SyntaxTree/PrettyNaming.fs +++ b/src/Compiler/SyntaxTree/PrettyNaming.fs @@ -529,9 +529,7 @@ let DoesIdentifierNeedBackticks (name: string) : bool = /// A utility to help determine if an identifier needs to be quoted let AddBackticksToIdentifierIfNeeded (name: string) : string = - if - DoesIdentifierNeedBackticks name - then + if DoesIdentifierNeedBackticks name then "``" + name + "``" else name From 9ea751d8e6f37f5e570074983c961fd963030ed2 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 1 Feb 2024 14:16:18 +0100 Subject: [PATCH 3/4] Release notes --- docs/release-notes/.FSharp.Compiler.Service/8.0.300.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md index 85735d5b430..fe0650ced62 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md @@ -13,6 +13,7 @@ * Parser recovers on complex primary constructor patterns, better tree representation for primary constructor patterns. ([PR #16425](https://github.com/dotnet/fsharp/pull/16425)) * Name resolution: keep type vars in subsequent checks ([PR #16456](https://github.com/dotnet/fsharp/pull/16456)) * Higher-order-function-based API for working with the untyped abstract syntax tree. ([PR #16462](https://github.com/dotnet/fsharp/pull/16462)) +* Pretty naming: remove extra checks in `AddBackticksToIdentifierIfNeeded` ([PR #16614](https://github.com/dotnet/fsharp/pull/16614)) ### Changed From 4c9f522710d2360340d01086900c3212ffe3a20d Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 1 Feb 2024 14:18:45 +0100 Subject: [PATCH 4/4] Release notes --- docs/release-notes/.FSharp.Compiler.Service/8.0.300.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md index fe0650ced62..67cc63b8ac0 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md @@ -5,6 +5,7 @@ * Graph Based Checking doesn't throw on invalid parsed input so it can be used for IDE scenarios ([PR #16575](https://github.com/dotnet/fsharp/pull/16575), [PR #16588](https://github.com/dotnet/fsharp/pull/16588)) * Keep parens for problematic exprs (`if`, `match`, etc.) in `$"{(…):N0}"`, `$"{(…),-3}"`, etc. ([PR #16578](https://github.com/dotnet/fsharp/pull/16578)) * Fix crash in DOTNET_SYSTEM_GLOBALIZATION_INVARIANT mode [#PR 16471](https://github.com/dotnet/fsharp/pull/16471)) +* Pretty naming: remove extra checks in `AddBackticksToIdentifierIfNeeded` ([PR #16614](https://github.com/dotnet/fsharp/pull/16614)) ### Added @@ -13,7 +14,7 @@ * Parser recovers on complex primary constructor patterns, better tree representation for primary constructor patterns. ([PR #16425](https://github.com/dotnet/fsharp/pull/16425)) * Name resolution: keep type vars in subsequent checks ([PR #16456](https://github.com/dotnet/fsharp/pull/16456)) * Higher-order-function-based API for working with the untyped abstract syntax tree. ([PR #16462](https://github.com/dotnet/fsharp/pull/16462)) -* Pretty naming: remove extra checks in `AddBackticksToIdentifierIfNeeded` ([PR #16614](https://github.com/dotnet/fsharp/pull/16614)) + ### Changed