v2 / vlib / v / tests / options / option_ptr_generic_test.v
20 lines · 18 sloc · 244 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1@[heap]
2struct Node[T] {
3mut:
4 value T
5 next ?&Node[T]
6}
7
8fn print_t(node ?&Node[int]) ?&Node[int] {
9 println(node)
10 assert node == none
11 return node
12}
13
14fn test_main() {
15 n := Node[int]{
16 value: 5
17 }
18 t := print_t(n.next)
19 assert t == none
20}
21