aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/subst.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-05-27 22:09:58 -0700
committerRobert Griesemer <gri@golang.org>2021-06-02 23:19:27 +0000
commit3c1d502a19dcdaaf0f7ddf58ccad9953fe5d92d1 (patch)
treea1dc7779abe65bab182f3d2464e0c1cb6b0e9d27 /src/cmd/compile/internal/types2/subst.go
parent848b58e47357965dc5a61fb0ae5535da717e2633 (diff)
downloadgo-3c1d502a19dcdaaf0f7ddf58ccad9953fe5d92d1.tar.gz
go-3c1d502a19dcdaaf0f7ddf58ccad9953fe5d92d1.zip
[dev.typeparams] cmd/compile/internal/types2: eliminate need for unpack and asUnion functions
Change-Id: Iaa75b091d52f44939330e5945305aea323ba58f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/323355 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: 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.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go
index 617a03ddbc..35ca197d64 100644
--- a/src/cmd/compile/internal/types2/subst.go
+++ b/src/cmd/compile/internal/types2/subst.go
@@ -194,14 +194,15 @@ func (check *Checker) satisfies(pos syntax.Pos, targ Type, tpar *TypeParam, smap
check.softErrorf(pos, "%s does not satisfy %s (%s has no type constraints)", targ, tpar.bound, targ)
return false
}
- for _, t := range unpack(targBound.allTypes) {
- if !iface.isSatisfiedBy(t) {
+ return iface.is(func(typ Type, tilde bool) bool {
+ // TODO(gri) incorporate tilde information!
+ if !iface.isSatisfiedBy(typ) {
// TODO(gri) match this error message with the one below (or vice versa)
- check.softErrorf(pos, "%s does not satisfy %s (%s type constraint %s not found in %s)", targ, tpar.bound, targ, t, iface.allTypes)
+ check.softErrorf(pos, "%s does not satisfy %s (%s type constraint %s not found in %s)", targ, tpar.bound, targ, typ, iface.allTypes)
return false
}
- }
- return false
+ return true
+ })
}
// Otherwise, targ's type or underlying type must also be one of the interface types listed, if any.