-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: build failed #50660
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
Comments
when i try to fix #50658 , i found this will failed too. |
Probably the same problem as #50658. |
Should this be a "declared but not used" error ? |
@erifan Yes, looks like it. But that is a separate issue. |
@ianlancetaylor If we rule out this problem, then this issue and #50658 seem to be the same, then we can close this. |
The error message here ( |
run example1 success. go/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert/ifaceassert.go Line 98 in 31496cf
but this issue failed in cmd/compile. |
This is a different issue from #50658. In the line I don't think this is valid code with the current spec. Shouldn't it be:
? |
Ah, you're right. Sorry for misunderstanding. This is not a bug. |
Although this is not valid code according to the current spec, but it is clear that the value of T can be inferred under this case statement. So I think it might be more convenient if we make this code valid. Maybe not comparable, but the interface can do it, see https://go.dev/play/p/KqfF-6ElUnR |
While it may be obvious in this case, I think if we were to write down a specification for this feature we'd find that there are many less obvious corner cases, and the resulting behavior may be surprising to users (in short, we'd have to do some sort of unification with types in type lists for type switch cases). My intuition is that it is better to just do the substitution explicitly where necessary, as in writing out |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
no
What did you do?
example1 :
example2:
What did you expect to see?
example1:
go run success!
example2:
go run success!
What did you see instead?
example1:
go run success!
example2:
The text was updated successfully, but these errors were encountered: