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

     1  Basic test of implementation query.
     2  
     3  -- go.mod --
     4  module example.com
     5  go 1.12
     6  
     7  -- implementation/implementation.go --
     8  package implementation
     9  
    10  import "example.com/other"
    11  
    12  type ImpP struct{} //@loc(ImpP, "ImpP"),implementation("ImpP", Laugher, OtherLaugher)
    13  
    14  func (*ImpP) Laugh() { //@loc(LaughP, "Laugh"),implementation("Laugh", Laugh, OtherLaugh)
    15  }
    16  
    17  type ImpS struct{} //@loc(ImpS, "ImpS"),implementation("ImpS", Laugher, OtherLaugher)
    18  
    19  func (ImpS) Laugh() { //@loc(LaughS, "Laugh"),implementation("Laugh", Laugh, OtherLaugh)
    20  }
    21  
    22  type Laugher interface { //@loc(Laugher, "Laugher"),implementation("Laugher", ImpP, OtherImpP, ImpS, OtherImpS, embedsImpP)
    23  	Laugh() //@loc(Laugh, "Laugh"),implementation("Laugh", LaughP, OtherLaughP, LaughS, OtherLaughS)
    24  }
    25  
    26  type Foo struct { //@implementation("Foo", Joker)
    27  	other.Foo
    28  }
    29  
    30  type Joker interface { //@loc(Joker, "Joker")
    31  	Joke() //@loc(Joke, "Joke"),implementation("Joke", ImpJoker)
    32  }
    33  
    34  type cryer int //@implementation("cryer", Cryer)
    35  
    36  func (cryer) Cry(other.CryType) {} //@loc(CryImpl, "Cry"),implementation("Cry", Cry)
    37  
    38  type Empty interface{} //@implementation("Empty")
    39  
    40  var _ interface{ Joke() } //@implementation("Joke", ImpJoker)
    41  
    42  type embedsImpP struct { //@loc(embedsImpP, "embedsImpP")
    43  	ImpP //@implementation("ImpP", Laugher, OtherLaugher)
    44  }
    45  
    46  -- other/other.go --
    47  package other
    48  
    49  type ImpP struct{} //@loc(OtherImpP, "ImpP")
    50  
    51  func (*ImpP) Laugh() { //@loc(OtherLaughP, "Laugh")
    52  }
    53  
    54  type ImpS struct{} //@loc(OtherImpS, "ImpS")
    55  
    56  func (ImpS) Laugh() { //@loc(OtherLaughS, "Laugh")
    57  }
    58  
    59  type ImpI interface { //@loc(OtherLaugher, "ImpI")
    60  	Laugh() //@loc(OtherLaugh, "Laugh")
    61  }
    62  
    63  type Foo struct { //@implementation("Foo", Joker)
    64  }
    65  
    66  func (Foo) Joke() { //@loc(ImpJoker, "Joke"),implementation("Joke", Joke)
    67  }
    68  
    69  type CryType int
    70  
    71  type Cryer interface { //@loc(Cryer, "Cryer")
    72  	Cry(CryType) //@loc(Cry, "Cry"),implementation("Cry", CryImpl)
    73  }