golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/implementation/generics.txt (about)

     1  Test of 'implementation' query on generic types.
     2  
     3  -- go.mod --
     4  module example.com
     5  go 1.18
     6  
     7  -- implementation/implementation.go --
     8  package implementation
     9  
    10  type GenIface[T any] interface { //@loc(GenIface, "GenIface"),implementation("GenIface", GC)
    11  	F(int, string, T) //@loc(GenIfaceF, "F"),implementation("F", GCF)
    12  }
    13  
    14  type GenConc[U any] int //@loc(GenConc, "GenConc"),implementation("GenConc", GI)
    15  
    16  func (GenConc[V]) F(int, string, V) {} //@loc(GenConcF, "F"),implementation("F", GIF)
    17  
    18  type GenConcString struct{ GenConc[string] } //@loc(GenConcString, "GenConcString"),implementation(GenConcString, GIString)
    19  
    20  -- other/other.go --
    21  package other
    22  
    23  type GI[T any] interface { //@loc(GI, "GI"),implementation("GI", GenConc)
    24  	F(int, string, T) //@loc(GIF, "F"),implementation("F", GenConcF)
    25  }
    26  
    27  type GIString GI[string] //@loc(GIString, "GIString"),implementation("GIString", GenConcString)
    28  
    29  type GC[U any] int //@loc(GC, "GC"),implementation("GC", GenIface)
    30  
    31  func (GC[V]) F(int, string, V) {} //@loc(GCF, "F"),implementation("F", GenIfaceF)