Source file
test/fixedbugs/issue81089.go
1
2
3
4
5
6
7 package main
8
9 type Conn interface{ Hello() }
10 type Pool[T Conn] struct{}
11
12 func (p *Pool[T]) Hello(conn T) { conn.Hello() }
13
14 type PoolConn struct{ Conn }
15 type CustomConn struct{}
16
17 func (p CustomConn) Hello() { called = true }
18
19 func NewPool[T Conn]() *Pool[T] { return &Pool[T]{} }
20
21 var called bool
22
23 func main() {
24 NewPool[*PoolConn]().Hello(&PoolConn{Conn: CustomConn{}})
25 if !called {
26 panic("the embedded interface method Hello was not called")
27 }
28 }
29
View as plain text