From 5292e08cd6261752e72c84fee7a6ff80662a1141 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Mon, 4 Aug 2025 22:13:37 +0200 Subject: [PATCH] Remove lambda code that should never happen. --- src/compiler/sema_expr.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 00929a012..f20b67c4f 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -10083,11 +10083,7 @@ static inline bool sema_expr_analyse_lambda(SemaContext *context, Type *target_t { Decl *decl = expr->lambda_expr; if (!decl_ok(decl)) return false; - if (decl->resolve_status == RESOLVE_DONE) - { - expr->type = type_get_func_ptr(decl->type); - return true; - } + assert(decl->resolve_status != RESOLVE_DONE); Type *flat = target_type ? type_flatten(target_type) : NULL; if (flat) { @@ -10224,19 +10220,18 @@ static inline bool sema_expr_analyse_lambda(SemaContext *context, Type *target_t } expr->type = type_get_func_ptr(decl->type); - // If it's a distinct type we have to make a cast. expr->resolve_status = RESOLVE_DONE; + expr_rewrite_const_ref(expr, decl); + // If it's a distinct type we have to make a cast. if (target_type && expr->type != target_type && !cast_explicit(context, expr, target_type)) return false; if (multiple) { vec_add(original->func_decl.generated_lambda, decl); } decl->resolve_status = RESOLVE_DONE; - expr_rewrite_const_ref(expr, decl); return true; FAIL_NO_INFER: - SEMA_ERROR(expr, "Inferred lambda expressions cannot be used unless the type can be determined."); - return false; + RETURN_SEMA_ERROR(expr, "Inferred lambda expressions cannot be used unless the type can be determined."); } static inline bool sema_expr_analyse_ct_feature(SemaContext *context, Expr *expr)