Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
fmt
/
tests
/
comptime_field_selector_parentheses_keep.vv
23
lines
·
20
sloc
·
238 bytes
·
ef5be22f81005b2237311a79b6383138084b0c53
Raw
1
struct Foo {
2
mut:
3
test string
4
name string
5
}
6
7
fn (f Foo) print() {
8
println('test')
9
}
10
11
fn test[T]() {
12
mut t := T{}
13
t.name = '2'
14
$for f in T.fields {
15
$if f.typ is string {
16
println(t.$(f.name))
17
}
18
}
19
}
20
21
fn main() {
22
test[Foo]()
23
}
24