1 // Copyright 2021 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 p
6
7 type Fooer interface {
8 Foo()
9 }
10
11 type Fooable[F /* ERROR instantiation cycle */ Fooer] struct {
12 ptr F
13 }
14
15 func (f *Fooable[F]) Adapter() *Fooable[*FooerImpl[F]] {
16 return &Fooable[*FooerImpl[F]]{&FooerImpl[F]{}}
17 }
18
19 type FooerImpl[F Fooer] struct {
20 }
21
22 func (fi *FooerImpl[F]) Foo() {}
23
View as plain text