Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types2, go/types: type-checking expands type forever #48974

Closed
griesemer opened this issue Oct 14, 2021 · 7 comments
Closed

types2, go/types: type-checking expands type forever #48974

griesemer opened this issue Oct 14, 2021 · 7 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@griesemer
Copy link
Contributor

This is from a comment in #48951, reported by @jkmpariab. Reproducer:

package p

type Fooer interface {
	Foo()
}

type Fooable[F Fooer] struct {
	ptr F
}

func (f *Fooable[F]) Adapter() *Fooable[*FooerImpl[F]] {
	return &Fooable[*FooerImpl[F]]{&FooerImpl[F]{}}
}

//
// By removing the 'F Fooer' type param, program compiles sucessfully
//            |||||||||
//            vvvvvvvvv
type FooerImpl[F Fooer] struct {
}

func (fi *FooerImpl[F]) Foo() {}

cc: @findleyr

@griesemer griesemer added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Oct 14, 2021
@griesemer griesemer added this to the Go1.18 milestone Oct 14, 2021
@griesemer griesemer self-assigned this Oct 14, 2021
@findleyr
Copy link
Contributor

Hmm, why exactly is this package invalid? Looks ok to me, and a fix I'm working on for another recursive case makes this type-check without error.

@findleyr findleyr assigned findleyr and unassigned griesemer Oct 15, 2021
@griesemer griesemer changed the title types2, go/types: type-checking expands invalid recursive type forever types2, go/types: type-checking expands type forever Oct 15, 2021
@griesemer
Copy link
Contributor Author

Premature conclusion. I've adjusted the title.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/356490 mentions this issue: go/types: ensure named types are expanded after type-checking

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/356515 mentions this issue: cmd/compile/internal/types2: ensure named types are expanded after type-checking

@jkmpariab
Copy link

@griesemer The issue is not fixed yet. i'm testing on

go version devel go1.18-bde0463da3 Tue Oct 19 11:52:34 2021 +0000 linux/amd64

please reopen the issue

@findleyr
Copy link
Contributor

The issue was closed when the change went in to go/types. It will be fixed in the compiler with the CL above.

@griesemer
Copy link
Contributor Author

This is now fixed in the type-checkers, but the compiler still has an issue. Filed separate #49068 for that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants