blob: 9ee3860fcae8014a36f05ec031392f05904e4955 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package fillstruct
import (
data "b"
"go/ast"
"go/token"
"unsafe"
)
type emptyStruct struct{}
var _ = emptyStruct{}
type basicStruct struct {
foo int
}
var _ = basicStruct{} // want `Fill basicStruct`
type twoArgStruct struct {
foo int
bar string
}
var _ = twoArgStruct{} // want `Fill twoArgStruct`
var _ = twoArgStruct{ // want `Fill twoArgStruct`
bar: "bar",
}
type nestedStruct struct {
bar string
basic basicStruct
}
var _ = nestedStruct{} // want `Fill nestedStruct`
var _ = data.B{} // want `Fill b.B`
type typedStruct struct {
m map[string]int
s []int
c chan int
c1 <-chan int
a [2]string
}
var _ = typedStruct{} // want `Fill typedStruct`
type funStruct struct {
fn func(i int) int
}
var _ = funStruct{} // want `Fill funStruct`
type funStructComplex struct {
fn func(i int, s string) (string, int)
}
var _ = funStructComplex{} // want `Fill funStructComplex`
type funStructEmpty struct {
fn func()
}
var _ = funStructEmpty{} // want `Fill funStructEmpty`
type Foo struct {
A int
}
type Bar struct {
X *Foo
Y *Foo
}
var _ = Bar{} // want `Fill Bar`
type importedStruct struct {
m map[*ast.CompositeLit]ast.Field
s []ast.BadExpr
a [3]token.Token
c chan ast.EmptyStmt
fn func(ast_decl ast.DeclStmt) ast.Ellipsis
st ast.CompositeLit
}
var _ = importedStruct{} // want `Fill importedStruct`
type pointerBuiltinStruct struct {
b *bool
s *string
i *int
}
var _ = pointerBuiltinStruct{} // want `Fill pointerBuiltinStruct`
var _ = []ast.BasicLit{
{}, // want `Fill go/ast.BasicLit`
}
var _ = []ast.BasicLit{{}, // want "go/ast.BasicLit"
}
type unsafeStruct struct {
foo unsafe.Pointer
}
var _ = unsafeStruct{} // want `Fill unsafeStruct`
|