1
0
mirror of https://github.com/golang/go synced 2024-11-15 02:30:31 -07:00

cmd/compile/internal/types2: revert to three-phase alias resolution

This change reenables the legacy three-phase resolution
(non-alias typenames, aliases, the rest) even when
GODEBUG=gotypesalias=1. Unfortunately the existing test case
for #50259 causes the simpler logic to fail.

Updates #50259
Updates #65294

Change-Id: Ibfaf8146e46760718673a916a9b220a9d678409a
Reviewed-on: https://go-review.googlesource.com/c/go/+/577616
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Alan Donovan 2024-04-09 12:42:37 -04:00
parent ecfddf4841
commit a555ac6332

View File

@ -677,8 +677,23 @@ func (check *Checker) packageObjects() {
}
}
if check.enableAlias {
if false && check.enableAlias {
// With Alias nodes we can process declarations in any order.
//
// TODO(adonovan): unfortunately, Alias nodes
// (GODEBUG=gotypesalias=1) don't entirely resolve
// problems with cycles. For example, in
// GOROOT/test/typeparam/issue50259.go,
//
// type T[_ any] struct{}
// type A T[B]
// type B = T[A]
//
// TypeName A has Type Named during checking, but by
// the time the unified export data is written out,
// its Type is Invalid.
//
// Investigate and reenable this branch.
for _, obj := range objList {
check.objDecl(obj, nil)
}