aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/subst.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2020-11-25 15:20:30 -0800
committerRobert Griesemer <gri@golang.org>2020-12-01 06:30:45 +0000
commitfbc4c6a3ae5eb21c93d167e5eebdb07327aa5462 (patch)
treed77f907addde13b2aa1d25ce92efaa14216d76fb /src/cmd/compile/internal/types2/subst.go
parentba9c35aa12ea2a5e1689edeced0efed3de0b0256 (diff)
downloadgo-fbc4c6a3ae5eb21c93d167e5eebdb07327aa5462.tar.gz
go-fbc4c6a3ae5eb21c93d167e5eebdb07327aa5462.zip
[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 <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/subst.go')
-rw-r--r--src/cmd/compile/internal/types2/subst.go17
1 files changed, 2 insertions, 15 deletions
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)