type TestSum = int | string

struct Bar {
	y int
}

struct Foo {
mut:
	a TestSum
	b int
	c string
	d Bar
}

fn main() {
	$for f in Foo.fields {
		$if f.typ is $sumtype {
			dump(f.name)
			$for f2 in f.variants {
				$if f2.typ is $int {
					assert f2.typ == typeof[int]().idx
					dump('int')
				} $else $if f2.typ is $string {
					dump('string')
					assert f2.typ == typeof[string]().idx
				}
			}
		} $else $if f.typ is Bar {
			$for f3 in f.fields {
				assert f3.typ == typeof[int]().idx
				dump(f3.name)
			}
		}
	}
}
