]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: deal with constructed types that have shapes in them
authorDan Scales <danscales@google.com>
Wed, 23 Feb 2022 05:41:43 +0000 (21:41 -0800)
committerDan Scales <danscales@google.com>
Mon, 28 Feb 2022 19:38:22 +0000 (19:38 +0000)
commiteb8198d2f67477517e7a735faa49dfd7c0fb3622
tree1d1be3a8e857f3d0780ff5e425534be9fd5faee9
parentb33592dcfd2c8cf1e574531ecb49af7755864e82
cmd/compile: deal with constructed types that have shapes in them

We convert type args to shape types inside instantiations. If an
instantiation constructs a compound type based on that shape type and
uses that as a type arg to another generic function being called, then
we have a type arg with a shape type embedded inside of it. In that
case, we need to substitute out those embedded shape types with their
underlying type.

If we don't do this, we may create extra unneeded shape types that
have these other shape types embedded in them. This may lead to
generating extra shape instantiations, and a mismatch between the
instantiations that we used in generating dictionaries and the
instantations that are actually called.

Updates #51303

Change-Id: Ieef894a5fac176cfd1415f95926086277ad09759
Reviewed-on: https://go-review.googlesource.com/c/go/+/387674
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/typecheck/subr.go
test/typeparam/issue51303.go [new file with mode: 0644]
test/typeparam/issue51303.out [new file with mode: 0644]