improved some error messages
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 22 Feb 2021 22:38:00 +0000 (16:38 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 22 Feb 2021 22:38:00 +0000 (16:38 -0600)
bin/onyx
src/onyxastnodes.c
src/onyxchecker.c

index b9065107f876dd2396d7855f36931fef582dacf8..0f8bc0e93a3cf54603eb754ca0f62b982e10671a 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index 606770b4b519468ba15402f4f5f7da24df55b0c8..c3aed5de3d6feedb4f3916baeba3b202241b27c5 100644 (file)
@@ -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);
index 328984c0d021bb63dbf089623ea4c0e6c1348a38..34f674e7dd767b58a866d5c7dfb77722dc96d224 100644 (file)
@@ -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;
     }