Merge pull request #17941 from owen-mc/go/fix/missing-method-qualified-names

Go: fix missing qualified names for some promoted methods
This commit is contained in:
Owen Mansel-Chan
2024-11-11 22:50:17 +00:00
committed by GitHub
20 changed files with 153 additions and 13 deletions

View File

@@ -1713,13 +1713,24 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
extractMethod(tw, meth)
}
underlyingInterface, underlyingIsInterface := underlying.(*types.Interface)
_, underlyingIsPointer := underlying.(*types.Pointer)
// associate all methods of underlying interface with this type
if underlyingInterface, ok := underlying.(*types.Interface); ok {
if underlyingIsInterface {
for i := 0; i < underlyingInterface.NumMethods(); i++ {
methlbl := extractMethod(tw, underlyingInterface.Method(i).Origin())
dbscheme.MethodHostsTable.Emit(tw, methlbl, lbl)
}
}
// If `underlying` is not a pointer or interface then methods can
// be defined on `origintp`. In this case we must ensure that
// `*origintp` is in the database, so that Method.hasQualifiedName
// correctly includes methods with receiver type `*origintp`.
if !underlyingIsInterface && !underlyingIsPointer {
extractType(tw, types.NewPointer(origintp))
}
case *types.TypeParam:
kind = dbscheme.TypeParamType.Index()
parentlbl := getTypeParamParentLabel(tw, tp)