Skip to content

Commit 931e695

Browse files
committed
C#: Fix bad join-order in UselessTypeTest.ql
1 parent dffd95c commit 931e695

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

csharp/ql/src/Language Abuse/UselessTypeTest.ql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212

1313
import csharp
1414

15+
pragma[noinline]
16+
private predicate isTypePattern(IsExpr ie, ValueOrRefType t, ValueOrRefType ct) {
17+
t = ie.getExpr().getType() and
18+
ct = ie.getPattern().(TypePatternExpr).getCheckedType()
19+
}
20+
1521
from IsExpr ie, ValueOrRefType t, ValueOrRefType ct
1622
where
17-
t = ie.getExpr().getType() and
18-
ct = ie.getPattern().(TypePatternExpr).getCheckedType() and
23+
isTypePattern(ie, t, ct) and
1924
ct = t.getABaseType+()
2025
select ie,
2126
"There is no need to test whether an instance of $@ is also an instance of $@ - it always is.", t,

0 commit comments

Comments
 (0)