From 5cc9d7b347bf479c311135fdc55de7cc8480858d Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 25 Sep 2022 11:02:46 +0300 Subject: [PATCH] checker: remove too vague notice about signed expressions while returning unsigned number types --- vlib/v/checker/return.v | 5 ----- vlib/v/checker/tests/fn_return_unsign_type_mismatch.out | 6 ------ 2 files changed, 11 deletions(-) diff --git a/vlib/v/checker/return.v b/vlib/v/checker/return.v index 16c0d8999..7736c2d2d 100644 --- a/vlib/v/checker/return.v +++ b/vlib/v/checker/return.v @@ -122,11 +122,6 @@ pub fn (mut c Checker) return_stmt(mut node ast.Return) { c.note('cannot use a negative value as value of type `${c.table.type_to_str(exp_type)}` in return argument', pos) } - } else { - if node.exprs[expr_idxs[i]] !is ast.Ident { - c.note('use signed type `${c.table.type_to_str(got_typ)}` as unsigned type `${c.table.type_to_str(exp_type)}` in return argument may cause unexpected', - pos) - } } } } else { diff --git a/vlib/v/checker/tests/fn_return_unsign_type_mismatch.out b/vlib/v/checker/tests/fn_return_unsign_type_mismatch.out index dd2014753..a44dd3d55 100644 --- a/vlib/v/checker/tests/fn_return_unsign_type_mismatch.out +++ b/vlib/v/checker/tests/fn_return_unsign_type_mismatch.out @@ -1,9 +1,3 @@ -vlib/v/checker/tests/fn_return_unsign_type_mismatch.vv:2:9: notice: use signed type `int literal` as unsigned type `u64` in return argument may cause unexpected - 1 | fn foo() u64 { - 2 | return -(3 - 1) - | ^ - 3 | } - 4 | vlib/v/checker/tests/fn_return_unsign_type_mismatch.vv:6:9: notice: cannot use a negative value as value of type `u64` in return argument 4 | 5 | fn bar() u64 { -- 2.39.5