File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ func CreateDoc(i interface{}) *Context {
57
57
}
58
58
59
59
for name , t := range conf .CreateTypesTable (i ) {
60
+ if t .Ambiguous {
61
+ continue
62
+ }
60
63
c .Variables [Identifier (name )] = c .use (t .Type , fromMethod (t .Method ))
61
64
}
62
65
Original file line number Diff line number Diff line change @@ -132,6 +132,54 @@ func TestCreateDoc(t *testing.T) {
132
132
assert .Equal (t , litter .Sdump (expected ), litter .Sdump (doc ))
133
133
}
134
134
135
+ type A struct {
136
+ AmbiguousField int
137
+ OkField int
138
+ }
139
+ type B struct {
140
+ AmbiguousField string
141
+ }
142
+ type EnvAmbiguous struct {
143
+ A
144
+ B
145
+ }
146
+
147
+ func TestCreateDoc_Ambiguous (t * testing.T ) {
148
+ doc := CreateDoc (& EnvAmbiguous {})
149
+ expected := & Context {
150
+ Variables : map [Identifier ]* Type {
151
+ "A" : {
152
+ Kind : "struct" ,
153
+ Name : "A" ,
154
+ },
155
+ "B" : {
156
+ Kind : "struct" ,
157
+ Name : "B" ,
158
+ },
159
+ "OkField" : {
160
+ Kind : "int" ,
161
+ },
162
+ },
163
+ Types : map [TypeName ]* Type {
164
+ "A" : {
165
+ Kind : "struct" ,
166
+ Fields : map [Identifier ]* Type {
167
+ "AmbiguousField" : {Kind : "int" },
168
+ "OkField" : {Kind : "int" },
169
+ },
170
+ },
171
+ "B" : {
172
+ Kind : "struct" ,
173
+ Fields : map [Identifier ]* Type {
174
+ "AmbiguousField" : {Kind : "string" },
175
+ },
176
+ },
177
+ },
178
+ }
179
+
180
+ assert .Equal (t , litter .Sdump (expected ), litter .Sdump (doc ))
181
+ }
182
+
135
183
func TestCreateDoc_FromMap (t * testing.T ) {
136
184
env := map [string ]interface {}{
137
185
"Tweets" : []* Tweet {},
You can’t perform that action at this time.
0 commit comments