Skip to content

Commit

Permalink
Merge PR fsprojects#672 from webwarrior-ws/fix-670
Browse files Browse the repository at this point in the history
Core: fix in getPatternIdents.

Fixes fsprojects#670
  • Loading branch information
knocte authored Jan 9, 2024
2 parents 354a45a + 5dda6ef commit e3139c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/FSharpLint.Core/Rules/Conventions/Naming/NamingHelper.fs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ let rec getPatternIdents<'T> (accessibility:AccessControlLevel) (getIdents:GetId
| SynPat.Wild(_)
| SynPat.OptionalVal(_)
| SynPat.DeprecatedCharRange(_) | SynPat.InstanceMember(_) | SynPat.FromParseError(_) -> Array.empty
| SynPat.As(_) -> failwith "Not implemented"
| SynPat.As(lhsPat, rhsPat, _) ->
Array.append
(getPatternIdents accessibility getIdents false lhsPat)
(getPatternIdents accessibility getIdents false rhsPat)

let rec identFromSimplePat = function
| SynSimplePat.Id(ident, _, _, _, _, _) -> Some ident
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,11 @@ let foo _x = 0

this.Parse source
Assert.AreEqual(expected, this.ApplyQuickFix source)

[<Test>]
member this.``As pattern is processed correctly (GetPatternIdents regression)``() =
this.Parse """
let foo ((x, y) as bar_coord) = bar_coord
"""

Assert.IsTrue this.ErrorsExist

0 comments on commit e3139c5

Please sign in to comment.