Skip to content

Commit 1bacb99

Browse files
authored
Merge pull request #18585 from owen-mc/go/1.24-support-prep
Go: 1.24 support - Tolerate type parameters on alias types
2 parents f75ecdb + 29f6d48 commit 1bacb99

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

go/extractor/extractor.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,11 +475,11 @@ func extractObjects(tw *trap.Writer, scope *types.Scope, scopeLabel trap.Label)
475475
populateTypeParamParents(funcObj.Type().(*types.Signature).TypeParams(), obj)
476476
populateTypeParamParents(funcObj.Type().(*types.Signature).RecvTypeParams(), obj)
477477
}
478-
// Populate type parameter parents for named types. Note that we
479-
// skip type aliases as the original type should be the parent
480-
// of any type parameters.
481-
if typeNameObj, ok := obj.(*types.TypeName); ok && !typeNameObj.IsAlias() {
482-
if tp, ok := typeNameObj.Type().(*types.Named); ok {
478+
// Populate type parameter parents for named types.
479+
if typeNameObj, ok := obj.(*types.TypeName); ok {
480+
if tp, ok := typeNameObj.Type().(*types.Named); ok && !typeNameObj.IsAlias() {
481+
populateTypeParamParents(tp.TypeParams(), obj)
482+
} else if tp, ok := typeNameObj.Type().(*types.Alias); ok {
483483
populateTypeParamParents(tp.TypeParams(), obj)
484484
}
485485
}

0 commit comments

Comments
 (0)