Source file test/typeparam/issue48047.go
1 // run 2 3 // Copyright 2021 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package main 8 9 type A[T any] struct { 10 field B[T] 11 } 12 13 type B[T any] interface { 14 Work(T) 15 } 16 17 func (a *A[T]) Work(t T) { 18 a.field.Work(t) 19 } 20 21 type BImpl struct{} 22 23 func (b BImpl) Work(s string) {} 24 25 func main() { 26 a := &A[string]{ 27 field: BImpl{}, 28 } 29 a.Work("") 30 } 31