diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index c7d6f21fb1350f..30f648ac07d5a7 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -534,7 +534,7 @@ fn (mut c Checker) check_shift(mut node ast.InfixExpr, left_type_ ast.Type, righ left_sym_final := c.table.final_sym(left_type) left_type_final := ast.Type(left_sym_final.idx) if node.op == .left_shift && left_type_final.is_signed() && !(c.inside_unsafe - && c.is_generated) { + && c.is_generated) && !c.pref.translated && !c.file.is_translated { c.note('shifting a value from a signed type `${left_sym_final.name}` can change the sign', node.left.pos()) } diff --git a/vlib/v/checker/tests/no_sign_notice_in_translated.out b/vlib/v/checker/tests/no_sign_notice_in_translated.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/vlib/v/checker/tests/no_sign_notice_in_translated.vv b/vlib/v/checker/tests/no_sign_notice_in_translated.vv new file mode 100644 index 00000000000000..a1f8247d39e43f --- /dev/null +++ b/vlib/v/checker/tests/no_sign_notice_in_translated.vv @@ -0,0 +1,10 @@ +@[translated] +module main + +fn f(i i32) i32 { + return i << 2 +} + +fn main() { + assert f(3) == 12 +}