Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Nov 12, 2024
1 parent 3637bca commit 573c99a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vlib/v/checker/checker.v
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,8 @@ fn (mut c Checker) check_or_expr(node ast.OrExpr, ret_type ast.Type, expr_return
return
}
if node.stmts.len == 0 {
if expr is ast.CallExpr && expr.is_return_used && ret_type != ast.void_type {
if expr is ast.CallExpr && expr.is_return_used
&& ret_type.clear_option_and_result() != ast.void_type {
// x := f() or {}
c.error('assignment requires a non empty `or {}` block', node.pos)
}
Expand Down

0 comments on commit 573c99a

Please sign in to comment.