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/compile: compiler panic for generic alias type #68054

Closed
griesemer opened this issue Jun 18, 2024 · 4 comments
Closed

cmd/compile: compiler panic for generic alias type #68054

griesemer opened this issue Jun 18, 2024 · 4 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

From #46477 (comment):

The following code snippet causes the Go compiler to panic (https://go.dev/play/p/PBvqgMjEs4S?v=gotip)

package main

type Seq[V any] = func(yield func(V) bool)

func f[E any](seq Seq[E]) {
	return
}

func main() {
	f(Seq[int](nil))
}

Marking for 1.23 in case it's a trivial oversight that we can easily address. But not a release blocker.

cc: @mdempsky for visibility. This looks like a noder issue.

@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 18, 2024
@griesemer griesemer added this to the Go1.23 milestone Jun 18, 2024
@griesemer griesemer self-assigned this Jun 18, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jun 18, 2024
@gabyhelp
Copy link

Similar Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@Carrotman42
Copy link

Possibly related to this minimal repro I was just devising:

package main

type OVal[O any] struct {}

type TVal[T any] = OVal[T]

var x TVal[bool]

func main() {}

The panic is the same index out of range [0] with length 0 message.

(sorry for the noise if not - I can file a new issue if desired)

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/593715 mentions this issue: cmd/compile: support generic alias type

@cuonglm cuonglm self-assigned this Jun 20, 2024
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jun 20, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/593797 mentions this issue: [release-branch.go1.23] cmd/compile: support generic alias type

gopherbot pushed a commit that referenced this issue Jun 20, 2024
Type parameters on aliases are now allowed after #46477 accepted.

Updates #46477
Fixes #68054

Change-Id: Ic2e3b6f960a898163f47666e3a6bfe43b8cc22e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/593715
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/593797
Reviewed-by: Michael Pratt <mpratt@google.com>
Mchnan pushed a commit to Mchnan/go-sylixos that referenced this issue Jul 9, 2024
Type parameters on aliases are now allowed after golang#46477 accepted.

Updates golang#46477
Fixes golang#68054

Change-Id: Ic2e3b6f960a898163f47666e3a6bfe43b8cc22e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/593715
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants