-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: wrong panic message for method call on nil of generic interface type #51521
Comments
Another failure case, but this one currently fails to link due to
|
Change https://go.dev/cl/390356 mentions this issue: |
The test case is already working with unified IR, so add it to make sure we don't regress while finishing unified IR's support for dictionaries. Updates #51521. Change-Id: Ib7c8bf9612d30cd552e8e631fd0d487dcb177f14 Reviewed-on: https://go-review.googlesource.com/c/go/+/390356 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Rolling forward to 1.20 as it should be fixed by unified IR. Please comment if you disagree. Thanks. |
This is fixed with GOEXPERIMENT=unified, which will be enabled by default in 1.20. |
The program below currently prints
FAIL interface conversion: interface is nil, not main.I
and exits with failure when built with cmd/compile. I think this is incorrect, as there's no type assertion in the user code.I believe the correct behavior is the method call
p.M()
should raise a "nil pointer dereference" panic, and so the test program should quietly exit with success.This isn't a spec compliance issue per se, as the Go spec doesn't mandate any particular panic messages. But it is inconsistent with the documentation for package runtime.
Marking for Go 1.19, because I doubt this affects any real users.
/cc @griesemer @ianlancetaylor @randall77
The text was updated successfully, but these errors were encountered: