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: panic in instance with invalid recursive constraint #48529

Closed
findleyr opened this issue Sep 22, 2021 · 1 comment
Closed

go/types: panic in instance with invalid recursive constraint #48529

findleyr opened this issue Sep 22, 2021 · 1 comment

Comments

@findleyr
Copy link
Contributor

findleyr commented Sep 22, 2021

While looking into #46461, it occurred to me that type-checking the following code will panic:

package p

type T[U interface{ M() T[U, int] }] int

type X T[int]

The reason for this is that, while we get an error for the invalid instantiation T[U, int] while type checking U's constraint, when instantiating T[int] we try to substitute in T[U, int] (at which point we won't have a Checker) (edit: this ended up not being as complicated as initially feared).

Working on a fix. We can perhaps skip substituting *Named types with invalid underlying.

CC @griesemer

@findleyr findleyr added this to the Go1.18 milestone Sep 22, 2021
@findleyr findleyr self-assigned this Sep 22, 2021
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/351337 mentions this issue: go/types: don't panic if targs don't match tparams when substituting

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants