From 55951e09434afba03169fc74bcd883530975d87a Mon Sep 17 00:00:00 2001 From: yuyi Date: Thu, 2 Jun 2022 11:20:09 +0800 Subject: [PATCH] checker: minor cleanup in if_expr() (#14584) --- vlib/v/checker/if.v | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vlib/v/checker/if.v b/vlib/v/checker/if.v index 05648fb399..e24bc32b74 100644 --- a/vlib/v/checker/if.v +++ b/vlib/v/checker/if.v @@ -274,11 +274,7 @@ pub fn (mut c Checker) if_expr(mut node ast.IfExpr) ast.Type { } } // if only untyped literals were given default to int/f64 - if node.typ == ast.int_literal_type { - node.typ = ast.int_type - } else if node.typ == ast.float_literal_type { - node.typ = ast.f64_type - } + node.typ = ast.mktyp(node.typ) if expr_required && !node.has_else { d := if node.is_comptime { '$' } else { '' } c.error('`$if_kind` expression needs `${d}else` clause', node.pos)