Skip to content

Commit 0fa3cf7

Browse files
committed
Simplify test predicates
1 parent 3e836ef commit 0fa3cf7

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed
Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,17 @@
11
import csharp
22

3-
private predicate isRealRefTypeConstraint(Type t) {
4-
t instanceof RefType and
5-
not t instanceof Interface
6-
}
7-
83
query predicate refType(TypeParameter tp) {
94
tp.fromSource() and
10-
(
11-
not exists(tp.getConstraints())
12-
or
13-
tp.getConstraints().hasRefTypeConstraint()
14-
or
15-
tp.getConstraints().hasNullableRefTypeConstraint()
16-
or
17-
isRealRefTypeConstraint(tp.getConstraints().getATypeConstraint())
18-
)
5+
tp.isRefType()
196
}
207

218
query predicate valueType(TypeParameter tp) {
229
tp.fromSource() and
23-
(
24-
not exists(tp.getConstraints()) or
25-
tp.getConstraints().hasValueTypeConstraint() or
26-
tp.getConstraints().getATypeConstraint() instanceof ValueType
27-
)
10+
tp.isValueType()
2811
}
2912

3013
query predicate valueOrRefType(TypeParameter tp) {
3114
tp.fromSource() and
32-
(
33-
not exists(tp.getConstraints())
34-
or
35-
not tp.getConstraints().hasValueTypeConstraint() and
36-
not tp.getConstraints().hasRefTypeConstraint() and
37-
not isRealRefTypeConstraint(tp.getConstraints().getATypeConstraint())
38-
)
15+
not tp.isRefType() and
16+
not tp.isValueType()
3917
}

0 commit comments

Comments
 (0)