// imethods returns the methods of the interface type t, sorted by name.
func imethods(t *types.Type) []*typeSig {
+ if t.HasShape() && !t.IsInterface() {
+ // Non-interface shape types have no methods. (There are
+ // corresponding functions (created by getInstantiation) that take
+ // the dictionary and the receiver of shape type as the first two
+ // arguments.)
+ return nil
+ }
var methods []*typeSig
for _, f := range t.AllMethods().Slice() {
if f.Type.Kind() != types.TFUNC || f.Sym == nil {
}
t.SetUnderlying(subst.Typ(baseType.Underlying()))
+ if t.HasShape() && !t.IsInterface() {
+ // Concrete shape types have no methods.
+ return
+ }
+
newfields := make([]*types.Field, baseType.Methods().Len())
for i, f := range baseType.Methods().Slice() {
if !f.IsMethod() || types.IsInterfaceMethod(f.Type) {
newfields[i].Nname = nname
}
t.Methods().Set(newfields)
- if !t.HasTParam() && t.Kind() != types.TINTER && t.Methods().Len() > 0 {
- // Generate all the methods for a new fully-instantiated type.
+ if !t.HasTParam() && !t.HasShape() && t.Kind() != types.TINTER && t.Methods().Len() > 0 {
+ // Generate all the methods for a new fully-instantiated,
+ // non-interface, non-shape type.
NeedInstType(t)
}
}