vxx2 / vlib / v / checker / tests / method_call_on_undefined_err.vv
19 lines · 17 sloc · 311 bytes · f8fb57d1aac4373855a7f9360d75b52233cbf41b
Raw
1module main
2
3// note missing `input` argument in fn signature
4fn foo() !string {
5 // without next error does not occurs
6 a, b := input.split_once('%') or { '', 'empty' }
7 if b == '' {
8 return error('')
9 }
10 return a
11}
12
13fn main() {
14 res := foo('fe80::1234%ne0') or {
15 eprintln(err)
16 exit(1)
17 }
18 println(res)
19}
20