Source file test/typeparam/issue47892b.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  type T struct{ p *int64 }
     8  
     9  type i struct{}
    10  
    11  func G() *T { return &T{nil} }
    12  
    13  func (j i) F(a, b *T) *T {
    14  	n := *a.p + *b.p
    15  	return &T{&n}
    16  }
    17  
    18  func (j i) G() *T {
    19  	return &T{}
    20  }
    21  
    22  type I[Idx any] interface {
    23  	G() Idx
    24  	F(a, b Idx) Idx
    25  }
    26  
    27  func Gen() I[*T] {
    28  	return i{}
    29  }
    30  

View as plain text