Gitly
English
Русский
Español
日本語
中文
Português
Pricing
Log in
Register
v2
/
vlib
/
v
/
checker
/
tests
/
opt_is_op_check_err.vv
21
lines
·
17
sloc
·
189 bytes
·
89089ab1d55e39a5f89909d8df71e1e31d814347
Raw
1
type Foo = int | string
2
3
struct Struct {
4
a ?Foo
5
}
6
7
fn r(a string) {}
8
9
fn t(s ?Foo) {
10
mut t := Struct{
11
a: s
12
}
13
if t.a is string {
14
r(t.a)
15
}
16
}
17
18
fn main() {
19
s := ?Foo('hello')
20
t(s)
21
}
22