Source file test/typeparam/issue48344.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 G[T any] interface {
    10  	g()
    11  }
    12  
    13  type Foo[T any] struct {
    14  }
    15  
    16  func (foo *Foo[T]) g() {
    17  
    18  }
    19  
    20  func f[T any]() {
    21  	v := []G[T]{}
    22  	v = append(v, &Foo[T]{})
    23  }
    24  func main() {
    25  	f[int]()
    26  }
    27  

View as plain text