checker: c2v infix fix

Alexander Medvednikov 2022-05-22 14:53:17 +03:00 committed by Jef Roosens
parent 38709f3e6f
commit 1679e07619
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 2 additions and 1 deletions

View File

@ -594,7 +594,8 @@ pub fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
left_right_pos)
} else if left_type.is_ptr() {
for_ptr_op := c.table.type_is_for_pointer_arithmetic(left_type)
if left_sym.language == .v && !c.inside_unsafe && !for_ptr_op && right_type.is_int() {
if left_sym.language == .v && !c.pref.translated && !c.inside_unsafe && !for_ptr_op
&& right_type.is_int() {
sugg := ' (you can use it inside an `unsafe` block)'
c.error('infix expr: cannot use `$right_sym.name` (right expression) as `$left_sym.name` $sugg',
left_right_pos)