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: generic function appears to use incorrect type descriptor #52026
Comments
Since you are returning a generic type from your returnOption function, go would expect None to be generic as well. If you do change it to None[T], it seems to work for me :) At least that is a possible solution to the problem. |
It is really a bug. It looks the problem is gone if the line |
https://gotipplay.golang.org/p/p-xVGVKSW10 switch (any)(s).(type) { |
Change https://go.dev/cl/401034 mentions this issue: |
@gopherbot please open a backport issue for 1.18. |
Backport issue(s) opened: #52691 (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. |
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
)?go env
OutputWhat did you do?
Go 2 Playground Link
What did you expect to see?
Type assertion to
None
returnstrue
.Type Switch prints
s is a None
.What did you see instead?
Type assertion to
None
returnedfalse
.Type Switch prints
oops
.The text was updated successfully, but these errors were encountered: