aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iexport.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-04-14 09:34:17 -0700
committerDan Scales <danscales@google.com>2021-05-21 04:03:26 +0000
commit7b3ee6102d4690c768a7a4b303a89f3f8c811124 (patch)
tree5eb0be60a9203839698d2cf76eac4b8c5c188f0f /src/cmd/compile/internal/typecheck/iexport.go
parent15ad61aff5e6b7774101483a933b3d975ae9bae8 (diff)
downloadgo-7b3ee6102d4690c768a7a4b303a89f3f8c811124.tar.gz
go-7b3ee6102d4690c768a7a4b303a89f3f8c811124.zip
[dev.typeparams] cmd/compile: move to new export version, keep reading previous version
I added constants for the previous export versions, and for the final generics export version. I also added a const for the current export version. We can increment the current export version for unstable changes in dev.typeparams, and eventally set it back to the generics version (2) before release. Added the same constants in typecheck/iexport.go, importer/iimport.go, and gcimporter/iimport.go, must be kept in sync. Put in the needed conditionals to be able to read old versions. Added new export/import test listimp.dir. Change-Id: I166d17d943e07951aa752562e952b067704aeeca Reviewed-on: https://go-review.googlesource.com/c/go/+/319931 Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iexport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 11b9755148..e6813adbf9 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -223,9 +223,17 @@ import (
)
// Current indexed export format version. Increase with each format change.
-// 1: added column details to Pos
// 0: Go1.11 encoding
-const iexportVersion = 1
+// 1: added column details to Pos
+// 2: added information for generic function/types (currently unstable)
+const (
+ iexportVersionGo1_11 = 0
+ iexportVersionPosCol = 1
+ iexportVersionGenerics = 2
+
+ // Start of the unstable series of versions, remove "+ n" before release.
+ iexportVersionCurrent = iexportVersionGenerics + 1
+)
// predeclReserved is the number of type offsets reserved for types
// implicitly declared in the universe block.
@@ -297,7 +305,7 @@ func WriteExports(out *bufio.Writer) {
// Assemble header.
var hdr intWriter
hdr.WriteByte('i')
- hdr.uint64(iexportVersion)
+ hdr.uint64(iexportVersionCurrent)
hdr.uint64(uint64(p.strings.Len()))
hdr.uint64(dataLen)