Skip to content

Commit

Permalink
parser: add multiple struct attributes error for new attribute syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-conigliaro committed Nov 10, 2023
1 parent 00f2e4a commit f77e5b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vlib/v/parser/parser.v
Expand Up @@ -1854,10 +1854,15 @@ fn (mut p Parser) attributes() {
p.error_with_pos('attributes cannot be empty', p.prev_tok.pos().extend(p.tok.pos()))
return
}
// TODO: remove when old attr syntax is removed
if p.inside_struct_attr_decl && p.tok.kind == .lsbr {
p.error_with_pos('multiple attributes should be in the same [], with ; separators',
p.prev_tok.pos().extend(p.tok.pos()))
return
} else if p.inside_struct_attr_decl && p.tok.kind == .at {
p.error_with_pos('multiple attributes should be in the same @[], with ; separators',
p.prev_tok.pos().extend(p.tok.pos()))
return
}
}

Expand Down

0 comments on commit f77e5b6

Please sign in to comment.