fill_in_type((*smem)->initial_value);
if ((*smem)->initial_value->type == NULL) return Check_Yield_Macro;
- (*smem)->type = resolve_expression_type((*smem)->initial_value);
+ resolve_expression_type((*smem)->initial_value);
+ if ((*smem)->type == NULL) (*smem)->type = (*smem)->initial_value->type;
if ((*smem)->type == NULL) {
onyx_report_error((*smem)->initial_value->token->pos, "Unable to deduce type of initial value. This is probably a compiler bug.");
if ((*smem)->initial_value != NULL) {
SYMRES(expression, &(*smem)->initial_value);
+ // CLEANUP: I hate that this is here. The type inference for a struct member should happen once the actual type is known.
+ // There seems to be a problem with setting it in the checker however, because whenever I disable this code, somehow
+ // the compiler gets to the code generation without all the types figured out???
if ((*smem)->type_node == NULL && (*smem)->initial_value->type_node != NULL) {
(*smem)->type_node = (*smem)->initial_value->type_node;
}