test/typeparam/issue54302.dir/a.go
raw| 1 | // Copyright 2022 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package a |
| 6 | |
| 7 | func A() { |
| 8 | B[int](new(G[int])) |
| 9 | } |
| 10 | |
| 11 | func B[T any](iface interface{ M(T) }) { |
| 12 | x, ok := iface.(*G[T]) |
| 13 | if !ok || iface != x { |
| 14 | panic("FAIL") |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | type G[T any] struct{} |
| 19 | |
| 20 | func (*G[T]) M(T) {} |