v2 / vlib / v / gen / c / testdata / comptime_if_cond.vv
26 lines · 23 sloc · 291 bytes · 47c785886c81c6cbe712869ebf15139835ccbfee
Raw
1// vtest vflags: -g
2struct TaggedSource {}
3
4type SumType = TaggedSource | int
5
6fn test_main() {
7 f()
8}
9
10fn f() {
11 source := SumType(0)
12 path := match source {
13 TaggedSource {
14 $if foo ? {
15 'a'
16 } $else {
17 'b'
18 }
19 }
20 else {
21 'c'
22 }
23 }
24 assert path == 'c'
25 println('done')
26}
27