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

go/types, cmd/compile/internal/types2: stack overflow checking recursive generic type #45550

findleyr opened this issue Apr 13, 2021 · 1 comment


Copy link

@findleyr findleyr commented Apr 13, 2021

The type checker does not currently handle invalid recursive constraints very gracefully. Consider the following

type Builder[T interface{ type struct{ Builder[T] } }] struct {}
type myBuilder struct { Builder[myBuilder] }

If the declaration for myBuilder is commented out, we get an error that Builder is not a generic type. If it is uncommented, we get a stack overflow in subst.

We should instead emit an error that this recursive type declaration is invalid.

CC @griesemer

Copy link

@gopherbot gopherbot commented Sep 7, 2021

Change mentions this issue: cmd/compile/internal/types2: handle recursive type parameter constraints


@gopherbot gopherbot closed this in 73a062c Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants