Skip to content

Commit 55951e0

Browse files
authored
checker: minor cleanup in if_expr() (#14584)
1 parent d0a1608 commit 55951e0

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

vlib/v/checker/if.v

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,7 @@ pub fn (mut c Checker) if_expr(mut node ast.IfExpr) ast.Type {
274274
}
275275
}
276276
// if only untyped literals were given default to int/f64
277-
if node.typ == ast.int_literal_type {
278-
node.typ = ast.int_type
279-
} else if node.typ == ast.float_literal_type {
280-
node.typ = ast.f64_type
281-
}
277+
node.typ = ast.mktyp(node.typ)
282278
if expr_required && !node.has_else {
283279
d := if node.is_comptime { '$' } else { '' }
284280
c.error('`$if_kind` expression needs `${d}else` clause', node.pos)

0 commit comments

Comments
 (0)