feat: support boolean conditional expressions
This commit is contained in:
@@ -1615,6 +1615,14 @@ demand proc(state @mut State, id ast.NodeId, expected Type, code diagnostics.Cod
|
||||
return
|
||||
}
|
||||
}
|
||||
if (state.cells[usize(id)].role == .expression and ast.expr_kind(state.tree, id) == .match_expr) {
|
||||
state.cells[index].expected = expected
|
||||
for 0..ast.match_arm_count(state.tree, id) |i| {
|
||||
arm :: ast.match_arm_view(state.tree, ast.match_arm(state.tree, id, i))
|
||||
if (arm.expression) try demand(state, arm.body, expected, code)
|
||||
}
|
||||
return
|
||||
}
|
||||
if (expected.kind == .fallible) {
|
||||
descriptor :: state.arrays.items[usize(expected.array_type)]
|
||||
actual := group_type(state, id)
|
||||
@@ -1691,14 +1699,6 @@ demand proc(state @mut State, id ast.NodeId, expected Type, code diagnostics.Cod
|
||||
state.pointers.items[usize(expected.pointer_type)].element, code)
|
||||
return
|
||||
}
|
||||
if (state.cells[usize(id)].role == .expression and ast.expr_kind(state.tree, id) == .match_expr) {
|
||||
state.cells[index].expected = expected
|
||||
for 0..ast.match_arm_count(state.tree, id) |i| {
|
||||
arm :: ast.match_arm_view(state.tree, ast.match_arm(state.tree, id, i))
|
||||
if (arm.expression) try demand(state, arm.body, expected, code)
|
||||
}
|
||||
return
|
||||
}
|
||||
literal_node :: state.cells[index].literal
|
||||
if (
|
||||
expected.nominal != ast.NodeId(maxval!(u32))
|
||||
|
||||
Reference in New Issue
Block a user