go/types: re-enable suppressed gcimporter tests

Port CL 577616 from types2 to go/types allows us
to re-enable these tests.

Fixes #66859.
Fixes #67436.
Updates #50259.
Updates #65294.

Change-Id: I573e51cf16546ac1c115beac5322b51dd998c881
Reviewed-on: https://go-review.googlesource.com/c/go/+/586236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
Robert Griesemer 2024-05-16 14:32:54 -07:00 committed by Gopher Robot
parent a61729b880
commit f73dd8173a
2 changed files with 16 additions and 12 deletions

View File

@ -7,7 +7,6 @@ package gcimporter_test
import (
"bytes"
"fmt"
"internal/godebug"
"internal/testenv"
"os"
"os/exec"
@ -205,16 +204,6 @@ func TestImportTypeparamTests(t *testing.T) {
want := types.ObjectString(checkedObj, types.RelativeTo(checked))
want = sanitizeObjectString(want)
// TODO(golang/go#66859): investigate and reenable these tests,
// which fail with gotypesalias=1, soon to be the default.
if godebug.New("gotypesalias").Value() != "0" {
symbol := name + " in " + filepath.Base(filename)
switch symbol {
case "Eint2 in struct.go", "A in issue50259.go":
t.Skipf("%s requires gotypesalias=1", symbol)
}
}
if got != want {
t.Errorf("imported %q as %q, want %q", name, got, want)
}

View File

@ -665,8 +665,23 @@ func (check *Checker) packageObjects() {
}
}
if check.conf._EnableAlias {
if false && check.conf._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)
}