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

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Oct 14, 2021

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

@findleyr
Copy link
Contributor

@findleyr findleyr commented Oct 15, 2021

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.

Loading

@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

@griesemer griesemer commented Oct 15, 2021

Premature conclusion. I've adjusted the title.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 17, 2021

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

Loading

@gopherbot gopherbot closed this in 323e009 Oct 18, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 19, 2021

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

Loading

@jkmpariab
Copy link

@jkmpariab jkmpariab commented Oct 19, 2021

@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

Loading

@findleyr
Copy link
Contributor

@findleyr findleyr commented Oct 19, 2021

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

Loading

@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Oct 19, 2021

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants