Skip to content

Commit

Permalink
checker: minor cleanup in smartcast_if_conds() (#23542)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 authored Jan 21, 2025
1 parent 2a69b7c commit bff90d0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions vlib/v/checker/if.v
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,7 @@ fn (mut c Checker) smartcast_if_conds(mut node ast.Expr, mut scope ast.Scope, co
// handles unwrapping on if var == none { /**/ } else { /*unwrapped var*/ }
if mut first_cond is ast.InfixExpr {
if first_cond.left is ast.Ident && first_cond.op == .eq && first_cond.right is ast.None {
if first_cond.left is ast.Ident
&& c.comptime.get_ct_type_var(first_cond.left) == .smartcast {
if c.comptime.get_ct_type_var(first_cond.left) == .smartcast {
first_cond.left_type = c.type_resolver.get_type(first_cond.left)
c.smartcast(mut first_cond.left, first_cond.left_type, first_cond.left_type.clear_flag(.option), mut
scope, true, true)
Expand Down

0 comments on commit bff90d0

Please sign in to comment.