1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: fix autocast in complex if condtions 5 (#18833)

This commit is contained in:
yuyi 2023-07-11 02:22:13 +08:00 committed by GitHub
parent acd581add5
commit 6a8a22891d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}