github.com/v2fly/tools@v0.100.0/internal/lsp/testdata/references/interfaces/interfaces.go (about)

     1  package interfaces
     2  
     3  type first interface {
     4  	common() //@mark(firCommon, "common"),refs("common", firCommon, xCommon, zCommon)
     5  	firstMethod() //@mark(firMethod, "firstMethod"),refs("firstMethod", firMethod, xfMethod, zfMethod)
     6  }
     7  
     8  type second interface {
     9  	common() //@mark(secCommon, "common"),refs("common", secCommon, yCommon, zCommon)
    10  	secondMethod() //@mark(secMethod, "secondMethod"),refs("secondMethod", secMethod, ysMethod, zsMethod)
    11  }
    12  
    13  type s struct {}
    14  
    15  func (*s) common() {} //@mark(sCommon, "common"),refs("common", sCommon, xCommon, yCommon, zCommon)
    16  
    17  func (*s) firstMethod() {} //@mark(sfMethod, "firstMethod"),refs("firstMethod", sfMethod, xfMethod, zfMethod)
    18  
    19  func (*s) secondMethod() {} //@mark(ssMethod, "secondMethod"),refs("secondMethod", ssMethod, ysMethod, zsMethod)
    20  
    21  func main() {
    22  	var x first = &s{}
    23  	var y second = &s{}
    24  
    25  	x.common() //@mark(xCommon, "common"),refs("common", firCommon, xCommon, zCommon)
    26  	x.firstMethod() //@mark(xfMethod, "firstMethod"),refs("firstMethod", firMethod, xfMethod, zfMethod)
    27  	y.common() //@mark(yCommon, "common"),refs("common", secCommon, yCommon, zCommon)
    28  	y.secondMethod() //@mark(ysMethod, "secondMethod"),refs("secondMethod", secMethod, ysMethod, zsMethod)
    29  
    30  	var z *s = &s{}
    31  	z.firstMethod() //@mark(zfMethod, "firstMethod"),refs("firstMethod", sfMethod, xfMethod, zfMethod)
    32  	z.secondMethod() //@mark(zsMethod, "secondMethod"),refs("secondMethod", ssMethod, ysMethod, zsMethod)
    33  	z.common() //@mark(zCommon, "common"),refs("common", sCommon, xCommon, yCommon, zCommon)
    34  }