This is untested in larger code bases if this actually makes a quality of life improvement
u32 type_size_of(Type* type);
u32 type_alignment_of(Type* type);
Type* type_build_from_ast(bh_allocator alloc, struct AstType* type_node);
-Type* type_build_implicit_type_of_struct_literal(bh_allocator alloc, struct AstStructLiteral* lit);
+Type* type_build_implicit_type_of_struct_literal(bh_allocator alloc, struct AstStructLiteral* lit, b32 is_query);
Type* type_build_function_type(bh_allocator alloc, struct AstFunction* func);
Type* type_build_compound_type(bh_allocator alloc, struct AstCompound* compound);
return NULL;
}
- return type_build_implicit_type_of_struct_literal(context.ast_alloc, sl);
+ return type_build_implicit_type_of_struct_literal(context.ast_alloc, sl, 1);
}
// If polymorphic procedures HAVE to have a type, most likely
return NULL;
}
- sl->type = type_build_implicit_type_of_struct_literal(context.ast_alloc, sl);
+ sl->type = type_build_implicit_type_of_struct_literal(context.ast_alloc, sl, 0);
if (sl->type) {
add_entities_for_node(NULL, (AstNode *) sl, NULL, NULL);
}
return comp_type;
}
-Type* type_build_implicit_type_of_struct_literal(bh_allocator alloc, AstStructLiteral* lit) {
+Type* type_build_implicit_type_of_struct_literal(bh_allocator alloc, AstStructLiteral* lit, b32 is_query) {
if (lit->generated_inferred_type) {
return lit->generated_inferred_type;
}
Type* member_type = resolve_expression_type(nv->value);
if (member_type == NULL) {
+ if (!is_query) {
+ onyx_report_error(nv->value->token->pos, Error_Critical, "Unable to resolve type of this member when trying to construct an inferred type of the structure literal.");
+ }
+
return NULL;
}