Skip to content

Commit 6bdbdab

Browse files
committed
Core(Tests): new test for DisallowShadowing
That makes sure that there is no false positive for identifiers used as arguments to active pattern.
1 parent b78afef commit 6bdbdab

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/FSharpLint.Core.Tests/Rules/Conventions/DisallowShadowing.fs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,20 @@ match node with
171171
| EndOfHint(_) -> None"""
172172

173173
Assert.IsTrue this.NoErrorsExist
174+
175+
[<Test>]
176+
member this.``Should not produce error for vars used as args to active patterns``() =
177+
this.Parse """
178+
let private (|RaiseWithTooManyArgs|_|) identifier maxArgs = function
179+
| ExpressionUtilities.Identifier([ ident ], _)::arguments
180+
when List.length arguments > maxArgs && ident.idText = identifier ->
181+
Some()
182+
| _ -> None
183+
184+
let checkRaiseWithTooManyArgs (raiseType:string) (count:int) =
185+
match expressions with
186+
| RaiseWithTooManyArgs raiseType count -> Array.empty
187+
| _ -> Array.empty
188+
"""
189+
190+
Assert.IsTrue this.NoErrorsExist

0 commit comments

Comments
 (0)