| 1 |
This test checks that completion ranking accounts for interface assignability. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-ignore_extra_diags |
| 5 |
|
| 6 |
-- settings.json -- |
| 7 |
{ |
| 8 |
"completeUnimported": false, |
| 9 |
"deepCompletion": false |
| 10 |
} |
| 11 |
|
| 12 |
-- p.go -- |
| 13 |
|
| 14 |
package interfacerank |
| 15 |
|
| 16 |
type foo interface { |
| 17 |
foo() |
| 18 |
} |
| 19 |
|
| 20 |
type fooImpl int |
| 21 |
|
| 22 |
func (*fooImpl) foo() {} |
| 23 |
|
| 24 |
func wantsFoo(foo) {} |
| 25 |
|
| 26 |
func _() { |
| 27 |
var ( |
| 28 |
aa string //@item(irAA, "aa", "string", "var") |
| 29 |
ab *fooImpl //@item(irAB, "ab", "*fooImpl", "var") |
| 30 |
) |
| 31 |
|
| 32 |
wantsFoo(a) //@complete(re"()\\)", irAB, irAA) |
| 33 |
|
| 34 |
var ac fooImpl //@item(irAC, "ac", "fooImpl", "var") |
| 35 |
wantsFoo(&a) //@complete(re"()\\)", irAC, irAA, irAB) |
| 36 |
} |