checker: vfmt checker.v

Alexander Medvednikov 2022-05-23 00:12:37 +03:00 committed by Jef Roosens
parent 0329536da3
commit 9133671436
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 2 additions and 1 deletions

View File

@ -941,7 +941,8 @@ pub fn (mut c Checker) check_or_expr(node ast.OrExpr, ret_type ast.Type, expr_re
}
if !expr_return_type.has_flag(.optional) {
if expr_return_type.has_flag(.result) {
c.warn('propagating a result like an option is deprecated, use `foo()!` instead of `foo()?`', node.pos)
c.warn('propagating a result like an option is deprecated, use `foo()!` instead of `foo()?`',
node.pos)
} else {
c.error('to propagate an option, the call must also return an optional type',
node.pos)