From 916a64935a2aab653992732f07f95e13fce57aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=A4schle?= Date: Thu, 10 Dec 2020 16:22:54 +0100 Subject: [PATCH] checker: fix sumtype matching test (#7235) --- .../tests/sum_type_mutable_cast_err.out | 26 +++++++++---------- .../tests/sum_type_mutable_cast_err.vv | 12 ++------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/vlib/v/checker/tests/sum_type_mutable_cast_err.out b/vlib/v/checker/tests/sum_type_mutable_cast_err.out index a70b863c89..a880221f43 100644 --- a/vlib/v/checker/tests/sum_type_mutable_cast_err.out +++ b/vlib/v/checker/tests/sum_type_mutable_cast_err.out @@ -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 - | ^ - 28 | } - 29 | } \ No newline at end of file + 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 + | ^ + 20 | } + 21 | } diff --git a/vlib/v/checker/tests/sum_type_mutable_cast_err.vv b/vlib/v/checker/tests/sum_type_mutable_cast_err.vv index fcea074ff1..d122a1280d 100644 --- a/vlib/v/checker/tests/sum_type_mutable_cast_err.vv +++ b/vlib/v/checker/tests/sum_type_mutable_cast_err.vv @@ -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 } }