From e59487a3248d4d76cb0ae73b63d17d12c87a39d1 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Fri, 22 Mar 2024 15:01:42 +0000 Subject: [PATCH] Don't regard cases with multiple patterns as conducting a type test --- java/ql/lib/semmle/code/java/controlflow/Guards.qll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/ql/lib/semmle/code/java/controlflow/Guards.qll b/java/ql/lib/semmle/code/java/controlflow/Guards.qll index 94052d289db..c3e915b287b 100644 --- a/java/ql/lib/semmle/code/java/controlflow/Guards.qll +++ b/java/ql/lib/semmle/code/java/controlflow/Guards.qll @@ -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() )