v/vlib/v/checker/tests/comptime_field_selector_not...

21 lines
219 B
V

struct Foo {
test int
name string
}
fn test<T>() {
mut t := T{}
$for f in T.fields {
$if f.typ is string {
t.$(f) = '3'
fv := Foo{}
_ = t.$(fv.name)
}
}
_ = t.$(f.name)
}
fn main() {
test<Foo>()
}