-
Notifications
You must be signed in to change notification settings - Fork 18k
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: internal compiler error: assertion failed #53254
Comments
Reproduced at tip. Here is the error message
It appears to be from instantiating a generic function. cc @randall77 |
Here is a simple repro. package main
type Interface[T any] interface {
}
func F[T any]() Interface[T] {
var i int
return i
}
func main() {
F[int]()
} |
Change https://go.dev/cl/410655 mentions this issue: |
@gopherbot please open a backport issue to 1.18. |
Backport issue(s) opened: #53274 (for 1.18). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
I also got the same error. MWE of the code I was working with: package main
import "fmt"
type Interface[K any] interface {
Name() string
}
type interfaceImpl[K any] struct {
name string
}
func (i interfaceImpl[K]) Name() string {
return i.name
}
type Type[T any, K any] struct {
interfaceImpl[K]
}
func main() {
a := Type[int, int]{
interfaceImpl[int]{name: "hello"},
}
printName(a)
}
func printName[T any](k Type[T, int]) {
fmt.Println(k.Name())
} |
@arvidfm I believe this is an another issue because of different stack backtrace. I open a new issue and will mail a fix soon. |
Fixes: golang#53254 Change-Id: I3153d6ebb9f25957b09363f45c5cd4651ee84c2d Reviewed-on: https://go-review.googlesource.com/c/go/+/410655 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?The issue is reproducible at
go env
OutputWhat did you do?
assertion failed
error appears while trying to rungo test ./...
orgo vet ./...
on the library that uses various generic abstraction. It has started to fail at 1.18.3 release but works perfectly with 1.18.1 and also building the library withgo build ./...
works with 1.18.3.You can reproduce an error with following commands
What did you expect to see?
Successful compilation.
What did you see instead?
The error report fails to compile dependency but building that decencies in other context also works fine.
Something fishy is going on... any advice is welcome how to debug this issue!
The text was updated successfully, but these errors were encountered: