diff options
| author | gingerBill <bill@gingerbill.org> | 2024-03-19 13:10:35 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-03-19 13:10:35 +0000 |
| commit | 5159f30c9cec63e467e82ed76d54988f58e3bdcd (patch) | |
| tree | 61e13b3a88c0711380d7eb34336889a53898d21b /src/check_type.cpp | |
| parent | d5daa9fda59e7b8ad8749f8a7630fb30f1f73a04 (diff) | |
Fix error block handling
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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) { |