Skip to content

Commit 57fad4a

Browse files
committed
Allow type parameters on alias types
1 parent 4bd4937 commit 57fad4a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

go/extractor/extractor.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,12 @@ 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() {
478+
// Populate type parameter parents for named types.
479+
if typeNameObj, ok := obj.(*types.TypeName); ok {
482480
if tp, ok := typeNameObj.Type().(*types.Named); ok {
483481
populateTypeParamParents(tp.TypeParams(), obj)
482+
} else if tp, ok := typeNameObj.Type().(*types.Alias); ok {
483+
populateTypeParamParents(tp.TypeParams(), obj)
484484
}
485485
}
486486
extractObject(tw, obj, lbl)

0 commit comments

Comments
 (0)