Text file src/go/types/testdata/fixedbugs/issue39680.go2

     1  // Copyright 2020 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  // Embedding stand-alone type parameters is not permitted for now. Disabled.
     8  
     9  /*
    10  import "fmt"
    11  
    12  // Minimal test case.
    13  func _[T interface{~T}](x T) T{
    14  	return x
    15  }
    16  
    17  // Test case from issue.
    18  type constr[T any] interface {
    19  	~T
    20  }
    21  
    22  func Print[T constr[T]](s []T) {
    23  	for _, v := range s {
    24  		fmt.Print(v)
    25  	}
    26  }
    27  
    28  func f() {
    29  	Print([]string{"Hello, ", "playground\n"})
    30  }
    31  */
    32  

View as plain text