Skip to content

Commit 8d51820

Browse files
authored
parser: fix anon fn return type option/result followed by comment parsing in vfmt mode (fix #23607) (#23608)
1 parent d032918 commit 8d51820

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module main
2+
3+
pub interface Command {
4+
name string // Command name as used on CLI
5+
desc string // Single line description
6+
help string // Detailed and formated description
7+
arg_min int // Minimal argument number expected
8+
arg_max int // Maximal argument number expected
9+
exec fn (s []string) ! // Command callback.
10+
}
11+
12+
fn main() {
13+
println('Hello')
14+
}

vlib/v/parser/parse_type.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ fn (mut p Parser) parse_type() ast.Type {
479479
is_attr := p.tok.kind == .at
480480

481481
if p.tok.line_nr > line_nr || p.tok.kind in [.comma, .rpar, .assign]
482-
|| (is_attr || is_required_field) {
482+
|| (is_attr || is_required_field) || p.tok.kind == .comment {
483483
mut typ := ast.void_type
484484
if is_option {
485485
typ = typ.set_flag(.option)

0 commit comments

Comments
 (0)