File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,11 @@ fn (mut g Gen) struct_init(node ast.StructInit) {
197
197
embed_sym := g.table.sym (embed)
198
198
embed_name := embed_sym.embed_name ()
199
199
if embed_name ! in inited_fields {
200
- embed_info := embed_sym.info as ast.Struct
200
+ embed_info := if embed_sym.info is ast.Struct {
201
+ embed_sym.info
202
+ } else {
203
+ g.table.final_sym (embed).info as ast.Struct
204
+ }
201
205
embed_field_names := embed_info.fields.map (it .name)
202
206
fields_to_embed := init_fields_to_embed.filter (it .name ! in used_embed_fields
203
207
&& it .name in embed_field_names)
Original file line number Diff line number Diff line change
1
+ struct Foo1 {}
2
+
3
+ type Foo2 = Foo1
4
+
5
+ struct Bar {
6
+ Foo2
7
+ }
8
+
9
+ fn test_main () {
10
+ assert Bar{}.str () == 'Bar{
11
+ Foo2: Foo2(Foo1{})
12
+ }'
13
+ }
You can’t perform that action at this time.
0 commit comments