diff options
author | Robert Griesemer <gri@golang.org> | 2021-02-17 17:06:53 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-02-18 20:47:11 +0000 |
commit | 653386a89a702b54bb01be893cfd30cddb0e6107 (patch) | |
tree | 8cdea0b59711b9a9377f64ae3e1117aa9eddd31d /src/cmd/compile/internal/types2/subst.go | |
parent | 5e4da8670b13370392a9195930e3b4bbe5f1944f (diff) | |
download | go-653386a89a702b54bb01be893cfd30cddb0e6107.tar.gz go-653386a89a702b54bb01be893cfd30cddb0e6107.zip |
[dev.typeparams] cmd/compile/internal/types2: replace Named, TypeParam methods with functions
This removes two more converter methods in favor of functions.
This further reduces the API surface of types2.Type and matches
the approach taken in go/types.
Change-Id: I3cdd54c5e0d1e7664a69f3697fc081a66315b969
Reviewed-on: https://go-review.googlesource.com/c/go/+/293292
Trust: Robert Griesemer <gri@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.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go index 27405d8f41..fc4b228e33 100644 --- a/src/cmd/compile/internal/types2/subst.go +++ b/src/cmd/compile/internal/types2/subst.go @@ -146,7 +146,7 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslis // 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 base, isPtr := deref(targ); isPtr && base.TypeParam() != nil { + if base, isPtr := deref(targ); isPtr && asTypeParam(base) != nil { check.errorf(pos, "%s has no methods", targ) break } @@ -179,7 +179,7 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslis // If targ is itself a type parameter, each of its possible types, but at least one, must be in the // list of iface types (i.e., the targ type list must be a non-empty subset of the iface types). - if targ := targ.TypeParam(); targ != nil { + if targ := asTypeParam(targ); targ != nil { targBound := targ.Bound() if targBound.allTypes == nil { check.softErrorf(pos, "%s does not satisfy %s (%s has no type constraints)", targ, tpar.bound, targ) |