We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
UselessTypeTest.ql
1 parent dffd95c commit 931e695Copy full SHA for 931e695
csharp/ql/src/Language Abuse/UselessTypeTest.ql
@@ -12,10 +12,15 @@
12
13
import csharp
14
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
+
21
from IsExpr ie, ValueOrRefType t, ValueOrRefType ct
22
where
- t = ie.getExpr().getType() and
- ct = ie.getPattern().(TypePatternExpr).getCheckedType() and
23
+ isTypePattern(ie, t, ct) and
24
ct = t.getABaseType+()
25
select ie,
26
"There is no need to test whether an instance of $@ is also an instance of $@ - it always is.", t,
0 commit comments