From f73dd8173a2d459113254dbd71d47856b5be0441 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 16 May 2024 14:32:54 -0700 Subject: [PATCH] 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 Auto-Submit: Robert Griesemer Reviewed-by: Alan Donovan Reviewed-by: Robert Griesemer --- src/go/internal/gcimporter/gcimporter_test.go | 11 ----------- src/go/types/resolver.go | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/go/internal/gcimporter/gcimporter_test.go b/src/go/internal/gcimporter/gcimporter_test.go index 51b8dcd155..07ab135186 100644 --- a/src/go/internal/gcimporter/gcimporter_test.go +++ b/src/go/internal/gcimporter/gcimporter_test.go @@ -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) } diff --git a/src/go/types/resolver.go b/src/go/types/resolver.go index 918e18de3e..e6e882e35f 100644 --- a/src/go/types/resolver.go +++ b/src/go/types/resolver.go @@ -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) } -- 2.48.1