From: Brendan Hansen Date: Mon, 22 Feb 2021 22:38:00 +0000 (-0600) Subject: improved some error messages X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=230b23b64ad08749d4efa961bcd8abcff34d620d;p=onyx.git improved some error messages --- diff --git a/bin/onyx b/bin/onyx index b9065107..0f8bc0e9 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/src/onyxastnodes.c b/src/onyxastnodes.c index 606770b4..c3aed5de 100644 --- a/src/onyxastnodes.c +++ b/src/onyxastnodes.c @@ -434,8 +434,7 @@ b32 type_check_or_auto_cast(AstTyped** pnode, Type* type) { } if (node->kind == Ast_Kind_Array_Literal && node->type_node == NULL) { - i32 value_count = bh_arr_length(((AstArrayLiteral *) node)->values); - node->type = type; // type_make_array(context.ast_alloc, type, value_count); + node->type = type; node->flags |= Ast_Flag_Array_Literal_Typed; add_entities_for_node(NULL, (AstNode *) node, NULL, NULL); diff --git a/src/onyxchecker.c b/src/onyxchecker.c index 328984c0..34f674e7 100644 --- a/src/onyxchecker.c +++ b/src/onyxchecker.c @@ -1045,7 +1045,9 @@ CheckStatus check_struct_literal(AstStructLiteral* sl) { } if (!type_is_structlike_strict(sl->type)) { - onyx_report_error(sl->token->pos, "Type is not a constructable using a struct literal."); + onyx_report_error(sl->token->pos, + "'%s' is not a constructable using a struct literal.", + type_get_name(sl->type)); return Check_Error; } @@ -1200,7 +1202,7 @@ CheckStatus check_address_of(AstAddressOf* aof) { && aof->expr->kind != Ast_Kind_Memres && aof->expr->kind != Ast_Kind_Local) || (aof->expr->flags & Ast_Flag_Cannot_Take_Addr) != 0) { - onyx_report_error(aof->token->pos, "Cannot take the address of value."); + onyx_report_error(aof->token->pos, "Cannot take the address of something that is not an l-value."); return Check_Error; }