vxx2 / vlib / v / checker / tests / match_enum_ref.vv
18 lines · 18 sloc · 246 bytes · d912268e5dc45d38f4873ebcbed18e276746b23b
Raw
1enum SomeType {
2 a
3}
4fn f(t &SomeType) ?int {
5 return match
6 t // note the missing asterisk
7 {
8 .a {
9 panic('This does not happen!')
10 3
11 }
12 }
13}
14fn main() {
15 t := SomeType.a
16 f(&t)?
17 assert false // should not happen, but does
18}