@@ -7,6 +7,8 @@ use semantic::{Condition, MatchArmSelector};
77
88use super :: block_builder:: { BlockBuilder , SealedBlockBuilder } ;
99use super :: context:: { LoweredExpr , LoweringContext , LoweringFlowError , LoweringResult } ;
10+ use super :: flow_control:: create_graph:: create_graph_expr_if;
11+ use super :: flow_control:: lower_graph:: lower_graph;
1012use super :: lowered_expr_to_block_scope_end;
1113use crate :: diagnostic:: LoweringDiagnosticKind :: { self } ;
1214use crate :: diagnostic:: { LoweringDiagnosticsBuilder , MatchDiagnostic , MatchError , MatchKind } ;
@@ -44,6 +46,11 @@ pub fn lower_expr_if<'db>(
4446 builder : & mut BlockBuilder < ' db > ,
4547 expr : & semantic:: ExprIf < ' db > ,
4648) -> LoweringResult < ' db , LoweredExpr < ' db > > {
49+ if expr. conditions . len ( ) == 1 && matches ! ( expr. conditions[ 0 ] , Condition :: BoolExpr ( _) ) {
50+ let graph = create_graph_expr_if ( ctx, expr) ;
51+ return lower_graph ( ctx, builder, & graph, ctx. get_location ( expr. stable_ptr . untyped ( ) ) ) ;
52+ }
53+
4754 // Else block is not supported yet for multiple conditions.
4855 if expr. conditions . len ( ) > 1 {
4956 if let Some ( else_block) = expr. else_block {
0 commit comments