From 5159f30c9cec63e467e82ed76d54988f58e3bdcd Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 19 Mar 2024 13:10:35 +0000 Subject: Fix error block handling --- src/check_type.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 5889cbcd0..d5cf187a4 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -3349,7 +3349,7 @@ gb_internal Type *check_type_expr(CheckerContext *ctx, Ast *e, Type *named_type) gbString err_str = expr_to_string(e); defer (gb_string_free(err_str)); - ERROR_BLOCK(); + begin_error_block(); error(e, "'%s' is not a type", err_str); type = t_invalid; @@ -3368,14 +3368,16 @@ gb_internal Type *check_type_expr(CheckerContext *ctx, Ast *e, Type *named_type) defer (gb_string_free(type_str)); error_line("\tSuggestion: Did you mean '[%s]%s'?", index_str ? index_str : "", type_str); + end_error_block(); // NOTE(bill): Minimize error propagation of bad array syntax by treating this like a type if (node->IndexExpr.expr != nullptr) { Ast *pseudo_array_expr = ast_array_type(e->file(), ast_token(node->IndexExpr.expr), node->IndexExpr.index, node->IndexExpr.expr); check_array_type_internal(ctx, pseudo_array_expr, &type, nullptr); } + } else { + end_error_block(); } - } if (type == nullptr) { -- cgit v1.2.3