Gitly
English
Русский
Español
日本語
中文
Português
Pricing
Log in
Register
vxx2
/
vlib
/
v
/
checker
/
tests
/
opt_is_op_check_err.vv
21
lines
·
17
sloc
·
201 bytes
·
a7fef7c4930a3443b41f2a53c855839df4cccea6
Raw
1
type Foo = int | string
2
3
struct Struct {
4
a ?Foo
5
}
6
7
fn r(a string) {}
8
9
fn process(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
process(s)
21
}
22