go icon indicating copy to clipboard operation
go copied to clipboard

go/internal/gcimporter: fix suppressed gotypesalias=1 tests

Open adonovan opened this issue 1 year ago • 4 comments

https://go.dev/cl/577715 appears to have broken three "long" tests in go/internal/gcimporter. The quick fix is to disable them; this issue tracks a principled fix.

--- FAIL: TestImportTypeparamTests (69.39s)
--- FAIL: TestImportTypeparamTests/issue50259.go (0.04s)
    gcimporter_test.go:208: imported "A" as "type A struct{}", want "type A invalid type"
--- FAIL: TestImportTypeparamTests/struct.go (0.35s)
    gcimporter_test.go:208: imported "Eint2" as "type Eint2 = E[int]", want "type Eint2 = Eint"
    gcimporter_test.go:208: imported "S2" as "type S2 struct{E[int]; E[bool]; v string}", want "type S2 struct{Eint; Ebool; v string}"

adonovan avatar Apr 16 '24 20:04 adonovan

Change https://go.dev/cl/579415 mentions this issue: go/internal/gcimporter: suppress 3 test cases when gotypesalias=1

gopherbot avatar Apr 16 '24 20:04 gopherbot

The first error, related to $goroot/test/typeparam/issue50259.go, may possibly be an incorrect type declaration (TBD).

The 2nd and 3rd error, related to $goroot/test/typeparam/struct.go, disappears once the compiler is switched to using Alias types (currently disabled).

griesemer avatar Apr 16 '24 21:04 griesemer

Follow-up: the type declaration in $goroot/test/typeparam/issue50259.go looks valid:

var x T[B]

type T[_ any] struct{}
type A T[B]
type B = T[A]

can be written as

var x T[T[A]]

type T[_ any] struct{}
type A T[T[A]]
type B = T[A]

and since A is not used in T these types are ok.

griesemer avatar Apr 25 '24 22:04 griesemer

Change https://go.dev/cl/586236 mentions this issue: go/types: re-enable suppressed gcimporter tests

gopherbot avatar May 16 '24 21:05 gopherbot