blob: 3ca832281fb137c60e408af610b9c3bb6f3283f3 [file]
// compile
// Copyright 2026 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
import "reflect"
type E struct{}
func (E) M() {}
func g(x struct{ a, b int }) {
reflect.ValueOf(x)
}
func gEmbedded(x struct {
E
b int
}) {
reflect.ValueOf(x)
}
func f[T any](i interface{}) {
switch i.(type) {
case T:
case struct{ a, b T }:
}
}
func fEmbedded[T any](i interface{}) {
switch i.(type) {
case T:
case struct {
E
b T
}:
}
}
func main() {
f[int](0)
f[any](0)
fEmbedded[int](0)
fEmbedded[any](0)
}