golang.org/x/tools@v0.21.0/internal/refactor/inline/testdata/embed.txtar (about)

     1  Test of implicit field selections in method calls.
     2  
     3  The two level wrapping T -> unexported -> U is required
     4  to exercise the implicit selections exportedness check;
     5  with only a single level, the receiver declaration in
     6  "func (unexported) F()" would fail the earlier
     7  unexportedness check.
     8  
     9  -- go.mod --
    10  module testdata
    11  go 1.12
    12  
    13  -- a/a.go --
    14  package a
    15  
    16  import "testdata/b"
    17  
    18  func _(x b.T) {
    19  	x.F() //@ inline(re"F", re"in x.F, implicit reference to unexported field .unexported cannot be made explicit")
    20  }
    21  
    22  -- b/b.go --
    23  package b
    24  
    25  type T struct { unexported }
    26  type unexported struct { U }
    27  type U struct{}
    28  func (U) F() {}