From 92129d760d43eb44400f73070357ba944a39b345 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 16 Apr 2020 00:32:56 +0300 Subject: [PATCH] checker: fix false positives for sumtype kind of matches --- vlib/v/checker/checker.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index dcff2b254b..3258fa0433 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -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) } 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 // type => how many times it was used in the match mut all_possible_left_subtypes := map[string]int