File tree Expand file tree Collapse file tree 4 files changed +11
-18
lines changed Expand file tree Collapse file tree 4 files changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -1582,18 +1582,10 @@ func isAlias(tp types.Type) bool {
1582
1582
return ok
1583
1583
}
1584
1584
1585
- // If the given type is a type alias, this function resolves it to its underlying type.
1586
- func resolveTypeAlias (tp types.Type ) types.Type {
1587
- if isAlias (tp ) {
1588
- return types .Unalias (tp ) // tp.Underlying()
1589
- }
1590
- return tp
1591
- }
1592
-
1593
1585
// extractType extracts type information for `tp` and returns its associated label;
1594
1586
// types are only extracted once, so the second time `extractType` is invoked it simply returns the label
1595
1587
func extractType (tw * trap.Writer , tp types.Type ) trap.Label {
1596
- tp = resolveTypeAlias (tp )
1588
+ tp = types . Unalias (tp )
1597
1589
lbl , exists := getTypeLabel (tw , tp )
1598
1590
if ! exists {
1599
1591
var kind int
@@ -1771,7 +1763,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1771
1763
// is constructed from their globally unique ID. This prevents cyclic type keys
1772
1764
// since type recursion in Go always goes through defined types.
1773
1765
func getTypeLabel (tw * trap.Writer , tp types.Type ) (trap.Label , bool ) {
1774
- tp = resolveTypeAlias (tp )
1766
+ tp = types . Unalias (tp )
1775
1767
lbl , exists := tw .Labeler .TypeLabels [tp ]
1776
1768
if ! exists {
1777
1769
switch tp := tp .(type ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ toolchain go1.24.0
10
10
// bazel mod tidy
11
11
require (
12
12
golang.org/x/mod v0.24.0
13
- golang.org/x/tools v0.32 .0
13
+ golang.org/x/tools v0.33 .0
14
14
)
15
15
16
- require golang.org/x/sync v0.13 .0 // indirect
16
+ require golang.org/x/sync v0.14 .0 // indirect
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
2
2
github.com/google/go-cmp v0.6.0 /go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY =
3
3
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU =
4
4
golang.org/x/mod v0.24.0 /go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww =
5
- golang.org/x/sync v0.13 .0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610 =
6
- golang.org/x/sync v0.13 .0 /go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA =
7
- golang.org/x/tools v0.32 .0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU =
8
- golang.org/x/tools v0.32 .0 /go.mod h1:ZxrU41P/wAbZD8EDa6dDCa6XfpkhJ7HFMjHJXfBDu8s =
5
+ golang.org/x/sync v0.14 .0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ =
6
+ golang.org/x/sync v0.14 .0 /go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA =
7
+ golang.org/x/tools v0.33 .0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc =
8
+ golang.org/x/tools v0.33 .0 /go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI =
Original file line number Diff line number Diff line change @@ -169,11 +169,12 @@ func (l *Labeler) ScopedObjectID(object types.Object, getTypeLabel func() Label)
169
169
170
170
// findMethodWithGivenReceiver finds a method with `object` as its receiver, if one exists
171
171
func findMethodWithGivenReceiver (object types.Object ) * types.Func {
172
- meth := findMethodOnTypeWithGivenReceiver (object .Type (), object )
172
+ unaliasedType := types .Unalias (object .Type ())
173
+ meth := findMethodOnTypeWithGivenReceiver (unaliasedType , object )
173
174
if meth != nil {
174
175
return meth
175
176
}
176
- if pointerType , ok := object . Type () .(* types.Pointer ); ok {
177
+ if pointerType , ok := unaliasedType .(* types.Pointer ); ok {
177
178
meth = findMethodOnTypeWithGivenReceiver (pointerType .Elem (), object )
178
179
}
179
180
return meth
You can’t perform that action at this time.
0 commit comments