From 6a8a22891dd80789fd0bd6057ddc543bd5071049 Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 11 Jul 2023 02:22:13 +0800 Subject: [PATCH] checker: fix autocast in complex if condtions 5 (#18833) --- vlib/v/checker/infix.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vlib/v/checker/infix.v b/vlib/v/checker/infix.v index 13dcdb6057..efe2bae4a8 100644 --- a/vlib/v/checker/infix.v +++ b/vlib/v/checker/infix.v @@ -857,6 +857,11 @@ fn (mut c Checker) autocast_in_if_conds(mut right ast.Expr, from_expr ast.Expr, ast.ParExpr { c.autocast_in_if_conds(mut right.expr, from_expr, from_type, to_type) } + ast.AsCast { + if right.typ != to_type { + c.autocast_in_if_conds(mut right.expr, from_expr, from_type, to_type) + } + } ast.PrefixExpr { c.autocast_in_if_conds(mut right.right, from_expr, from_type, to_type) }