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

     1  This test verifies that gopls can rename instantiated fields.
     2  
     3  -- a.go --
     4  package a
     5  
     6  // This file is adapted from the example in the issue.
     7  
     8  type builder[S ~[]int] struct {
     9  	elements S //@rename("elements", "elements2", OneToTwo)
    10  }
    11  
    12  type BuilderImpl[S ~[]int] struct{ builder[S] }
    13  
    14  func NewBuilderImpl[S ~[]int](name string)  *BuilderImpl[S] {
    15    impl := &BuilderImpl[S]{
    16  	builder[S]{
    17  	  elements: S{},
    18  	},
    19    }
    20  
    21    _ = impl.elements
    22    return impl
    23  }
    24  -- @OneToTwo/a.go --
    25  @@ -6 +6 @@
    26  -	elements S //@rename("elements", "elements2", OneToTwo)
    27  +	elements2 S //@rename("elements", "elements2", OneToTwo)
    28  @@ -14 +14 @@
    29  -	  elements: S{},
    30  +	  elements2: S{},
    31  @@ -18 +18 @@
    32  -  _ = impl.elements
    33  +  _ = impl.elements2