Skip to content

Commit

Permalink
Update FCS to 'Correct SynAttribute range' (#2557)
Browse files Browse the repository at this point in the history
* Update FCS to 'Add SynArgPatsNamePatPairsTrivia to SynArgPats.NamePatPairs'.

* Ignore test for now.

* Update FCS to 'Correct SynAttribute range'.

* Add regression test for 2525.
  • Loading branch information
nojaf committed Oct 7, 2022
1 parent ed8ea48 commit cb6d1e4
Show file tree
Hide file tree
Showing 10 changed files with 295 additions and 233 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased]

### Changed
* Update FCS to 'Correct SynAttribute range', commit e389d7744b7ddf81fd62cf01ce870cf92f6dcabd

## [5.1.0-alpha-003] - 2022-10-02

### Changed
Expand Down
180 changes: 90 additions & 90 deletions paket.dependencies

Large diffs are not rendered by default.

180 changes: 90 additions & 90 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -172,96 +172,96 @@ GITHUB
remote: fsprojects/fantomas
src/Fantomas/CodePrinter.fs (829faa6ba834f99afed9b4434b3a1680536474b2)
remote: dotnet/fsharp
src/Compiler/AbstractIL/il.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/il.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/ilascii.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/ilascii.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/illex.fsl (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/illex.fsl (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/ilpars.fsy (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/ilpars.fsy (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/ilx.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/ilx.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Checking/CheckDeclarations.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/DiagnosticOptions.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/DiagnosticOptions.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/DiagnosticsLogger.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/DiagnosticsLogger.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/LanguageFeatures.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/LanguageFeatures.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/Logger.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/Logger.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/prim-lexing.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/prim-lexing.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/prim-parsing.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/prim-parsing.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/TextLayoutRender.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/TextLayoutRender.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Facilities/UtilsStrings.txt (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/FSComp.txt (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/FSStrings.resx (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Interactive/FSIstrings.txt (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/lex.fsl (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/lex.fsl (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/pars.fsy (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/pars.fsy (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/pplex.fsl (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/pplex.fsl (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/pppars.fsy (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/pppars.fsy (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/LexFilter.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/LexFilter.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/LexHelpers.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/LexHelpers.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/ParseHelpers.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/ParseHelpers.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/PrettyNaming.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/PrettyNaming.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/SyntaxTree.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/SyntaxTree.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/SyntaxTreeOps.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/SyntaxTreeOps.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/SyntaxTrivia.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/SyntaxTrivia.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/UnicodeLexing.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/UnicodeLexing.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/XmlDoc.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/SyntaxTree/XmlDoc.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/FileSystem.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/FileSystem.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/HashMultiMap.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/HashMultiMap.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/ildiag.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/ildiag.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/illib.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/illib.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/InternalCollections.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/InternalCollections.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/lib.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/lib.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/PathMap.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/PathMap.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/QueueList.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/QueueList.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/range.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/range.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/rational.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/rational.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/ResizeArray.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/ResizeArray.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/RidHelpers.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/sformat.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/sformat.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/sr.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/sr.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/TaggedCollections.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/TaggedCollections.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/XmlAdapters.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/XmlAdapters.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/zmap.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/zmap.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/zset.fs (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/Utilities/zset.fsi (51635bbebf36e39a86d06d96730e13cfc40a095f)
src/Compiler/AbstractIL/il.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/il.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/ilascii.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/ilascii.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/illex.fsl (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/illex.fsl (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/ilpars.fsy (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/ilpars.fsy (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/ilx.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/AbstractIL/ilx.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Checking/CheckDeclarations.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/DiagnosticOptions.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/DiagnosticOptions.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/DiagnosticsLogger.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/DiagnosticsLogger.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/LanguageFeatures.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/LanguageFeatures.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/Logger.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/Logger.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/prim-lexing.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/prim-lexing.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/prim-parsing.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/prim-parsing.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/TextLayoutRender.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/TextLayoutRender.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Facilities/UtilsStrings.txt (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/FSComp.txt (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/FSStrings.resx (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Interactive/FSIstrings.txt (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/lex.fsl (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/lex.fsl (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/pars.fsy (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/pars.fsy (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/pplex.fsl (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/pplex.fsl (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/pppars.fsy (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/pppars.fsy (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/LexFilter.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/LexFilter.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/LexHelpers.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/LexHelpers.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/ParseHelpers.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/ParseHelpers.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/PrettyNaming.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/PrettyNaming.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/SyntaxTree.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/SyntaxTree.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/SyntaxTreeOps.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/SyntaxTreeOps.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/SyntaxTrivia.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/SyntaxTrivia.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/UnicodeLexing.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/UnicodeLexing.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/XmlDoc.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/SyntaxTree/XmlDoc.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/FileSystem.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/FileSystem.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/HashMultiMap.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/HashMultiMap.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/ildiag.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/ildiag.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/illib.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/illib.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/InternalCollections.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/InternalCollections.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/lib.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/lib.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/PathMap.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/PathMap.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/QueueList.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/QueueList.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/range.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/range.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/rational.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/rational.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/ResizeArray.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/ResizeArray.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/RidHelpers.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/sformat.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/sformat.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/sr.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/sr.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/TaggedCollections.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/TaggedCollections.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/XmlAdapters.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/XmlAdapters.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/zmap.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/zmap.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/zset.fs (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
src/Compiler/Utilities/zset.fsi (e389d7744b7ddf81fd62cf01ce870cf92f6dcabd)
GROUP client
STORAGE: NONE
NUGET
Expand Down
25 changes: 25 additions & 0 deletions src/Fantomas.Core.Tests/AttributeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,3 +1098,28 @@ type StreamReaderExtensions =
// it might still be running after recieving None!
static member inline Meh(streamReader: StreamReader, timeout: TimeSpan) = ()
"""

[<Test>]
let ``trivia in nested multiline tuple expression in attribute, 2525`` () =
formatSourceString
false
"""
[<assembly: SuppressMessage("Gendarme.Rules.Performance",
"AvoidRepetitiveCallsToPropertiesRule",
Scope = "member", // MethodDefinition
Target = "AltCover.Recorder.Instance/I/CallTrack::instance()",
Justification = "Bytecode delta only")>]
()
"""
config
|> prepend newline
|> should
equal
"""
[<assembly: SuppressMessage("Gendarme.Rules.Performance",
"AvoidRepetitiveCallsToPropertiesRule",
Scope = "member", // MethodDefinition
Target = "AltCover.Recorder.Instance/I/CallTrack::instance()",
Justification = "Bytecode delta only")>]
()
"""
1 change: 1 addition & 0 deletions src/Fantomas.Core.Tests/PatternMatchingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,7 @@ with
"""

[<Test>]
[<Ignore "Resolve in https://github.com/fsprojects/fantomas/pull/2551">]
let ``single line named fields in a pattern matching should have space surrounding the '=', 1877`` () =
formatSourceString
false
Expand Down
25 changes: 23 additions & 2 deletions src/Fantomas.Core/AstTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,21 @@ and visitSynPat (sp: SynPat) : TriviaNode =
|> finalContinuation

Continuation.sequence continuations finalContinuation

| SynPat.ListCons (p1, p2, range, trivia) ->
let continuations: ((TriviaNode -> TriviaNode) -> TriviaNode) list =
[ visit p1; visit p2 ]

let finalContinuation (nodes: TriviaNode list) : TriviaNode =
mkNodeWithChildren
SynPat_ListCons
range
(sortChildren
[| yield! nodes
yield mkNode SynPat_ListCons_ColonColon trivia.ColonColonRange |])
|> finalContinuation

Continuation.sequence continuations finalContinuation
| SynPat.Ands (pats, range) ->
let continuations: ((TriviaNode -> TriviaNode) -> TriviaNode) list =
pats |> List.map visit
Expand Down Expand Up @@ -1240,7 +1255,7 @@ and visitSynPat (sp: SynPat) : TriviaNode =
and visitSynConstructorArgs (ctorArgs: SynArgPats) : TriviaNode list =
match ctorArgs with
| SynArgPats.Pats pats -> List.map visitSynPat pats
| SynArgPats.NamePatPairs (pats, range) ->
| SynArgPats.NamePatPairs (pats, _, { ParenRange = StartEndRange 1 (lpr, range, rpr) }) ->
let children =
pats
|> List.map (fun (ident, eqRange, pat) ->
Expand All @@ -1251,7 +1266,13 @@ and visitSynConstructorArgs (ctorArgs: SynArgPats) : TriviaNode list =
mkNode SynArgPats_NamePatPairs_Equals eqRange
visitSynPat pat |])

[ mkNodeWithChildren SynArgPats_NamePatPairs range (sortChildren [| yield! children |]) ]
[ mkNodeWithChildren
SynArgPats_NamePatPairs
range
(sortChildren
[| yield mkNode SynArgPats_NamePatPairs_OpeningParenthesis lpr
yield! children
yield mkNode SynArgPats_NamePatPairs_ClosingParenthesis rpr |]) ]

and visitSynComponentInfo (sci: SynComponentInfo) : TriviaNode list =
match sci with
Expand Down
Loading

0 comments on commit cb6d1e4

Please sign in to comment.