-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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,types2: internal compiler error: panic: cmd/compile/internal/types2/check.go:595: assertion failed #66878
Comments
I'd also request to clarify whether this is indeed an intended syntax [or some sort of typo] |
It is probably confused by the fact that the I believe the syntax your are using is correct, although weird. Probably better (and solves the crash) to do |
Similar: package main
import "fmt"
func foo[T ~bool](m map[int]T) {
var x, ok T = m[0]
fmt.Println(x, ok)
}
func main() {
m := map[int]bool{}
foo(m)
} |
Thanks for taking a look, @randall77 . To be clear I don't actually need a workaround here - I filed an issue because the crash message told me to do so :) (I'm not really writing this code, I was just trying to get this code example from the spec to compile and found this unrelated problem.) |
Minimal reproducer: func _[T bool](ch chan T) {
var _, _ T = <-ch
} |
Change https://go.dev/cl/580075 mentions this issue: |
Go version
go dev branch (for playground)
Output of
go env
in your module/workspace:What did you do?
This program crashes the compiler at the current dev branch in the playground: https://go.dev/play/p/3JI9h22Igk8?v=gotip
(sidenote: I was only trying to get this part of the spec to compile :])
What did you see happen?
Compiler crash
What did you expect to see?
Compiler success or standard error message
The text was updated successfully, but these errors were encountered: