v2 / vlib / v / tests / generics / generic_function_error_propagation_test.v
12 lines · 10 sloc · 233 bytes · 7b22bae12ea108ee51a457a9dd99935ad0c88dc1
Raw
1import rand
2
3type Condition = fn () bool
4
5fn test_generic_function_error_propagation() {
6 mut list := []Condition{}
7 list = [fn () bool {
8 return true
9 }]
10 println(rand.element[Condition](list) or { panic('Err') })
11 println(list)
12}
13