diff options
author | Robert Griesemer <gri@golang.org> | 2021-07-28 16:58:57 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-07-29 21:05:49 +0000 |
commit | 5ecbd811b54f478244b7e54a621f32b5b8e3ea95 (patch) | |
tree | e6956a23dd26c301bf7660634118b865d760eaec /src/cmd/compile/internal/types2/instantiate.go | |
parent | 46cc68638143770206e0894add7021990a9bec52 (diff) | |
download | go-5ecbd811b54f478244b7e54a621f32b5b8e3ea95.tar.gz go-5ecbd811b54f478244b7e54a621f32b5b8e3ea95.zip |
[dev.typeparams] cmd/compile/internal/types2: (TypeParam) SetBound -> SetConstraint
This matches the accessor named Constraint, and any documentation we have so far.
Use iface instead of Bound internally to types2; keep Bound because of two external
uses but mark it as deprecated. Adjust clients.
Change-Id: Id1a2c2f28259a16082e875eee0534d46cf157336
Reviewed-on: https://go-review.googlesource.com/c/go/+/338196
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/instantiate.go')
-rw-r--r-- | src/cmd/compile/internal/types2/instantiate.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/types2/instantiate.go b/src/cmd/compile/internal/types2/instantiate.go index 9f9f8a7f5d3..357f041c466 100644 --- a/src/cmd/compile/internal/types2/instantiate.go +++ b/src/cmd/compile/internal/types2/instantiate.go @@ -160,7 +160,7 @@ func (check *Checker) verify(pos syntax.Pos, tparams []*TypeName, targs []Type, // A suitable error is reported if the result is false. // TODO(gri) This should be a method of interfaces or type sets. func (check *Checker) satisfies(pos syntax.Pos, targ Type, tpar *TypeParam, smap *substMap) bool { - iface := tpar.Bound() + iface := tpar.iface() if iface.Empty() { return true // no type bound } @@ -174,7 +174,7 @@ func (check *Checker) satisfies(pos syntax.Pos, targ Type, tpar *TypeParam, smap // if iface is comparable, targ must be comparable // TODO(gri) the error messages needs to be better, here if iface.IsComparable() && !Comparable(targ) { - if tpar := asTypeParam(targ); tpar != nil && tpar.Bound().typeSet().IsTop() { + if tpar := asTypeParam(targ); tpar != nil && tpar.iface().typeSet().IsTop() { check.softErrorf(pos, "%s has no constraints", targ) return false } @@ -219,7 +219,7 @@ func (check *Checker) satisfies(pos syntax.Pos, targ Type, tpar *TypeParam, smap // 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 := asTypeParam(targ); targ != nil { - targBound := targ.Bound() + targBound := targ.iface() if targBound.typeSet().types == nil { check.softErrorf(pos, "%s does not satisfy %s (%s has no type constraints)", targ, tpar.bound, targ) return false |