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