Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
structs
/
struct_init_update_with_generics_test.v
20
lines
·
18
sloc
·
217 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
struct
Foo {
2
a int
3
b string
4
isbool bool
5
}
6
7
fn
do[T](f T) T {
8
return
T{
9
...f
10
isbool:
true
11
}
12
}
13
14
fn
test_main() {
15
foo := do(Foo{
16
a: 1
17
b:
'2'
18
})
19
assert foo.a == 1 && foo.b ==
'2'
&& foo.isbool
20
}
21