aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/typecheck/iexport.go
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-05-10 16:23:35 -0700
committerDan Scales <danscales@google.com>2021-05-21 23:13:46 +0000
commit8d2b4cb6cc3100f337e08cc7342f42823fa1dc9a (patch)
tree4eb794e8e1cf3f0235d4f13f659cbb52f45e2979 /src/cmd/compile/internal/typecheck/iexport.go
parent626e89c261297d13ef892bb569640cd72c35b98a (diff)
downloadgo-8d2b4cb6cc3100f337e08cc7342f42823fa1dc9a.tar.gz
go-8d2b4cb6cc3100f337e08cc7342f42823fa1dc9a.zip
[dev.typeparams] cmd/compile: fixing import of comm clauses/closures in generic functions
Improvements: - Fix export/import of the default case of a select statement (was not dealing with nil Comm case) - Set properly the name of closure functions in imported generic functions Added new test exporting/importing a reasonably large channel package, chansimp.go. Change-Id: If2ee12bd749e5df415f48ec4b629a2fa68a79dcb Reviewed-on: https://go-review.googlesource.com/c/go/+/321734 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Trust: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/typecheck/iexport.go')
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 802a8c3839..d956ada3c5 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -1523,7 +1523,12 @@ func (w *exportWriter) commList(cases []*ir.CommClause) {
w.uint64(uint64(len(cases)))
for _, cas := range cases {
w.pos(cas.Pos())
- w.node(cas.Comm)
+ defaultCase := cas.Comm == nil
+ w.bool(defaultCase)
+ if !defaultCase {
+ // Only call w.node for non-default cause (cas.Comm is non-nil)
+ w.node(cas.Comm)
+ }
w.stmtList(cas.Body)
}
}