checker: fix false positives for sumtype kind of matches
parent
6a186e8f11
commit
92129d760d
|
@ -1353,6 +1353,9 @@ pub fn (c mut Checker) match_expr(node mut ast.MatchExpr) table.Type {
|
||||||
c.error('match 0 cond type', node.pos)
|
c.error('match 0 cond type', node.pos)
|
||||||
}
|
}
|
||||||
type_sym := c.table.get_type_symbol(cond_type)
|
type_sym := c.table.get_type_symbol(cond_type)
|
||||||
|
if type_sym.kind != .sum_type {
|
||||||
|
node.is_sum_type = false
|
||||||
|
}
|
||||||
// all_possible_left_subtypes is a histogram of
|
// all_possible_left_subtypes is a histogram of
|
||||||
// type => how many times it was used in the match
|
// type => how many times it was used in the match
|
||||||
mut all_possible_left_subtypes := map[string]int
|
mut all_possible_left_subtypes := map[string]int
|
||||||
|
|
Loading…
Reference in New Issue