diff --git a/vlib/v/fmt/tests/structs_expected.vv b/vlib/v/fmt/tests/structs_expected.vv index 67e28523a4..ee5b9c36d9 100644 --- a/vlib/v/fmt/tests/structs_expected.vv +++ b/vlib/v/fmt/tests/structs_expected.vv @@ -58,3 +58,5 @@ pub: 14 */ } + +struct C.Foo {} diff --git a/vlib/v/fmt/tests/structs_input.vv b/vlib/v/fmt/tests/structs_input.vv index 39c4288708..dd74dfc4f4 100644 --- a/vlib/v/fmt/tests/structs_input.vv +++ b/vlib/v/fmt/tests/structs_input.vv @@ -61,3 +61,5 @@ somefield4 int 14 */ } + +struct C.Foo diff --git a/vlib/v/parser/struct.v b/vlib/v/parser/struct.v index e9b6bba310..ea670fe061 100644 --- a/vlib/v/parser/struct.v +++ b/vlib/v/parser/struct.v @@ -96,7 +96,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl { mut is_field_mut := false mut is_field_pub := false mut is_field_global := false - mut last_line := -1 + mut last_line := p.prev_tok.position().line_nr + 1 mut end_comments := []ast.Comment{} if !no_body { p.check(.lcbr)