| 1 |
This test verifies that Implementations uses the correct object when querying |
| 2 |
local implementations. As described in golang/go#67041, a bug led to it |
| 3 |
comparing types from different realms. |
| 4 |
|
| 5 |
-- go.mod -- |
| 6 |
module example.com |
| 7 |
|
| 8 |
go 1.18 |
| 9 |
|
| 10 |
-- a/a.go -- |
| 11 |
package a |
| 12 |
|
| 13 |
type A struct{} |
| 14 |
|
| 15 |
type Aer interface { //@loc(Aer, "Aer") |
| 16 |
GetA() A |
| 17 |
} |
| 18 |
|
| 19 |
type X struct{} //@loc(X, "X") |
| 20 |
|
| 21 |
func (X) GetA() A |
| 22 |
|
| 23 |
-- a/a_test.go -- |
| 24 |
package a |
| 25 |
|
| 26 |
// Verify that we also find implementations in a test variant. |
| 27 |
type Y struct{} //@loc(Y, "Y") |
| 28 |
|
| 29 |
func (Y) GetA() A |
| 30 |
-- b/b.go -- |
| 31 |
package b |
| 32 |
|
| 33 |
import "example.com/a" |
| 34 |
|
| 35 |
var _ a.X //@implementation("X", Aer) |
| 36 |
|
| 37 |
var _ a.Aer //@implementation("Aer", X, Y) |