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

     1  This test verifies that we fine implementations of the built-in error interface.
     2  
     3  -- go.mod --
     4  module example.com
     5  go 1.12
     6  
     7  -- p.go --
     8  package p
     9  
    10  type errA struct{ error } //@loc(errA, "errA")
    11  
    12  type errB struct{} //@loc(errB, "errB")
    13  func (errB) Error() string{ return "" } //@loc(errBError, "Error")
    14  
    15  type notAnError struct{}
    16  func (notAnError) Error() int { return 0 }
    17  
    18  func _() {
    19  	var _ error //@implementation("error", errA, errB)
    20  	var a errA
    21  	_ = a.Error //@implementation("Error", errBError)
    22  }