Skip to content

Commit db9e6e4

Browse files
authored
Process first ident in longIdent correctly. (#2960)
1 parent c3b899d commit db9e6e4

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Changelog
22

3-
## [Unreleased]
3+
## 6.2.1 - 2023-09-18
44

55
### Fixed
66
* Backticks in optional parameter gets removed [#2954](https://github.com/fsprojects/fantomas/issues/2954)
7+
* Ticks in namespace are lost [#2959](https://github.com/fsprojects/fantomas/issues/2959)
78

89
## 6.2.0 - 2023-08-29
910

src/Fantomas.Core.Tests/ModuleTests.fs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,3 +1106,24 @@ module Bar =
11061106
| Why
11071107
| Zed
11081108
"""
1109+
1110+
[<Test>]
1111+
let ``namespace with ticks, 2959`` () =
1112+
formatSourceString
1113+
false
1114+
"""
1115+
namespace ``G-Research``.``FSharp X``.``Analyzers Y``
1116+
1117+
module StringAnalyzers =
1118+
()
1119+
"""
1120+
config
1121+
|> prepend newline
1122+
|> should
1123+
equal
1124+
"""
1125+
namespace ``G-Research``.``FSharp X``.``Analyzers Y``
1126+
1127+
module StringAnalyzers =
1128+
()
1129+
"""

src/Fantomas.Core/ASTTransformer.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ let mkLongIdent (longIdent: LongIdent) : IdentListNode =
6969
let range =
7070
longIdent |> List.map (fun ident -> ident.idRange) |> List.reduce unionRanges
7171

72-
IdentListNode(IdentifierOrDot.Ident(stn head.idText head.idRange) :: rest, range)
72+
IdentListNode(IdentifierOrDot.Ident(mkIdent head) :: rest, range)
7373

7474
let mkSynAccess (vis: SynAccess option) =
7575
match vis with

0 commit comments

Comments
 (0)