]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: restore test/nested.go test cases
authorMatthew Dempsky <mdempsky@google.com>
Thu, 18 Aug 2022 18:04:21 +0000 (11:04 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 23 Aug 2022 18:13:38 +0000 (18:13 +0000)
commit72a76ca1f9c195ed39e929cf768d5df5421eada1
treefdfa8c9bdd37fbc89181bdc3df8aa29ef7a5259f
parentc94633d2f89119e0f6788db09bd3df5153243f37
cmd/compile: restore test/nested.go test cases

When handling a type declaration like:

```
type B A
```

unified IR has been writing out that B's underlying type is A, rather
than the underlying type of A.

This is a bit awkward to implement and adds complexity to importers,
who need to handle resolving the underlying type themselves. But it
was necessary to handle when A was declared like:

```
//go:notinheap
type A int
```

Because we expected A's not-in-heap'ness to be conferred to B, which
required knowing that A was on the path from B to its actual
underlying type int.

However, since #46731 was accepted, we no longer need to support this
case. Instead we can write out B's actual underlying type.

One stumbling point though is the existing code for exporting
interfaces doesn't work for the underlying type of `comparable`, which
is now needed to implement `type C comparable`. As a bit of a hack, we
we instead export its underlying type as `interface{ comparable }`.

Fixes #54512.

Change-Id: I0fb892068d656f1e87bb8ef97da27756051126d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/424854
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/noder/writer.go
test/typeparam/nested.go