Skip to content

Commit

Permalink
fix cond
Browse files Browse the repository at this point in the history
  • Loading branch information
Delta456 committed May 16, 2024
1 parent c5093c5 commit 76215a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vlib/v/checker/infix.v
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type {
}
}

if (unwrapped_left_type.is_any_kind_of_pointer()
|| unwrapped_right_type.is_any_kind_of_pointer()) && node.op !in [.plus, .minus] {
if ((unwrapped_left_type.is_ptr() && !node.left.is_auto_deref_var())
|| (unwrapped_right_type.is_ptr() && !node.right.is_auto_deref_var()))
&& node.op !in [.plus, .minus] {
c.error('infix `${node.op}` is not defined for pointer values', left_right_pos)
}

Expand Down

0 comments on commit 76215a1

Please sign in to comment.