diff --git a/vlib/v/gen/c/match.v b/vlib/v/gen/c/match.v index 8f6d1ebd9b..040909ddff 100644 --- a/vlib/v/gen/c/match.v +++ b/vlib/v/gen/c/match.v @@ -417,7 +417,7 @@ fn (mut g Gen) should_check_low_bound_in_range_expr(expr ast.RangeExpr, node_con fn (mut g Gen) match_expr_classic(node ast.MatchExpr, is_expr bool, cond_var string, tmp_var string) { node_cond_type_unsigned := node.cond_type in [ast.u16_type, ast.u32_type, ast.u64_type] - type_sym := g.table.sym(node.cond_type) + type_sym := g.table.final_sym(node.cond_type) use_ternary := is_expr && tmp_var.len == 0 for j, branch in node.branches { is_last := j == node.branches.len - 1 diff --git a/vlib/v/tests/alias_string_match_test.v b/vlib/v/tests/alias_string_match_test.v new file mode 100644 index 0000000000..55597fa4aa --- /dev/null +++ b/vlib/v/tests/alias_string_match_test.v @@ -0,0 +1,15 @@ +type ReleaseTarget = string + +const production = ReleaseTarget('production') +const testing = ReleaseTarget('testing') + +fn test_alias_string_match() { + target := match ReleaseTarget('testing') { + production { production } + testing { testing } + else { panic(error('Invalid target')) } + } + + assert target == ReleaseTarget('testing') + assert target == testing +}