checker: fix sumtype matching test (#7235)
parent
8b3ffb9be2
commit
916a64935a
|
@ -1,14 +1,14 @@
|
|||
vlib/v/checker/tests/sum_type_mutable_cast_err.vv:23:10: error: cannot use operator `+` with `Abc`
|
||||
21 | mut x := Abc(0)
|
||||
22 | if x is int {
|
||||
23 | _ := x + 5
|
||||
vlib/v/checker/tests/sum_type_mutable_cast_err.vv:15:10: error: cannot use operator `+` with `Abc`
|
||||
13 | mut x := Abc(0)
|
||||
14 | if x is int {
|
||||
15 | _ := x + 5
|
||||
| ^
|
||||
24 | }
|
||||
25 | mut f2 := Foo2{Bar2{Abc(0)}}
|
||||
vlib/v/checker/tests/sum_type_mutable_cast_err.vv:27:8: error: undefined ident: `f`
|
||||
25 | mut f2 := Foo2{Bar2{Abc(0)}}
|
||||
26 | if f2.b.a is int {
|
||||
27 | _ := f.b.a + 5
|
||||
16 | }
|
||||
17 | mut f := Foo{Bar{Abc(0)}}
|
||||
vlib/v/checker/tests/sum_type_mutable_cast_err.vv:19:14: error: cannot use operator `+` with `Abc`
|
||||
17 | mut f := Foo{Bar{Abc(0)}}
|
||||
18 | if f.b.a is int {
|
||||
19 | _ := f.b.a + 5
|
||||
| ^
|
||||
28 | }
|
||||
29 | }
|
||||
20 | }
|
||||
21 | }
|
||||
|
|
|
@ -9,21 +9,13 @@ struct Foo {
|
|||
b Bar
|
||||
}
|
||||
|
||||
struct Bar2 {
|
||||
a Abc
|
||||
}
|
||||
|
||||
struct Foo2 {
|
||||
b Bar2
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mut x := Abc(0)
|
||||
if x is int {
|
||||
_ := x + 5
|
||||
}
|
||||
mut f2 := Foo2{Bar2{Abc(0)}}
|
||||
if f2.b.a is int {
|
||||
mut f := Foo{Bar{Abc(0)}}
|
||||
if f.b.a is int {
|
||||
_ := f.b.a + 5
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue