-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/compile: panics with generic type alias and based-on constraint #68580
Comments
Reproduced at 1.23rc2. Interestingly, the code typechecks fine when checked by the typechecker alone. |
Reduced example: https://go.dev/play/p/X9GxAbUdgeA?v=gotip |
Simpler reproducer (link): package main
type A[P any] = struct{ _ P }
type N[P any] A[P]
func f[P any](N[P]) {}
var _ = f[int] |
Change https://go.dev/cl/601115 mentions this issue: |
@griesemer Do we need to backport this to 1.23? |
@gopherbot please backport this issue to go1.23 |
Backport issue(s) opened: #68608 (for 1.23). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
@cuonglm Yes, we should backport this. I believe an issue is not needed per @dmitshur 's e-mail:
|
Change https://go.dev/cl/601116 mentions this issue: |
…type with generic alias The typechecker is assuming that alias instances cannot be reached from a named type. However, when type parameters on aliases are permited, it can happen. This CL changes the typechecker to propagate the correct named instance is being expanded. Updates #46477 Fixes #68580 Change-Id: Id0879021f4640c0fefe277701d5096c649413811 Reviewed-on: https://go-review.googlesource.com/c/go/+/601115 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/601116
Go version
1.23rc1
Output of
go env
in your module/workspace:What did you do?
https://go.dev/play/p/kMvT8_f91aK?v=gotip
What did you see happen?
: internal compiler error: panic: /usr/local/go/src/cmd/compile/internal/types2/subst.go:56: assertion failed
etc.
What did you expect to see?
no panic
The text was updated successfully, but these errors were encountered: