$ go version
go version devel go1.18-3b5eec9370 Fri Jan 14 21:54:39 2022 +0000 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
package p
func f[T any](a T) {
x := 1
z := 3
switch a.(type) {
case int:
println(x)
}
println(z)
}
$ bin/go tool compile t2.go
t2.go:4:2: x declared but not used
t2.go:6:9: cannot use type switch on type parameter value a (variable of type T constrained by any)
What did you expect to see?
Don't output "x declared but not used"
What did you see instead?
It should only output as following : t2.go:6:9: cannot use type switch on type parameter value a (variable of type T constrained by any)
The text was updated successfully, but these errors were encountered:
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?
What did you expect to see?
Don't output "x declared but not used"
What did you see instead?
It should only output as following :
t2.go:6:9: cannot use type switch on type parameter value a (variable of type T constrained by any)
The text was updated successfully, but these errors were encountered: