| // Copyright 2021 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. |
| // Smoke test for constraint literals with elided interface |
| func identity[T int](x T) T { |
| func min[T int | string](x, y T) T { |
| func max[T ~int | ~float64](x, y T) T { |
| panic("identity(1) failed") |
| panic("min(2, 3) failed") |
| if min("foo", "bar") != "bar" { |
| panic(`min("foo", "bar") failed`) |
| panic("max(2, 3) failed") |
| // Some random type parameter lists with elided interfaces. |
| _[M map[K]V, K comparable, V any] struct{} |
| _[_ interface{} | int] struct{} |