-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/typesinternal: add NamedOrAlias type
A NamedOrAlias represents either a *types.Named or a *types.Alias. Used this generalization in gopls. This change is derived from https://go.dev/cl/603935. Change-Id: Ica1669784dec6bcdefafde02e9a6ce789db28814 Reviewed-on: https://go-review.googlesource.com/c/tools/+/618735 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Commit-Queue: Tim King <[email protected]>
- Loading branch information
1 parent
bd86f8c
commit 915132c
Showing
6 changed files
with
113 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
This test checks completion related to aliases. | ||
|
||
-- flags -- | ||
-ignore_extra_diags | ||
-min_go=go1.24 | ||
|
||
-- aliases.go -- | ||
package aliases | ||
|
||
// Copied from the old builtins.go, which has been ported to the new marker tests. | ||
/* string */ //@item(string, "string", "", "type") | ||
/* int */ //@item(int, "int", "", "type") | ||
/* float32 */ //@item(float32, "float32", "", "type") | ||
/* float64 */ //@item(float64, "float64", "", "type") | ||
|
||
type p struct{} | ||
|
||
type s[a int | string] = p | ||
|
||
func _() { | ||
s[]{} //@rank("]", int, float64) | ||
} | ||
|
||
func takesGeneric[a int | string](s[a]) { | ||
"s[a]{}" //@item(tpInScopeLit, "s[a]{}", "", "var") | ||
takesGeneric() //@rank(")", tpInScopeLit),snippet(")", tpInScopeLit, "s[a]{\\}") | ||
} | ||
|
||
type myType int //@item(flType, "myType", "int", "type") | ||
|
||
type myt[T int] myType //@item(aflType, "myt[T]", "int", "type") | ||
|
||
func (my myt) _() {} //@complete(") _", flType, aflType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters