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 {
5757 }
5858
5959 for name , t := range conf .CreateTypesTable (i ) {
60+ if t .Ambiguous {
61+ continue
62+ }
6063 c .Variables [Identifier (name )] = c .use (t .Type , fromMethod (t .Method ))
6164 }
6265
Original file line number Diff line number Diff line change @@ -132,6 +132,54 @@ func TestCreateDoc(t *testing.T) {
132132 assert .Equal (t , litter .Sdump (expected ), litter .Sdump (doc ))
133133}
134134
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+
135183func TestCreateDoc_FromMap (t * testing.T ) {
136184 env := map [string ]interface {}{
137185 "Tweets" : []* Tweet {},
You can’t perform that action at this time.
0 commit comments