Skip to content

Commit 5388bb7

Browse files
committed
autoformat and tidy an unnecessary direct db relation use
1 parent 3e8b584 commit 5388bb7

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

go/ql/lib/semmle/go/Types.qll

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,30 +1201,20 @@ class ComparableType extends NamedType {
12011201
}
12021202

12031203
pragma[nomagic]
1204-
private predicate unpackTupleType(TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents) {
1204+
private predicate unpackTupleType(
1205+
TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents
1206+
) {
12051207
nComponents = count(int i | component_types(tt, i, _, _)) and
1206-
(
1207-
if nComponents >= 1
1208-
then c0 = MkSomeType(tt.getComponentType(0))
1209-
else c0 = MkNoType()
1210-
) and
1211-
(
1212-
if nComponents >= 2
1213-
then c1 = MkSomeType(tt.getComponentType(1))
1214-
else c1 = MkNoType()
1215-
) and
1216-
(
1217-
if nComponents >= 3
1218-
then c2 = MkSomeType(tt.getComponentType(2))
1219-
else c2 = MkNoType()
1220-
)
1208+
(if nComponents >= 1 then c0 = MkSomeType(tt.getComponentType(0)) else c0 = MkNoType()) and
1209+
(if nComponents >= 2 then c1 = MkSomeType(tt.getComponentType(1)) else c1 = MkNoType()) and
1210+
(if nComponents >= 3 then c2 = MkSomeType(tt.getComponentType(2)) else c2 = MkNoType())
12211211
}
12221212

12231213
pragma[nomagic]
1224-
private predicate unpackAndUnaliasTupleType(TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents) {
1225-
exists(
1226-
OptType c0a, OptType c1a, OptType c2a
1227-
|
1214+
private predicate unpackAndUnaliasTupleType(
1215+
TupleType tt, TOptType c0, TOptType c1, TOptType c2, int nComponents
1216+
) {
1217+
exists(OptType c0a, OptType c1a, OptType c2a |
12281218
unpackTupleType(tt, c0a, c1a, c2a, nComponents) and
12291219
c0 = c0a.getDeepUnaliasedType() and
12301220
c1 = c1a.getDeepUnaliasedType() and
@@ -1238,9 +1228,7 @@ class TupleType extends @tupletype, CompositeType {
12381228
Type getComponentType(int i) { component_types(this, i, _, result) }
12391229

12401230
private TupleType getCandidateDeepUnaliasedType() {
1241-
exists(
1242-
OptType c0, OptType c1, OptType c2, int nComponents
1243-
|
1231+
exists(OptType c0, OptType c1, OptType c2, int nComponents |
12441232
unpackAndUnaliasTupleType(this, c0, c1, c2, nComponents) and
12451233
unpackTupleType(result, c0, c1, c2, nComponents)
12461234
)
@@ -1254,9 +1242,7 @@ class TupleType extends @tupletype, CompositeType {
12541242
or
12551243
this.isDeepUnaliasedTypeUpTo(tt, i - 1)
12561244
) and
1257-
exists(Type tp | component_types(this, i, _, tp) |
1258-
component_types(tt, i, _, tp.getDeepUnaliasedType())
1259-
)
1245+
tt.getComponentType(i) = this.getComponentType(i).getDeepUnaliasedType()
12601246
}
12611247

12621248
override TupleType getDeepUnaliasedType() {

0 commit comments

Comments
 (0)