v4 / vlib / v / checker / tests / comptime_call_method_void_err.vv
20 lines · 16 sloc · 288 bytes · 60094d95e2f6cb5ed3a28dc44ab11beec32b59d2
Raw
1import os
2
3struct Dummy {}
4
5fn (d Dummy) sample2(file_name string) int {
6 println(file_name)
7 return 22
8}
9
10fn (d Dummy) sample1(file_name string) {
11 println(file_name)
12}
13
14fn main() {
15 $for method in Dummy.methods {
16 if os.args.len >= 1 {
17 println(Dummy{}.$method(os.args[0]))
18 }
19 }
20}
21