| 1 |
Test of unimported completions respecting the effective Go version of the file. |
| 2 |
|
| 3 |
(See unprefixed file for same test of imported completions.) |
| 4 |
|
| 5 |
These symbols below were introduced to go/types in go1.22: |
| 6 |
|
| 7 |
Alias |
| 8 |
Info.FileVersions |
| 9 |
(Checker).PkgNameOf |
| 10 |
|
| 11 |
The underlying logic depends on versions.FileVersion, which only |
| 12 |
behaves correctly in go1.22. (When go1.22 is assured, we can remove |
| 13 |
the min_go flag but leave the test inputs unchanged.) |
| 14 |
|
| 15 |
-- flags -- |
| 16 |
-ignore_extra_diags |
| 17 |
|
| 18 |
-- go.mod -- |
| 19 |
module example.com |
| 20 |
|
| 21 |
go 1.21 |
| 22 |
|
| 23 |
-- a/a.go -- |
| 24 |
package a |
| 25 |
|
| 26 |
// package-level func |
| 27 |
var _ = types.Sat //@rank(re"()Sat", "Satisfies") |
| 28 |
var _ = types.Ali //@rank(re"()Ali", "!Alias") |
| 29 |
|
| 30 |
// (We don't offer completions of methods |
| 31 |
// of types from unimported packages, so the fact that |
| 32 |
// we don't implement std version filtering isn't evident.) |
| 33 |
|
| 34 |
// field |
| 35 |
var _ = new(types.Info).Use //@rank(re"()Use", "!Uses") |
| 36 |
var _ = new(types.Info).Fil //@rank(re"()Fil", "!FileVersions") |
| 37 |
|
| 38 |
// method |
| 39 |
var _ = new(types.Checker).Obje //@rank(re"()Obje", "!ObjectOf") |
| 40 |
var _ = new(types.Checker).PkgN //@rank(re"()PkgN", "!PkgNameOf") |
| 41 |
|
| 42 |
-- b/b.go -- |
| 43 |
//go:build go1.22 |
| 44 |
|
| 45 |
package a |
| 46 |
|
| 47 |
// package-level decl |
| 48 |
var _ = types.Sat //@rank(re"()Sat", "Satisfies") |
| 49 |
var _ = types.Ali //@rank(re"()Ali", "Alias") |