Skip to content

Commit a555ac6

Browse files
committed
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent ecfddf4 commit a555ac6

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/cmd/compile/internal/types2/resolver.go

+16-1
Original file line numberDiff line numberDiff line change
@@ -677,8 +677,23 @@ func (check *Checker) packageObjects() {
677677
}
678678
}
679679

680-
if check.enableAlias {
680+
if false && check.enableAlias {
681681
// With Alias nodes we can process declarations in any order.
682+
//
683+
// TODO(adonovan): unfortunately, Alias nodes
684+
// (GODEBUG=gotypesalias=1) don't entirely resolve
685+
// problems with cycles. For example, in
686+
// GOROOT/test/typeparam/issue50259.go,
687+
//
688+
// type T[_ any] struct{}
689+
// type A T[B]
690+
// type B = T[A]
691+
//
692+
// TypeName A has Type Named during checking, but by
693+
// the time the unified export data is written out,
694+
// its Type is Invalid.
695+
//
696+
// Investigate and reenable this branch.
682697
for _, obj := range objList {
683698
check.objDecl(obj, nil)
684699
}

0 commit comments

Comments
 (0)