From 08588e60362bbd2f71235ed8e6d2a55bb42908fa Mon Sep 17 00:00:00 2001 From: Robert Findley Date: Thu, 2 Sep 2021 10:36:37 -0400 Subject: [PATCH] go/internal/gcimporter: always call SetTParams, even if empty This resolves an outstanding TODO to be consistent about calling SetTParams. Done in both go/internal/gcimporter and cmd/compile/internal/importer. Change-Id: Ief642efe016f02bab1bab960f6731a0ac0a8ad28 Reviewed-on: https://go-review.googlesource.com/c/go/+/347389 Trust: Robert Findley Run-TryBot: Robert Findley TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- src/cmd/compile/internal/importer/iimport.go | 4 +--- src/go/internal/gcimporter/iimport.go | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cmd/compile/internal/importer/iimport.go b/src/cmd/compile/internal/importer/iimport.go index c303126ea6..38cb8db235 100644 --- a/src/cmd/compile/internal/importer/iimport.go +++ b/src/cmd/compile/internal/importer/iimport.go @@ -327,9 +327,7 @@ func (r *importReader) obj(name string) { // declaration before recursing. obj := types2.NewTypeName(pos, r.currPkg, name, nil) named := types2.NewNamed(obj, nil, nil) - if tag == 'U' { - named.SetTParams(tparams) - } + named.SetTParams(tparams) r.declare(obj) underlying := r.p.typAt(r.uint64(), named).Underlying() diff --git a/src/go/internal/gcimporter/iimport.go b/src/go/internal/gcimporter/iimport.go index 444cf3b0d4..3571941d04 100644 --- a/src/go/internal/gcimporter/iimport.go +++ b/src/go/internal/gcimporter/iimport.go @@ -317,10 +317,7 @@ func (r *importReader) obj(name string) { // declaration before recursing. obj := types.NewTypeName(pos, r.currPkg, name, nil) named := types.NewNamed(obj, nil, nil) - // TODO(rfindley): guarding on tag == 'U' should not be necessary here. - if tag == 'U' { - named.SetTParams(tparams) - } + named.SetTParams(tparams) r.declare(obj) underlying := r.p.typAt(r.uint64(), named).Underlying() -- 2.50.0