diff options
Diffstat (limited to 'src/go/types/named.go')
-rw-r--r-- | src/go/types/named.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/go/types/named.go b/src/go/types/named.go index 00fde16445..4a263410fc 100644 --- a/src/go/types/named.go +++ b/src/go/types/named.go @@ -309,6 +309,12 @@ func (check *Checker) completeMethod(env *Environment, m *Func) { smap := makeSubstMap(origSig.RecvTypeParams().list(), rtyp.targs.list()) sig := check.subst(orig.pos, origSig, smap, env).(*Signature) + if sig == origSig { + // No substitution occurred, but we still need to create a copy to hold the + // instantiated receiver. + copy := *origSig + sig = © + } sig.recv = NewParam(origSig.recv.pos, origSig.recv.pkg, origSig.recv.name, rtyp) m.typ = sig |