]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: fix export/import of constants with typeparam type
authorDan Scales <danscales@google.com>
Wed, 2 Jun 2021 07:03:25 +0000 (00:03 -0700)
committerDan Scales <danscales@google.com>
Wed, 2 Jun 2021 23:10:42 +0000 (23:10 +0000)
commit97cb0113a358a24931bc91c956da0cb023f2776c
tree0baa45bac527ebaecc3b0eee3e1de3ac53b4cca1
parent6b1cdeaef3099b32d244cef7bb5adc4d7b7628fc
[dev.typeparams] cmd/compile: fix export/import of constants with typeparam type

A constant will have a TYPEPARAM type if it appears in a place where it
must match that typeparam type (e.g. in a binary operation with a
variable of that typeparam type). If so, then we must write out its
actual constant kind as well, so its constant val can be read in
properly during import.

Fixed some export/import tests which were casting some untyped constants
to avoid this problem.

Change-Id: I285ad8f1c8febbe526769c96e6b27acbd23050f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/324189
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/typecheck/iexport.go
src/cmd/compile/internal/typecheck/iimport.go
test/typeparam/fact.go
test/typeparam/factimp.dir/a.go
test/typeparam/listimp.dir/a.go