Fix constant literals using the wrong type

This commit is contained in:
gingerBill
2023-09-19 15:12:44 +01:00
parent 6e49b1cad7
commit 3505c1d790
+2 -2
View File
@@ -467,7 +467,7 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
} }
if (value.kind == ExactValue_Invalid) { if (value.kind == ExactValue_Invalid) {
return lb_const_nil(m, type); return lb_const_nil(m, original_type);
} }
if (value.kind == ExactValue_Procedure) { if (value.kind == ExactValue_Procedure) {
@@ -1059,6 +1059,7 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
values[index] = lb_const_value(m, f->type, {}, false).value; values[index] = lb_const_value(m, f->type, {}, false).value;
visited[index] = true; visited[index] = true;
} }
unsigned idx_list_len = cast(unsigned)sel.index.count-1; unsigned idx_list_len = cast(unsigned)sel.index.count-1;
unsigned *idx_list = gb_alloc_array(temporary_allocator(), unsigned, idx_list_len); unsigned *idx_list = gb_alloc_array(temporary_allocator(), unsigned, idx_list_len);
@@ -1171,7 +1172,6 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
} }
} }
return lb_addr_load(p, v); return lb_addr_load(p, v);
} }
} else if (is_type_bit_set(type)) { } else if (is_type_bit_set(type)) {
ast_node(cl, CompoundLit, value.value_compound); ast_node(cl, CompoundLit, value.value_compound);