github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/compile/importer/testdata/generics.go (about)

     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  // This file is used to generate an object file which
     6  // serves as test file for gcimporter_test.go.
     7  
     8  package generics
     9  
    10  type Any any
    11  
    12  var x any
    13  
    14  type T[A, B any] struct {
    15  	Left  A
    16  	Right B
    17  }
    18  
    19  var X T[int, string] = T[int, string]{1, "hi"}
    20  
    21  func ToInt[P interface{ ~int }](p P) int { return int(p) }
    22  
    23  var IntID = ToInt[int]
    24  
    25  type G[C comparable] int
    26  
    27  func ImplicitFunc[T ~int]() {}
    28  
    29  type ImplicitType[T ~int] int