Skip to content

Commit 8552774

Browse files
committed
Remove redundant getUnderlyingType()
If `T` is the type of an embedded field, it is invalid for `T` to be a named type defined to be a pointer type (`type T *S`). It is also invalid for `T` to be a type parameter. So this `getUnderlyingType()` is redundant.
1 parent 4a05c3d commit 8552774

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class StructType extends @structtype, CompositeType {
498498
this.hasFieldCand(_, embeddedParent, depth - 1, true) and
499499
// embeddedParent's type has the result field
500500
exists(StructType embeddedType, Type fieldType |
501-
fieldType = embeddedParent.getType().getUnderlyingType() and
501+
fieldType = embeddedParent.getType() and
502502
pragma[only_bind_into](embeddedType) =
503503
[fieldType, fieldType.(PointerType).getBaseType().getUnderlyingType()]
504504
|

0 commit comments

Comments
 (0)