From 0d7dc417eaebd35249994bfd5cf211df9bf457c6 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 5 Aug 2021 13:24:15 -0700 Subject: [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 Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Robert Findley --- src/cmd/compile/internal/types2/subst.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/cmd/compile/internal/types2/subst.go') 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 -- cgit v1.2.3-54-g00ecf