diff --git a/vlib/v/fmt/tests/struct_keep.vv b/vlib/v/fmt/tests/struct_keep.vv index 68ed58bc3b..023afbb4ce 100644 --- a/vlib/v/fmt/tests/struct_keep.vv +++ b/vlib/v/fmt/tests/struct_keep.vv @@ -44,3 +44,10 @@ struct KeepMultiLineDefaultExprsIndent { text: 'M5' }] } + +[typedef] +struct C.some_t { + @type int + data struct {} + +} diff --git a/vlib/v/parser/struct.v b/vlib/v/parser/struct.v index 935451305d..a06765ecbc 100644 --- a/vlib/v/parser/struct.v +++ b/vlib/v/parser/struct.v @@ -387,7 +387,7 @@ fn (mut p Parser) struct_decl(is_anon bool) ast.StructDecl { module_pos: module_pos language: language is_union: is_union - attrs: attrs + attrs: if is_anon { []ast.Attr{} } else { attrs } // anon structs can't have attributes end_comments: end_comments generic_types: generic_types embeds: embeds