mirror of
https://github.com/vlang/v.git
synced 2025-09-09 23:39:39 -04:00
This commit is contained in:
parent
aadb0e9435
commit
6dcedae784
@ -76,6 +76,7 @@ fn (mut g Gen) need_tmp_var_in_expr(expr ast.Expr) bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return expr.expected_arg_types.any(it.has_flag(.option))
|
||||
}
|
||||
ast.CastExpr {
|
||||
return g.need_tmp_var_in_expr(expr.expr)
|
||||
|
15
vlib/v/tests/fns/call_option_param_test.v
Normal file
15
vlib/v/tests/fns/call_option_param_test.v
Normal file
@ -0,0 +1,15 @@
|
||||
pub fn new_group(t ?Texts) Group {
|
||||
return Group{}
|
||||
}
|
||||
|
||||
struct Group {
|
||||
}
|
||||
|
||||
struct Texts {
|
||||
}
|
||||
|
||||
fn test_main() {
|
||||
a := 0
|
||||
_ := if a != 0 { new_group(Texts{}) } else { Group{} }
|
||||
_ := if a != 0 { new_group(none) } else { Group{} }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user