File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ fn (mut c Checker) match_expr(mut node ast.MatchExpr) ast.Type {
74
74
}
75
75
stmt.typ = expr_type
76
76
if first_iteration {
77
- if node.expected_type.has_flag (.option) || node.expected_type. has_flag (.result )
77
+ if node.expected_type.has_option_or_result ( )
78
78
|| c.table.type_kind (node.expected_type) in [.sum_type, .multi_return] {
79
79
c.check_match_branch_last_stmt (stmt, node.expected_type, expr_type)
80
80
ret_type = node.expected_type
@@ -100,8 +100,7 @@ fn (mut c Checker) match_expr(mut node ast.MatchExpr) ast.Type {
100
100
}
101
101
} else {
102
102
if ret_type.idx () != expr_type.idx () {
103
- if (node.expected_type.has_flag (.option)
104
- || node.expected_type.has_flag (.result))
103
+ if node.expected_type.has_option_or_result ()
105
104
&& c.table.sym (stmt.typ).kind == .struct_
106
105
&& c.type_implements (stmt.typ, ast.error_type, node.pos) {
107
106
stmt.expr = ast.CastExpr{
You can’t perform that action at this time.
0 commit comments