Skip to content

Commit d16cbc1

Browse files
webwarrior-wsknocte
authored andcommitted
DisallowShadowing: fixed false positive
In match expressions with active pattern.
1 parent 9d184bc commit d16cbc1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/FSharpLint.Core/Rules/Conventions/DisallowShadowing.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,14 @@ let private checkIdentifier (args: AstNodeRuleParams) (identifier: Ident) : arra
123123
| _ -> false
124124

125125
let parents = args.GetParents args.NodeIndex
126-
let isShadowing =
127-
parents |> List.exists processAstNode
126+
let isShadowing =
127+
let currentDefinition =
128+
definitionsWithSameName |> Seq.tryFind (fun definition -> definition.Range = identifier.idRange)
129+
match currentDefinition with
130+
| Some _ ->
131+
parents |> List.exists processAstNode
132+
| None ->
133+
false
128134

129135
if isShadowing then
130136
Array.singleton {

0 commit comments

Comments
 (0)