mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
handle bad value in if x := opt() {
This commit is contained in:
parent
49f960aea5
commit
b79588dc69
@ -235,6 +235,9 @@ fn (p mut Parser) if_statement(is_expr bool, elif_depth int) string {
|
|||||||
p.check(.decl_assign)
|
p.check(.decl_assign)
|
||||||
p.is_var_decl = true
|
p.is_var_decl = true
|
||||||
option_type, expr := p.tmp_expr()// := p.bool_expression()
|
option_type, expr := p.tmp_expr()// := p.bool_expression()
|
||||||
|
if !option_type.starts_with('Option_') {
|
||||||
|
p.error('`if x := opt() {` syntax requires a function that returns an optional value')
|
||||||
|
}
|
||||||
p.is_var_decl = false
|
p.is_var_decl = false
|
||||||
typ := option_type[7..]
|
typ := option_type[7..]
|
||||||
// Option_User tmp = get_user(1);
|
// Option_User tmp = get_user(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user