Skip to content

Commit b95a332

Browse files
committed
C#: Simplify the isCollectionType predicate.
1 parent 92f8a90 commit b95a332

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

csharp/ql/lib/semmle/code/csharp/commons/Collections.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import csharp
44
import semmle.code.csharp.frameworks.system.Collections
5-
import semmle.code.csharp.frameworks.system.collections.Generic
65

76
private string modifyMethodName() {
87
result =
@@ -70,11 +69,8 @@ class CollectionType extends RefType {
7069

7170
/** Holds if `t` is a collection type. */
7271
predicate isCollectionType(ValueOrRefType t) {
73-
not t instanceof StringType and
74-
exists(ValueOrRefType base | base = t.getABaseType*() |
75-
base instanceof SystemCollectionsGenericIEnumerableTInterface or
76-
base instanceof SystemCollectionsIEnumerableInterface
77-
)
72+
t.getABaseType*() instanceof SystemCollectionsIEnumerableInterface and
73+
not t instanceof StringType
7874
}
7975

8076
/** An object creation that creates an empty collection. */

0 commit comments

Comments
 (0)