From fbc4c6a3ae5eb21c93d167e5eebdb07327aa5462 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Wed, 25 Nov 2020 15:20:30 -0800 Subject: [dev.typeparams] cmd/compile/internal/types2: remove support for type parameter pointer designation An earlier version of the draft design supported pointer designation for type parameters. Remove related code since we don't need it anymore. Change-Id: I0d9e8c5f02a9a6745ff7ee15b8267a99ab1529e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/273327 Trust: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Robert Findley --- src/cmd/compile/internal/types2/subst.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/cmd/compile/internal/types2/subst.go') diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go index 27c907de10..e64e24a8a1 100644 --- a/src/cmd/compile/internal/types2/subst.go +++ b/src/cmd/compile/internal/types2/subst.go @@ -143,27 +143,14 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslis // - check only if we have methods check.completeInterface(nopos, iface) if len(iface.allMethods) > 0 { - // If the type argument is a type parameter itself, its pointer designation - // must match the pointer designation of the callee's type parameter. // If the type argument is a pointer to a type parameter, the type argument's // method set is empty. // TODO(gri) is this what we want? (spec question) - if tparg := targ.TypeParam(); tparg != nil { - if tparg.ptr != tpar.ptr { - check.errorf(pos, "pointer designation mismatch") - break - } - } else if base, isPtr := deref(targ); isPtr && base.TypeParam() != nil { + if base, isPtr := deref(targ); isPtr && base.TypeParam() != nil { check.errorf(pos, "%s has no methods", targ) break } - // If a type parameter is marked as a pointer type, the type bound applies - // to a pointer of the type argument. - actual := targ - if tpar.ptr { - actual = NewPointer(targ) - } - if m, wrong := check.missingMethod(actual, iface, true); m != nil { + if m, wrong := check.missingMethod(targ, iface, true); m != nil { // TODO(gri) needs to print updated name to avoid major confusion in error message! // (print warning for now) // check.softErrorf(pos, "%s does not satisfy %s (warning: name not updated) = %s (missing method %s)", targ, tpar.bound, iface, m) -- cgit v1.2.3-54-g00ecf