| 1 |
This test checks gopls behavior when hovering over alias type. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-skip_goarch=386,arm |
| 5 |
|
| 6 |
-- go.mod -- |
| 7 |
module mod.com |
| 8 |
|
| 9 |
go 1.18 |
| 10 |
|
| 11 |
-- main.go -- |
| 12 |
package main |
| 13 |
|
| 14 |
import "mod.com/a" |
| 15 |
import "mod.com/b" |
| 16 |
|
| 17 |
type ToTypeDecl = b.RealType //@hover("ToTypeDecl", "ToTypeDecl", ToTypeDecl) |
| 18 |
|
| 19 |
type ToAlias = a.Alias //@hover("ToAlias", "ToAlias", ToAlias) |
| 20 |
|
| 21 |
type ToAliasWithComment = a.AliasWithComment //@hover("ToAliasWithComment", "ToAliasWithComment", ToAliasWithComment) |
| 22 |
|
| 23 |
-- a/a.go -- |
| 24 |
package a |
| 25 |
import "mod.com/b" |
| 26 |
|
| 27 |
type Alias = b.RealType |
| 28 |
|
| 29 |
// AliasWithComment is a type alias with comments. |
| 30 |
type AliasWithComment = b.RealType |
| 31 |
|
| 32 |
-- b/b.go -- |
| 33 |
package b |
| 34 |
// RealType is a real type rather than an alias type. |
| 35 |
type RealType struct { |
| 36 |
Name string |
| 37 |
Age int |
| 38 |
} |
| 39 |
|
| 40 |
-- generic/a.go -- |
| 41 |
package generic |
| 42 |
func generic[T any]() {} |
| 43 |
|
| 44 |
type Named string |
| 45 |
type Alias = Named |
| 46 |
|
| 47 |
func _(){ |
| 48 |
generic[Alias]() //@hover("Alias", "Alias", Alias) |
| 49 |
} |
| 50 |
|
| 51 |
-- @ToTypeDecl -- |
| 52 |
```go |
| 53 |
type ToTypeDecl = b.RealType // size=24 (0x18) |
| 54 |
|
| 55 |
type RealType struct { |
| 56 |
Name string |
| 57 |
Age int |
| 58 |
} |
| 59 |
``` |
| 60 |
|
| 61 |
--- |
| 62 |
|
| 63 |
@hover("ToTypeDecl", "ToTypeDecl", ToTypeDecl) |
| 64 |
|
| 65 |
|
| 66 |
--- |
| 67 |
|
| 68 |
[`main.ToTypeDecl` on pkg.go.dev](https://pkg.go.dev/mod.com#ToTypeDecl) |
| 69 |
-- @ToAlias -- |
| 70 |
```go |
| 71 |
type ToAlias = a.Alias // size=24 (0x18) |
| 72 |
``` |
| 73 |
|
| 74 |
--- |
| 75 |
|
| 76 |
@hover("ToAlias", "ToAlias", ToAlias) |
| 77 |
|
| 78 |
|
| 79 |
--- |
| 80 |
|
| 81 |
[`main.ToAlias` on pkg.go.dev](https://pkg.go.dev/mod.com#ToAlias) |
| 82 |
-- @ToAliasWithComment -- |
| 83 |
```go |
| 84 |
type ToAliasWithComment = a.AliasWithComment // size=24 (0x18) |
| 85 |
``` |
| 86 |
|
| 87 |
--- |
| 88 |
|
| 89 |
@hover("ToAliasWithComment", "ToAliasWithComment", ToAliasWithComment) |
| 90 |
|
| 91 |
|
| 92 |
--- |
| 93 |
|
| 94 |
[`main.ToAliasWithComment` on pkg.go.dev](https://pkg.go.dev/mod.com#ToAliasWithComment) |
| 95 |
-- @Alias -- |
| 96 |
```go |
| 97 |
type Alias = Named |
| 98 |
|
| 99 |
type Named string |
| 100 |
``` |
| 101 |
|
| 102 |
--- |
| 103 |
|
| 104 |
[`generic.Alias` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#Alias) |