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
Assignees
Milestone

Comments

@findleyr
Copy link
Contributor

@findleyr 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

@gopherbot gopherbot commented Sep 22, 2021

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

Loading

@gopherbot gopherbot closed this in 7158ae4 Sep 22, 2021
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
2 participants