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

cmd/go2go: nonsensical recursive type compiles #40884

Open
benjaminjkraft opened this issue Aug 19, 2020 · 0 comments
Open

cmd/go2go: nonsensical recursive type compiles #40884

benjaminjkraft opened this issue Aug 19, 2020 · 0 comments
Assignees
Milestone

Comments

@benjaminjkraft
Copy link

@benjaminjkraft benjaminjkraft commented Aug 19, 2020

Here are two types (playground):

type A[type X] interface{ a(X) }
type B[type X A[B]] interface{ b(X) }

The type A[B] is semantically invalid; B needs to be instantiated. But this seems to be allowed currently.

In fact if we modify A a bit we can even supposedly implement B (playground):

type A[type X] interface{ b(B[X]) }
type B[type X A[B]] interface{ b(X) }
type S struct{}
func (_ S) b(A[int]) {}
var _ B[A[int]] = S{}
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
3 participants
You can’t perform that action at this time.