Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
options
/
option_generic_inferred_call_test.v
16
lines
·
13
sloc
·
266 bytes
·
687ee535ea1d01fa3c2243cb9fe4a6a252947547
Raw
1
fn
unwrap[T](val ?T) T {
2
if
u_val := val {
3
return
u_val
4
}
5
6
return
T{}
7
}
8
9
fn
test_option_generic_function_call_can_infer_type_implicitly() {
10
toto := ?int(1)
11
implicit := unwrap(toto)
12
explicit := unwrap[int](toto)
13
14
assert implicit == 1
15
assert explicit == 1
16
}
17