diff --git a/vlib/v/parser/expr.v b/vlib/v/parser/expr.v index 44fd06d225..0517506c11 100644 --- a/vlib/v/parser/expr.v +++ b/vlib/v/parser/expr.v @@ -114,7 +114,7 @@ pub fn (mut p Parser) check_expr(precedence int) !ast.Expr { node = p.prefix_expr() } } - .key_go { + .key_go, .key_spawn { mut go_expr := p.go_expr() go_expr.is_expr = true node = go_expr diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 00e833758b..4d6b87aa9b 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -1051,7 +1051,7 @@ pub fn (mut p Parser) stmt(is_top_level bool) ast.Stmt { } } } - .key_go { + .key_go, .key_spawn { go_expr := p.go_expr() return ast.ExprStmt{ expr: go_expr diff --git a/vlib/v/tests/inout/go_print.out b/vlib/v/tests/inout/go_print.out index b5d8bb58d9..ee8e3b469a 100644 --- a/vlib/v/tests/inout/go_print.out +++ b/vlib/v/tests/inout/go_print.out @@ -1 +1,2 @@ [1, 2, 3] +[4,5, 6] diff --git a/vlib/v/tests/inout/go_print.vv b/vlib/v/tests/inout/go_print.vv index 78e26f662c..e7ddd5c6a5 100644 --- a/vlib/v/tests/inout/go_print.vv +++ b/vlib/v/tests/inout/go_print.vv @@ -1,4 +1,7 @@ fn main(){ g := go print([1, 2, 3]) g.wait() + println('') + g2 := spawn print([4, 5, 6]) + g2.wait() }