checker: minor cleanup in match_expr() (#10261)

pull/10269/head
yuyi 2021-05-30 18:33:19 +08:00 committed by GitHub
parent ba86d619fa
commit c67891d69f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -5330,11 +5330,7 @@ pub fn (mut c Checker) match_expr(mut node ast.MatchExpr) ast.Type {
c.ensure_type_exists(node.cond_type, node.pos) or { return ast.void_type }
c.check_expr_opt_call(node.cond, cond_type)
cond_type_sym := c.table.get_type_symbol(cond_type)
if cond_type_sym.kind !in [.interface_, .sum_type] {
node.is_sum_type = false
} else {
node.is_sum_type = true
}
node.is_sum_type = cond_type_sym.kind in [.interface_, .sum_type]
c.match_exprs(mut node, cond_type_sym)
c.expected_type = cond_type
mut ret_type := ast.void_type