aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/subst.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-08-05 13:24:15 -0700
committerRobert Griesemer <gri@golang.org>2021-08-06 20:34:51 +0000
commit0d7dc417eaebd35249994bfd5cf211df9bf457c6 (patch)
treea97725bf356d9d5c20da6f3b8d55b49f3f0dfb17 /src/cmd/compile/internal/types2/subst.go
parent09d82689ed899d601a9f4b5615d67025dcdb958b (diff)
downloadgo-0d7dc417eaebd35249994bfd5cf211df9bf457c6.tar.gz
go-0d7dc417eaebd35249994bfd5cf211df9bf457c6.zip
[dev.typeparams] cmd/compile: change types2.Union API to accept a list of Terms
Instead of providing a list of tildes and types, use a list of Terms to create a Union, with suitable accessors. Define the (exported) notion of a Term representing a union term. This simplified various uses and also will be easier to extend should we want to add more information to a Term in the future. Change-Id: I52fd73938bfa11bac60adbf10580b6d0680df4f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/340250 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.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go
index 6c5f756491..26796fc604 100644
--- a/src/cmd/compile/internal/types2/subst.go
+++ b/src/cmd/compile/internal/types2/subst.go
@@ -387,19 +387,19 @@ func (subst *subster) typeList(in []Type) (out []Type, copied bool) {
return
}
-func (subst *subster) termlist(in []*term) (out []*term, copied bool) {
+func (subst *subster) termlist(in []*Term) (out []*Term, copied bool) {
out = in
for i, t := range in {
if u := subst.typ(t.typ); u != t.typ {
if !copied {
// first function that got substituted => allocate new out slice
// and copy all functions
- new := make([]*term, len(in))
+ new := make([]*Term, len(in))
copy(new, out)
out = new
copied = true
}
- out[i] = &term{t.tilde, u}
+ out[i] = NewTerm(t.tilde, u)
}
}
return