Source file test/typeparam/issue49497.dir/a.go

     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 a
     6  
     7  func F[T any]() A[T] {
     8  	var x A[T]
     9  	return x
    10  }
    11  
    12  type A[T any] struct {
    13  	b B[T]
    14  }
    15  
    16  func (a A[T]) M() C[T] {
    17  	return C[T]{
    18  		B: a.b,
    19  	}
    20  }
    21  
    22  type B[T any] struct{}
    23  
    24  type C[T any] struct {
    25  	B B[T]
    26  }
    27  

View as plain text