1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:44:41 -07:00
go/test/fixedbugs/issue53635.go
Cuong Manh Le 14abe8aa73 cmd/compile: don't convert to interface{} for un-comparable types in generic switch
Fixes #53635

Change-Id: I41f383be8870432fc0d29fa83687911ddd8217f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/415634
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-07-08 12:57:49 +00:00

32 lines
423 B
Go

// run
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func main() {
f[int]()
}
func f[T any]() {
switch []T(nil) {
case nil:
default:
panic("FAIL")
}
switch (func() T)(nil) {
case nil:
default:
panic("FAIL")
}
switch (map[int]T)(nil) {
case nil:
default:
panic("FAIL")
}
}