fmt: fix bug that vfmt removes emmbeded struct in struct decl (#8775)
parent
94429c8fd8
commit
51c286df5a
|
@ -643,7 +643,7 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) {
|
|||
f.write(gtypes)
|
||||
f.write('>')
|
||||
}
|
||||
if node.fields.len == 0 && node.pos.line_nr == node.pos.last_line {
|
||||
if node.fields.len == 0 && node.embeds.len == 0 && node.pos.line_nr == node.pos.last_line {
|
||||
f.writeln(' {}\n')
|
||||
return
|
||||
}
|
||||
|
|
|
@ -10,3 +10,8 @@ struct Bar {
|
|||
y int
|
||||
z string
|
||||
}
|
||||
|
||||
struct Baz {
|
||||
Foo
|
||||
Test
|
||||
}
|
||||
|
|
|
@ -25,6 +25,10 @@ pub mut:
|
|||
pub_mut_field string
|
||||
}
|
||||
|
||||
struct Bar {
|
||||
Foo
|
||||
}
|
||||
|
||||
fn new_user() User {
|
||||
return User{
|
||||
name: 'Serious Sam'
|
||||
|
|
|
@ -25,6 +25,8 @@ struct Foo {
|
|||
pub_mut_field string
|
||||
}
|
||||
|
||||
struct Bar { Foo }
|
||||
|
||||
fn new_user()
|
||||
User
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue