Skip to content

Commit 362bfb3

Browse files
authored
switch root element when inlining (#172)
* switch root element when propogating inlines; add a test for recursive and mutually-recursive types
1 parent 38a6f61 commit 362bfb3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

_generated/def.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,13 @@ type FileHandle struct {
199199

200200
type CustomInt int
201201
type CustomBytes []byte
202+
203+
type Wrapper struct {
204+
Tree *Tree
205+
}
206+
207+
type Tree struct {
208+
Children []Tree
209+
Element int
210+
Parent *Wrapper
211+
}

parse/inline.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,8 @@ func (f *FileSet) nextInline(ref *gen.Elem, root string) {
119119
panic(fatalloop)
120120
}
121121

122-
// inline bottom-up so as not to miss
123-
// other inlining opportunities.
124-
f.nextInline(&node, root)
125122
*ref = node.Copy()
123+
f.nextInline(ref, node.TypeName())
126124
} else if !ok && !el.Resolved() {
127125
// this is the point at which we're sure that
128126
// we've got a type that isn't a primitive,

0 commit comments

Comments
 (0)