Don't regard cases with multiple patterns as conducting a type test

This commit is contained in:
Chris Smowton
2024-03-22 15:01:42 +00:00
parent c7cb885e71
commit e59487a324

View File

@@ -213,13 +213,13 @@ class Guard extends ExprParent {
or
exists(PatternCase pc | this = pc |
pc.getSelectorExpr() = testedExpr and
testedType = pc.getPattern().getType()
testedType = pc.getUniquePattern().getType()
)
) and
(
if
exists(RecordPatternExpr rpe |
rpe = [this.(InstanceOfExpr).getPattern(), this.(PatternCase).getPattern()]
rpe = [this.(InstanceOfExpr).getPattern(), this.(PatternCase).getAPattern()]
|
not rpe.isUnrestricted()
)