]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix parameterized interfaces
authorKeith Randall <khr@golang.org>
Tue, 24 Aug 2021 21:50:05 +0000 (14:50 -0700)
committerKeith Randall <khr@golang.org>
Fri, 27 Aug 2021 15:03:09 +0000 (15:03 +0000)
commit4f0dedca7141afafbc01be96097570de2da2bdcc
tree2fec8be25a9065d2bd7038ba62645d2c5ae2085e
parent39eb1cc3f4a7d620d3faae139f83e88e652f5d25
cmd/compile: fix parameterized interfaces

type I[T any] interface{}

This is an interface, but it has a type parameter.
We need to distinguish that from an interface that is not parameterized.

That means when doing type substitution on an interface with
parameters, we need to make a new one.

Same for non-empty interfaces. Even if the type parameter is not
used in any method, we sill need to make a new type.

Similar case to tstruct, above.

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