From 0dd385d48049277da5c4a4f2183f22d2e97a7e74 Mon Sep 17 00:00:00 2001 From: yuyi Date: Wed, 23 Dec 2020 16:14:32 +0800 Subject: [PATCH] checker: merge mul_op_wrong_type_err tests to just one (#7491) --- .../tests/mul_op_wrong_left_type_err_a.out | 6 -- .../tests/mul_op_wrong_left_type_err_a.vv | 4 -- .../tests/mul_op_wrong_left_type_err_b.out | 5 -- .../tests/mul_op_wrong_left_type_err_b.vv | 3 - .../tests/mul_op_wrong_left_type_err_c.out | 6 -- .../tests/mul_op_wrong_left_type_err_c.vv | 4 -- .../tests/mul_op_wrong_left_type_err_d.out | 7 --- .../tests/mul_op_wrong_left_type_err_d.vv | 8 --- .../tests/mul_op_wrong_right_type_err_a.out | 6 -- .../tests/mul_op_wrong_right_type_err_a.vv | 4 -- .../tests/mul_op_wrong_right_type_err_b.out | 5 -- .../tests/mul_op_wrong_right_type_err_b.vv | 3 - .../tests/mul_op_wrong_right_type_err_c.out | 6 -- .../tests/mul_op_wrong_right_type_err_c.vv | 4 -- .../tests/mul_op_wrong_right_type_err_d.out | 7 --- .../tests/mul_op_wrong_right_type_err_d.vv | 8 --- .../v/checker/tests/mul_op_wrong_type_err.out | 56 +++++++++++++++++++ vlib/v/checker/tests/mul_op_wrong_type_err.vv | 17 ++++++ 18 files changed, 73 insertions(+), 86 deletions(-) delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_d.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_left_type_err_d.vv delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_d.out delete mode 100644 vlib/v/checker/tests/mul_op_wrong_right_type_err_d.vv create mode 100644 vlib/v/checker/tests/mul_op_wrong_type_err.out create mode 100644 vlib/v/checker/tests/mul_op_wrong_type_err.vv diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out b/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out deleted file mode 100644 index e39f1dd7ea..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out +++ /dev/null @@ -1,6 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv:3:13: error: mismatched types `Aaa` and `any_int` - 1 | struct Aaa{} - 2 | fn main() { - 3 | println(Aaa{} * 10) - | ~~~~~ - 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv b/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv deleted file mode 100644 index 67193c9dd3..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv +++ /dev/null @@ -1,4 +0,0 @@ -struct Aaa{} -fn main() { - println(Aaa{} * 10) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out b/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out deleted file mode 100644 index 62a98b6dde..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out +++ /dev/null @@ -1,5 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv:2:13: error: mismatched types `[]int` and `any_int` - 1 | fn main() { - 2 | println([1,2,3] * 10) - | ~~~~~~~ - 3 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv b/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv deleted file mode 100644 index 26f7682ffd..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println([1,2,3] * 10) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out b/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out deleted file mode 100644 index f2791d1c2a..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out +++ /dev/null @@ -1,6 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv:3:13: error: mismatched types `map[string]int` and `any_int` - 1 | fn main() { - 2 | a := map[string]int - 3 | println(a * 10) - | ^ - 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv b/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv deleted file mode 100644 index 305b401562..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - a := map[string]int - println(a * 10) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_d.out b/vlib/v/checker/tests/mul_op_wrong_left_type_err_d.out deleted file mode 100644 index 062ecdf41f..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_d.out +++ /dev/null @@ -1,7 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_left_type_err_d.vv:6:11: error: infix expr: cannot use `any_float` (right expression) as `math.complex.Complex` - 4 | fn main() { - 5 | c1 := cmplx.complex(1,-2) - 6 | c2 := c1 * 2.0 - | ^ - 7 | println(c2) - 8 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_d.vv b/vlib/v/checker/tests/mul_op_wrong_left_type_err_d.vv deleted file mode 100644 index e1a12f9777..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_d.vv +++ /dev/null @@ -1,8 +0,0 @@ -import math -import math.complex as cmplx - -fn main() { - c1 := cmplx.complex(1,-2) - c2 := c1 * 2.0 - println(c2) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out b/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out deleted file mode 100644 index cc17c524e6..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out +++ /dev/null @@ -1,6 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv:3:18: error: mismatched types `any_int` and `Aaa` - 1 | struct Aaa{} - 2 | fn main() { - 3 | println(10 * Aaa{}) - | ~~~~~ - 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv b/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv deleted file mode 100644 index d98f0297b6..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv +++ /dev/null @@ -1,4 +0,0 @@ -struct Aaa{} -fn main() { - println(10 * Aaa{}) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out b/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out deleted file mode 100644 index 495fd5b1f7..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out +++ /dev/null @@ -1,5 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv:2:18: error: mismatched types `any_int` and `[]int` - 1 | fn main() { - 2 | println(10 * [1,2,3]) - | ~~~~~~~ - 3 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv b/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv deleted file mode 100644 index 0b30519af3..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println(10 * [1,2,3]) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out b/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out deleted file mode 100644 index cda90fb4be..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out +++ /dev/null @@ -1,6 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv:3:18: error: mismatched types `any_int` and `map[string]int` - 1 | fn main() { - 2 | a := map[string]int - 3 | println(10 * a) - | ^ - 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv b/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv deleted file mode 100644 index c4b2d947af..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - a := map[string]int - println(10 * a) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_d.out b/vlib/v/checker/tests/mul_op_wrong_right_type_err_d.out deleted file mode 100644 index 1c227660e9..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_d.out +++ /dev/null @@ -1,7 +0,0 @@ -vlib/v/checker/tests/mul_op_wrong_right_type_err_d.vv:6:12: error: infix expr: cannot use `math.complex.Complex` (right expression) as `any_float` - 4 | fn main() { - 5 | c1 := cmplx.complex(1,-2) - 6 | c2 := 2.0 * c1 - | ^ - 7 | println(c2) - 8 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_d.vv b/vlib/v/checker/tests/mul_op_wrong_right_type_err_d.vv deleted file mode 100644 index 6f754fe5b9..0000000000 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_d.vv +++ /dev/null @@ -1,8 +0,0 @@ -import math -import math.complex as cmplx - -fn main() { - c1 := cmplx.complex(1,-2) - c2 := 2.0 * c1 - println(c2) -} diff --git a/vlib/v/checker/tests/mul_op_wrong_type_err.out b/vlib/v/checker/tests/mul_op_wrong_type_err.out new file mode 100644 index 0000000000..ad99d1fae7 --- /dev/null +++ b/vlib/v/checker/tests/mul_op_wrong_type_err.out @@ -0,0 +1,56 @@ +vlib/v/checker/tests/mul_op_wrong_type_err.vv:5:13: error: mismatched types `Aaa` and `any_int` + 3 | struct Aaa{} + 4 | fn main() { + 5 | println(Aaa{} * 10) + | ~~~~~ + 6 | println(10 * Aaa{}) + 7 | println([1,2,3] * 10) +vlib/v/checker/tests/mul_op_wrong_type_err.vv:6:18: error: mismatched types `any_int` and `Aaa` + 4 | fn main() { + 5 | println(Aaa{} * 10) + 6 | println(10 * Aaa{}) + | ~~~~~ + 7 | println([1,2,3] * 10) + 8 | println(10 * [1,2,3]) +vlib/v/checker/tests/mul_op_wrong_type_err.vv:7:13: error: mismatched types `[]int` and `any_int` + 5 | println(Aaa{} * 10) + 6 | println(10 * Aaa{}) + 7 | println([1,2,3] * 10) + | ~~~~~~~ + 8 | println(10 * [1,2,3]) + 9 | a := map[string]int +vlib/v/checker/tests/mul_op_wrong_type_err.vv:8:18: error: mismatched types `any_int` and `[]int` + 6 | println(10 * Aaa{}) + 7 | println([1,2,3] * 10) + 8 | println(10 * [1,2,3]) + | ~~~~~~~ + 9 | a := map[string]int + 10 | println(a * 10) +vlib/v/checker/tests/mul_op_wrong_type_err.vv:10:13: error: mismatched types `map[string]int` and `any_int` + 8 | println(10 * [1,2,3]) + 9 | a := map[string]int + 10 | println(a * 10) + | ^ + 11 | println(10 * a) + 12 | c1 := cmplx.complex(1,-2) +vlib/v/checker/tests/mul_op_wrong_type_err.vv:11:18: error: mismatched types `any_int` and `map[string]int` + 9 | a := map[string]int + 10 | println(a * 10) + 11 | println(10 * a) + | ^ + 12 | c1 := cmplx.complex(1,-2) + 13 | c2 := c1 * 2.0 +vlib/v/checker/tests/mul_op_wrong_type_err.vv:13:11: error: infix expr: cannot use `any_float` (right expression) as `math.complex.Complex` + 11 | println(10 * a) + 12 | c1 := cmplx.complex(1,-2) + 13 | c2 := c1 * 2.0 + | ^ + 14 | println(c2) + 15 | c3 := 2.0 * c1 +vlib/v/checker/tests/mul_op_wrong_type_err.vv:15:12: error: infix expr: cannot use `math.complex.Complex` (right expression) as `any_float` + 13 | c2 := c1 * 2.0 + 14 | println(c2) + 15 | c3 := 2.0 * c1 + | ^ + 16 | println(c3) + 17 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_type_err.vv b/vlib/v/checker/tests/mul_op_wrong_type_err.vv new file mode 100644 index 0000000000..a1e3394ce2 --- /dev/null +++ b/vlib/v/checker/tests/mul_op_wrong_type_err.vv @@ -0,0 +1,17 @@ +import math +import math.complex as cmplx +struct Aaa{} +fn main() { + println(Aaa{} * 10) + println(10 * Aaa{}) + println([1,2,3] * 10) + println(10 * [1,2,3]) + a := map[string]int + println(a * 10) + println(10 * a) + c1 := cmplx.complex(1,-2) + c2 := c1 * 2.0 + println(c2) + c3 := 2.0 * c1 + println(c3) +}