1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/forcomp_alias_type_test.v
2022-12-30 11:27:01 +02:00

26 lines
349 B
V

module main
struct Aa {
sub AliasType
}
type AliasType = Bb
struct Bb {
a int
}
fn encode_struct[U](val U, mut out []string) []string {
$for field in U.fields {
encode_struct(val.$(field.name), mut out)
out << field.str()
}
return out
}
fn test_main() {
aa := Aa{}
mut out := []string{}
assert encode_struct(aa, mut out).len == 2
}