aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iimport.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-08-09 16:00:29 -0700
committerDan Scales <danscales@google.com>2021-08-10 19:48:58 +0000
commit40ba119e3f990fd570ec928307e92a5b6a76bd0e (patch)
treea0f197d224c6a95e4f96bb4a5e5693679f59a48c /src/cmd/compile/internal/typecheck/iimport.go
parentfb8579746c9de74a6faa70de544286e45bc8386e (diff)
downloadgo-40ba119e3f990fd570ec928307e92a5b6a76bd0e.tar.gz
go-40ba119e3f990fd570ec928307e92a5b6a76bd0e.zip
[dev.typeparams] cmd/compile: keep export format unchanged if no type params are exported
Added new export tags 'G' and 'U' to export parameterized functions/methods and parameterized types respectively. This has the advantage that the Go 1.18 format remains backward-compatible with the Go 1.17 format if no type parameters are exported. Change-Id: I9dba8faaa65609eb3f9c693bd0c79daee98bd865 Reviewed-on: https://go-review.googlesource.com/c/go/+/340989 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iimport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iimport.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index d5f4bba98b..83974b6d56 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -305,9 +305,9 @@ func (r *importReader) doDecl(sym *types.Sym) *ir.Name {
r.constExt(n)
return n
- case 'F':
+ case 'F', 'G':
var tparams []*types.Field
- if r.p.exportVersion >= iexportVersionGenerics {
+ if tag == 'G' {
tparams = r.tparamList()
}
typ := r.signature(nil, tparams)
@@ -316,9 +316,9 @@ func (r *importReader) doDecl(sym *types.Sym) *ir.Name {
r.funcExt(n)
return n
- case 'T':
+ case 'T', 'U':
var rparams []*types.Type
- if r.p.exportVersion >= iexportVersionGenerics {
+ if tag == 'U' {
rparams = r.typeList()
}
@@ -326,7 +326,7 @@ func (r *importReader) doDecl(sym *types.Sym) *ir.Name {
// declaration before recursing.
n := importtype(pos, sym)
t := n.Type()
- if rparams != nil {
+ if tag == 'U' {
t.SetRParams(rparams)
}