handle bad value in `if x := opt() {`
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.is_var_decl = true
|
||||
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
|
||||
typ := option_type[7..]
|
||||
// Option_User tmp = get_user(1);
|
||||
|
|
Loading…
Reference in New Issue