Skip to content

Commit 228c45a

Browse files
committed
Look through aliases when identifying method receivers
1 parent 9b0854e commit 228c45a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

go/extractor/trap/labels.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,12 @@ func (l *Labeler) ScopedObjectID(object types.Object, getTypeLabel func() Label)
169169

170170
// findMethodWithGivenReceiver finds a method with `object` as its receiver, if one exists
171171
func findMethodWithGivenReceiver(object types.Object) *types.Func {
172-
meth := findMethodOnTypeWithGivenReceiver(object.Type(), object)
172+
unaliasedType := types.Unalias(object.Type())
173+
meth := findMethodOnTypeWithGivenReceiver(unaliasedType, object)
173174
if meth != nil {
174175
return meth
175176
}
176-
if pointerType, ok := object.Type().(*types.Pointer); ok {
177+
if pointerType, ok := unaliasedType.(*types.Pointer); ok {
177178
meth = findMethodOnTypeWithGivenReceiver(pointerType.Elem(), object)
178179
}
179180
return meth

0 commit comments

Comments
 (0)