v2 / vlib / v / checker / tests / wrong_comptime_for_err.vv
30 lines · 27 sloc · 340 bytes · 0c8ce3bcb9fd4a2e5bd5f991a5a07da976d780d7
Raw
1type TestSum = int | string | []int
2
3struct Bar {
4 y int
5}
6
7struct Foo {
8mut:
9 a TestSum
10 b int
11 c string
12 d Bar
13}
14
15fn main() {
16 a := Foo{}
17 $for f in a.fields {
18 $if f.typ is $sumtype {
19 $for f2 in f.variants {
20 dump(f2)
21 }
22 } $else $if f.typ is Bar {
23 assert true
24 }
25 }
26 $for f in a.variants {
27 }
28 $for f in T.variants {
29 }
30}
31