v4 / vlib / v / checker / tests / option_var_assign_err.vv
14 lines · 11 sloc · 238 bytes · 39e80afab0f8720de2593d36eddacbf7ea0189f3
Raw
1module main
2
3fn trying_to_change_non_opt_to_option(value int) ?int {
4 mut result := 122
5
6 if value == 1 {
7 result = trying_to_change_non_opt_to_option(0)
8 }
9 return result
10}
11
12fn main() {
13 println(trying_to_change_non_opt_to_option(0))
14}
15