| 1 |
This test checks completion related to aliases. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-ignore_extra_diags |
| 5 |
|
| 6 |
-- aliases.go -- |
| 7 |
package aliases |
| 8 |
|
| 9 |
// Copied from the old builtins.go, which has been ported to the new marker tests. |
| 10 |
/* string */ //@item(string, "string", "", "type") |
| 11 |
/* int */ //@item(int, "int", "", "type") |
| 12 |
/* float32 */ //@item(float32, "float32", "", "type") |
| 13 |
/* float64 */ //@item(float64, "float64", "", "type") |
| 14 |
|
| 15 |
type p struct{} |
| 16 |
|
| 17 |
type s[a int | string] = p |
| 18 |
|
| 19 |
func _() { |
| 20 |
s[]{} //@rank(re"()]", int, float64) |
| 21 |
} |
| 22 |
|
| 23 |
func takesGeneric[a int | string](s[a]) { |
| 24 |
"s[a]{}" //@item(tpInScopeLit, "s[a]{}", "", "var") |
| 25 |
takesGeneric() //@rank(re"()\\)", tpInScopeLit),snippet(re"()\\)", tpInScopeLit, "s[a]{\\}") |
| 26 |
} |
| 27 |
|
| 28 |
func _() { |
| 29 |
s[int]{} //@item(tpInstLit, "s[int]{}", "", "var") |
| 30 |
takesGeneric[int]() //@rank(re"()\\)", tpInstLit),snippet(re"()\\)", tpInstLit, "s[int]{\\}") |
| 31 |
|
| 32 |
"s[...]{}" //@item(tpUninstLit, "s[...]{}", "", "var") |
| 33 |
takesGeneric() //@rank(re"()\\)", tpUninstLit),snippet(re"()\\)", tpUninstLit, "s[${1:}]{\\}") |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
type myType int //@item(flType, "myType", "int", "type") |
| 38 |
|
| 39 |
type myt[T int] myType //@item(aflType, "myt[T]", "int", "type") |
| 40 |
|
| 41 |
func (my myt) _() {} //@complete(re"()\\) _", flType, aflType) |