-
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/internal/types2: unify.go:449: assertion failed, panic #67872
Comments
CC @golang/compiler |
This seems new in Go 1.23. |
These assertion failures should be improved to at least report the line number of the source code causing the assertion. That would let users try to trim down the code to a repro case. As it is, all they get is "somewhere there is a problem". As the FAQ says, "[Assertions] are undeniably convenient, but our experience has been that programmers use them as a crutch to avoid thinking about proper error handling and reporting. Proper error handling means that servers continue to operate instead of crashing after a non-fatal error. Proper error reporting means that errors are direct and to the point, saving the programmer from interpreting a large crash trace. Precise errors are particularly important when the programmer seeing the errors is not familiar with the code." The compiler needs to do better here. |
Similar Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
I was able to isolate the panic to a single private file which I emailed to Russ and Michael. |
@kevinburke Hi Kevin, can you please share the single private file with me (gri@golang.org). I introduced the offending assert. Thanks. |
@kevinburke No need for the private file anymore. Reproducer: package p
type A = uint8
type E uint8
func f[P A](P) {}
func g(e E) {
f(e)
} |
Change https://go.dev/cl/591975 mentions this issue: |
@kevinburke I am fairly certain the above CL fixes the issue you see in your larger program (it was a bug in the type unifier) - but please check as soon as this issue is closed (and thus the fix is submitted), thanks. I have only verified for the simplified reproducer. |
@rsc Filed #67932 to address #67872 (comment) (we were planning to do this a while ago but never quite got around to it). |
Confirmed no more panic! Vet completes successfully. Thanks for the fast fix. |
Go version
go version devel go1.23-cf501e05e1 Thu Jun 6 21:59:21 2024 +0000 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Attempted to run "go vet" or "golangci-lint" on company source code
What did you see happen?
I got the following stack trace. Unfortunately, I don't have time to dig into it or try to bisect the problem, but maybe the stack trace is enough of a clue.
What did you expect to see?
I expected to see vet emit output. I cannot reproduce the problem with Go 1.22.
The text was updated successfully, but these errors were encountered: