authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-05 18:42:56-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-05 18:42:56-04:00
log8400163e0245f68833e29db22ae3bcc1fb8bf9ae
tree5eb0d4463b2437534963159147b16af5a120ce44
parent1f5c7ff4d7360f83f83f422adf167df5d756e3b4
signaturelock-open Commit is signed but in an unrecognized format.

stage1: rename more TypeTableEntry types to ZigType


4 files changed, 1920 insertions(+), 1920 deletions(-)

src/all_types.hpp+52-52
......@@ -1004,7 +1004,7 @@ enum PtrLen {
10041004 PtrLenSingle,
10051005};
10061006
1007struct TypeTableEntryPointer {
1007struct ZigTypePointer {
10081008 ZigType *child_type;
10091009 PtrLen ptr_len;
10101010 bool is_const;
......@@ -1015,16 +1015,16 @@ struct TypeTableEntryPointer {
10151015 ZigType *slice_parent;
10161016};
10171017
1018struct TypeTableEntryInt {
1018struct ZigTypeInt {
10191019 uint32_t bit_count;
10201020 bool is_signed;
10211021};
10221022
1023struct TypeTableEntryFloat {
1023struct ZigTypeFloat {
10241024 size_t bit_count;
10251025};
10261026
1027struct TypeTableEntryArray {
1027struct ZigTypeArray {
10281028 ZigType *child_type;
10291029 uint64_t len;
10301030};
......@@ -1040,7 +1040,7 @@ struct TypeStructField {
10401040 size_t unaligned_bit_count;
10411041 AstNode *decl_node;
10421042};
1043struct TypeTableEntryStruct {
1043struct ZigTypeStruct {
10441044 AstNode *decl_node;
10451045 ContainerLayout layout;
10461046 uint32_t src_field_count;
......@@ -1068,22 +1068,22 @@ struct TypeTableEntryStruct {
10681068 HashMap<Buf *, TypeStructField *, buf_hash, buf_eql_buf> fields_by_name;
10691069};
10701070
1071struct TypeTableEntryOptional {
1071struct ZigTypeOptional {
10721072 ZigType *child_type;
10731073};
10741074
1075struct TypeTableEntryErrorUnion {
1075struct ZigTypeErrorUnion {
10761076 ZigType *err_set_type;
10771077 ZigType *payload_type;
10781078};
10791079
1080struct TypeTableEntryErrorSet {
1080struct ZigTypeErrorSet {
10811081 uint32_t err_count;
10821082 ErrorTableEntry **errors;
10831083 ZigFn *infer_fn;
10841084};
10851085
1086struct TypeTableEntryEnum {
1086struct ZigTypeEnum {
10871087 AstNode *decl_node;
10881088 ContainerLayout layout;
10891089 uint32_t src_field_count;
......@@ -1110,7 +1110,7 @@ struct TypeTableEntryEnum {
11101110uint32_t type_ptr_hash(const ZigType *ptr);
11111111bool type_ptr_eql(const ZigType *a, const ZigType *b);
11121112
1113struct TypeTableEntryUnion {
1113struct ZigTypeUnion {
11141114 AstNode *decl_node;
11151115 ContainerLayout layout;
11161116 uint32_t src_field_count;
......@@ -1154,7 +1154,7 @@ struct FnGenParamInfo {
11541154 ZigType *type;
11551155};
11561156
1157struct TypeTableEntryFn {
1157struct ZigTypeFn {
11581158 FnTypeId fn_type_id;
11591159 bool is_generic;
11601160 ZigType *gen_return_type;
......@@ -1166,42 +1166,42 @@ struct TypeTableEntryFn {
11661166 ZigType *bound_fn_parent;
11671167};
11681168
1169struct TypeTableEntryBoundFn {
1169struct ZigTypeBoundFn {
11701170 ZigType *fn_type;
11711171};
11721172
1173struct TypeTableEntryPromise {
1173struct ZigTypePromise {
11741174 // null if `promise` instead of `promise->T`
11751175 ZigType *result_type;
11761176};
11771177
11781178enum ZigTypeId {
1179 TypeTableEntryIdInvalid,
1180 TypeTableEntryIdMetaType,
1181 TypeTableEntryIdVoid,
1182 TypeTableEntryIdBool,
1183 TypeTableEntryIdUnreachable,
1184 TypeTableEntryIdInt,
1185 TypeTableEntryIdFloat,
1186 TypeTableEntryIdPointer,
1187 TypeTableEntryIdArray,
1188 TypeTableEntryIdStruct,
1189 TypeTableEntryIdComptimeFloat,
1190 TypeTableEntryIdComptimeInt,
1191 TypeTableEntryIdUndefined,
1192 TypeTableEntryIdNull,
1193 TypeTableEntryIdOptional,
1194 TypeTableEntryIdErrorUnion,
1195 TypeTableEntryIdErrorSet,
1196 TypeTableEntryIdEnum,
1197 TypeTableEntryIdUnion,
1198 TypeTableEntryIdFn,
1199 TypeTableEntryIdNamespace,
1200 TypeTableEntryIdBlock,
1201 TypeTableEntryIdBoundFn,
1202 TypeTableEntryIdArgTuple,
1203 TypeTableEntryIdOpaque,
1204 TypeTableEntryIdPromise,
1179 ZigTypeIdInvalid,
1180 ZigTypeIdMetaType,
1181 ZigTypeIdVoid,
1182 ZigTypeIdBool,
1183 ZigTypeIdUnreachable,
1184 ZigTypeIdInt,
1185 ZigTypeIdFloat,
1186 ZigTypeIdPointer,
1187 ZigTypeIdArray,
1188 ZigTypeIdStruct,
1189 ZigTypeIdComptimeFloat,
1190 ZigTypeIdComptimeInt,
1191 ZigTypeIdUndefined,
1192 ZigTypeIdNull,
1193 ZigTypeIdOptional,
1194 ZigTypeIdErrorUnion,
1195 ZigTypeIdErrorSet,
1196 ZigTypeIdEnum,
1197 ZigTypeIdUnion,
1198 ZigTypeIdFn,
1199 ZigTypeIdNamespace,
1200 ZigTypeIdBlock,
1201 ZigTypeIdBoundFn,
1202 ZigTypeIdArgTuple,
1203 ZigTypeIdOpaque,
1204 ZigTypeIdPromise,
12051205};
12061206
12071207struct ZigType {
......@@ -1216,19 +1216,19 @@ struct ZigType {
12161216 bool gen_h_loop_flag;
12171217
12181218 union {
1219 TypeTableEntryPointer pointer;
1220 TypeTableEntryInt integral;
1221 TypeTableEntryFloat floating;
1222 TypeTableEntryArray array;
1223 TypeTableEntryStruct structure;
1224 TypeTableEntryOptional maybe;
1225 TypeTableEntryErrorUnion error_union;
1226 TypeTableEntryErrorSet error_set;
1227 TypeTableEntryEnum enumeration;
1228 TypeTableEntryUnion unionation;
1229 TypeTableEntryFn fn;
1230 TypeTableEntryBoundFn bound_fn;
1231 TypeTableEntryPromise promise;
1219 ZigTypePointer pointer;
1220 ZigTypeInt integral;
1221 ZigTypeFloat floating;
1222 ZigTypeArray array;
1223 ZigTypeStruct structure;
1224 ZigTypeOptional maybe;
1225 ZigTypeErrorUnion error_union;
1226 ZigTypeErrorSet error_set;
1227 ZigTypeEnum enumeration;
1228 ZigTypeUnion unionation;
1229 ZigTypeFn fn;
1230 ZigTypeBoundFn bound_fn;
1231 ZigTypePromise promise;
12321232 } data;
12331233
12341234 // use these fields to make sure we don't duplicate type table entries for the same type
src/analyze.cpp+695-695
......@@ -77,11 +77,11 @@ ZigType *new_type_table_entry(ZigTypeId id) {
7777}
7878
7979static ScopeDecls **get_container_scope_ptr(ZigType *type_entry) {
80 if (type_entry->id == TypeTableEntryIdStruct) {
80 if (type_entry->id == ZigTypeIdStruct) {
8181 return &type_entry->data.structure.decls_scope;
82 } else if (type_entry->id == TypeTableEntryIdEnum) {
82 } else if (type_entry->id == ZigTypeIdEnum) {
8383 return &type_entry->data.enumeration.decls_scope;
84 } else if (type_entry->id == TypeTableEntryIdUnion) {
84 } else if (type_entry->id == ZigTypeIdUnion) {
8585 return &type_entry->data.unionation.decls_scope;
8686 }
8787 zig_unreachable();
......@@ -220,36 +220,36 @@ static uint8_t bits_needed_for_unsigned(uint64_t x) {
220220
221221AstNode *type_decl_node(ZigType *type_entry) {
222222 switch (type_entry->id) {
223 case TypeTableEntryIdInvalid:
223 case ZigTypeIdInvalid:
224224 zig_unreachable();
225 case TypeTableEntryIdStruct:
225 case ZigTypeIdStruct:
226226 return type_entry->data.structure.decl_node;
227 case TypeTableEntryIdEnum:
227 case ZigTypeIdEnum:
228228 return type_entry->data.enumeration.decl_node;
229 case TypeTableEntryIdUnion:
229 case ZigTypeIdUnion:
230230 return type_entry->data.unionation.decl_node;
231 case TypeTableEntryIdOpaque:
232 case TypeTableEntryIdMetaType:
233 case TypeTableEntryIdVoid:
234 case TypeTableEntryIdBool:
235 case TypeTableEntryIdUnreachable:
236 case TypeTableEntryIdInt:
237 case TypeTableEntryIdFloat:
238 case TypeTableEntryIdPointer:
239 case TypeTableEntryIdArray:
240 case TypeTableEntryIdComptimeFloat:
241 case TypeTableEntryIdComptimeInt:
242 case TypeTableEntryIdUndefined:
243 case TypeTableEntryIdNull:
244 case TypeTableEntryIdOptional:
245 case TypeTableEntryIdErrorUnion:
246 case TypeTableEntryIdErrorSet:
247 case TypeTableEntryIdFn:
248 case TypeTableEntryIdNamespace:
249 case TypeTableEntryIdBlock:
250 case TypeTableEntryIdBoundFn:
251 case TypeTableEntryIdArgTuple:
252 case TypeTableEntryIdPromise:
231 case ZigTypeIdOpaque:
232 case ZigTypeIdMetaType:
233 case ZigTypeIdVoid:
234 case ZigTypeIdBool:
235 case ZigTypeIdUnreachable:
236 case ZigTypeIdInt:
237 case ZigTypeIdFloat:
238 case ZigTypeIdPointer:
239 case ZigTypeIdArray:
240 case ZigTypeIdComptimeFloat:
241 case ZigTypeIdComptimeInt:
242 case ZigTypeIdUndefined:
243 case ZigTypeIdNull:
244 case ZigTypeIdOptional:
245 case ZigTypeIdErrorUnion:
246 case ZigTypeIdErrorSet:
247 case ZigTypeIdFn:
248 case ZigTypeIdNamespace:
249 case ZigTypeIdBlock:
250 case ZigTypeIdBoundFn:
251 case ZigTypeIdArgTuple:
252 case ZigTypeIdPromise:
253253 return nullptr;
254254 }
255255 zig_unreachable();
......@@ -257,37 +257,37 @@ AstNode *type_decl_node(ZigType *type_entry) {
257257
258258bool type_is_complete(ZigType *type_entry) {
259259 switch (type_entry->id) {
260 case TypeTableEntryIdInvalid:
260 case ZigTypeIdInvalid:
261261 zig_unreachable();
262 case TypeTableEntryIdStruct:
262 case ZigTypeIdStruct:
263263 return type_entry->data.structure.complete;
264 case TypeTableEntryIdEnum:
264 case ZigTypeIdEnum:
265265 return type_entry->data.enumeration.complete;
266 case TypeTableEntryIdUnion:
266 case ZigTypeIdUnion:
267267 return type_entry->data.unionation.complete;
268 case TypeTableEntryIdOpaque:
268 case ZigTypeIdOpaque:
269269 return false;
270 case TypeTableEntryIdMetaType:
271 case TypeTableEntryIdVoid:
272 case TypeTableEntryIdBool:
273 case TypeTableEntryIdUnreachable:
274 case TypeTableEntryIdInt:
275 case TypeTableEntryIdFloat:
276 case TypeTableEntryIdPointer:
277 case TypeTableEntryIdArray:
278 case TypeTableEntryIdComptimeFloat:
279 case TypeTableEntryIdComptimeInt:
280 case TypeTableEntryIdUndefined:
281 case TypeTableEntryIdNull:
282 case TypeTableEntryIdOptional:
283 case TypeTableEntryIdErrorUnion:
284 case TypeTableEntryIdErrorSet:
285 case TypeTableEntryIdFn:
286 case TypeTableEntryIdNamespace:
287 case TypeTableEntryIdBlock:
288 case TypeTableEntryIdBoundFn:
289 case TypeTableEntryIdArgTuple:
290 case TypeTableEntryIdPromise:
270 case ZigTypeIdMetaType:
271 case ZigTypeIdVoid:
272 case ZigTypeIdBool:
273 case ZigTypeIdUnreachable:
274 case ZigTypeIdInt:
275 case ZigTypeIdFloat:
276 case ZigTypeIdPointer:
277 case ZigTypeIdArray:
278 case ZigTypeIdComptimeFloat:
279 case ZigTypeIdComptimeInt:
280 case ZigTypeIdUndefined:
281 case ZigTypeIdNull:
282 case ZigTypeIdOptional:
283 case ZigTypeIdErrorUnion:
284 case ZigTypeIdErrorSet:
285 case ZigTypeIdFn:
286 case ZigTypeIdNamespace:
287 case ZigTypeIdBlock:
288 case ZigTypeIdBoundFn:
289 case ZigTypeIdArgTuple:
290 case ZigTypeIdPromise:
291291 return true;
292292 }
293293 zig_unreachable();
......@@ -295,36 +295,36 @@ bool type_is_complete(ZigType *type_entry) {
295295
296296bool type_has_zero_bits_known(ZigType *type_entry) {
297297 switch (type_entry->id) {
298 case TypeTableEntryIdInvalid:
298 case ZigTypeIdInvalid:
299299 zig_unreachable();
300 case TypeTableEntryIdStruct:
300 case ZigTypeIdStruct:
301301 return type_entry->data.structure.zero_bits_known;
302 case TypeTableEntryIdEnum:
302 case ZigTypeIdEnum:
303303 return type_entry->data.enumeration.zero_bits_known;
304 case TypeTableEntryIdUnion:
304 case ZigTypeIdUnion:
305305 return type_entry->data.unionation.zero_bits_known;
306 case TypeTableEntryIdMetaType:
307 case TypeTableEntryIdVoid:
308 case TypeTableEntryIdBool:
309 case TypeTableEntryIdUnreachable:
310 case TypeTableEntryIdInt:
311 case TypeTableEntryIdFloat:
312 case TypeTableEntryIdPointer:
313 case TypeTableEntryIdArray:
314 case TypeTableEntryIdComptimeFloat:
315 case TypeTableEntryIdComptimeInt:
316 case TypeTableEntryIdUndefined:
317 case TypeTableEntryIdNull:
318 case TypeTableEntryIdOptional:
319 case TypeTableEntryIdErrorUnion:
320 case TypeTableEntryIdErrorSet:
321 case TypeTableEntryIdFn:
322 case TypeTableEntryIdNamespace:
323 case TypeTableEntryIdBlock:
324 case TypeTableEntryIdBoundFn:
325 case TypeTableEntryIdArgTuple:
326 case TypeTableEntryIdOpaque:
327 case TypeTableEntryIdPromise:
306 case ZigTypeIdMetaType:
307 case ZigTypeIdVoid:
308 case ZigTypeIdBool:
309 case ZigTypeIdUnreachable:
310 case ZigTypeIdInt:
311 case ZigTypeIdFloat:
312 case ZigTypeIdPointer:
313 case ZigTypeIdArray:
314 case ZigTypeIdComptimeFloat:
315 case ZigTypeIdComptimeInt:
316 case ZigTypeIdUndefined:
317 case ZigTypeIdNull:
318 case ZigTypeIdOptional:
319 case ZigTypeIdErrorUnion:
320 case ZigTypeIdErrorSet:
321 case ZigTypeIdFn:
322 case ZigTypeIdNamespace:
323 case ZigTypeIdBlock:
324 case ZigTypeIdBoundFn:
325 case ZigTypeIdArgTuple:
326 case ZigTypeIdOpaque:
327 case ZigTypeIdPromise:
328328 return true;
329329 }
330330 zig_unreachable();
......@@ -337,12 +337,12 @@ uint64_t type_size(CodeGen *g, ZigType *type_entry) {
337337 if (!type_has_bits(type_entry))
338338 return 0;
339339
340 if (type_entry->id == TypeTableEntryIdStruct && type_entry->data.structure.layout == ContainerLayoutPacked) {
340 if (type_entry->id == ZigTypeIdStruct && type_entry->data.structure.layout == ContainerLayoutPacked) {
341341 uint64_t size_in_bits = type_size_bits(g, type_entry);
342342 return (size_in_bits + 7) / 8;
343 } else if (type_entry->id == TypeTableEntryIdArray) {
343 } else if (type_entry->id == ZigTypeIdArray) {
344344 ZigType *child_type = type_entry->data.array.child_type;
345 if (child_type->id == TypeTableEntryIdStruct &&
345 if (child_type->id == ZigTypeIdStruct &&
346346 child_type->data.structure.layout == ContainerLayoutPacked)
347347 {
348348 uint64_t size_in_bits = type_size_bits(g, type_entry);
......@@ -359,15 +359,15 @@ uint64_t type_size_bits(CodeGen *g, ZigType *type_entry) {
359359 if (!type_has_bits(type_entry))
360360 return 0;
361361
362 if (type_entry->id == TypeTableEntryIdStruct && type_entry->data.structure.layout == ContainerLayoutPacked) {
362 if (type_entry->id == ZigTypeIdStruct && type_entry->data.structure.layout == ContainerLayoutPacked) {
363363 uint64_t result = 0;
364364 for (size_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
365365 result += type_size_bits(g, type_entry->data.structure.fields[i].type_entry);
366366 }
367367 return result;
368 } else if (type_entry->id == TypeTableEntryIdArray) {
368 } else if (type_entry->id == ZigTypeIdArray) {
369369 ZigType *child_type = type_entry->data.array.child_type;
370 if (child_type->id == TypeTableEntryIdStruct &&
370 if (child_type->id == ZigTypeIdStruct &&
371371 child_type->data.structure.layout == ContainerLayoutPacked)
372372 {
373373 return type_entry->data.array.len * type_size_bits(g, child_type);
......@@ -395,7 +395,7 @@ Result<bool> type_is_copyable(CodeGen *g, ZigType *type_entry) {
395395}
396396
397397static bool is_slice(ZigType *type) {
398 return type->id == TypeTableEntryIdStruct && type->data.structure.is_slice;
398 return type->id == ZigTypeIdStruct && type->data.structure.is_slice;
399399}
400400
401401ZigType *get_smallest_unsigned_int_type(CodeGen *g, uint64_t x) {
......@@ -410,7 +410,7 @@ ZigType *get_promise_type(CodeGen *g, ZigType *result_type) {
410410 }
411411
412412 ZigType *u8_ptr_type = get_pointer_to_type(g, g->builtin_types.entry_u8, false);
413 ZigType *entry = new_type_table_entry(TypeTableEntryIdPromise);
413 ZigType *entry = new_type_table_entry(ZigTypeIdPromise);
414414 entry->type_ref = u8_ptr_type->type_ref;
415415 entry->zero_bits = false;
416416 entry->data.promise.result_type = result_type;
......@@ -432,13 +432,13 @@ ZigType *get_pointer_to_type_extra(CodeGen *g, ZigType *child_type, bool is_cons
432432 bool is_volatile, PtrLen ptr_len, uint32_t byte_alignment, uint32_t bit_offset, uint32_t unaligned_bit_count)
433433{
434434 assert(!type_is_invalid(child_type));
435 assert(ptr_len == PtrLenSingle || child_type->id != TypeTableEntryIdOpaque);
435 assert(ptr_len == PtrLenSingle || child_type->id != ZigTypeIdOpaque);
436436
437437 TypeId type_id = {};
438438 ZigType **parent_pointer = nullptr;
439439 uint32_t abi_alignment = get_abi_alignment(g, child_type);
440440 if (unaligned_bit_count != 0 || is_volatile || byte_alignment != abi_alignment || ptr_len != PtrLenSingle) {
441 type_id.id = TypeTableEntryIdPointer;
441 type_id.id = ZigTypeIdPointer;
442442 type_id.data.pointer.child_type = child_type;
443443 type_id.data.pointer.is_const = is_const;
444444 type_id.data.pointer.is_volatile = is_volatile;
......@@ -461,7 +461,7 @@ ZigType *get_pointer_to_type_extra(CodeGen *g, ZigType *child_type, bool is_cons
461461
462462 assertNoError(type_ensure_zero_bits_known(g, child_type));
463463
464 ZigType *entry = new_type_table_entry(TypeTableEntryIdPointer);
464 ZigType *entry = new_type_table_entry(ZigTypeIdPointer);
465465 entry->is_copyable = true;
466466
467467 const char *star_str = ptr_len == PtrLenSingle ? "*" : "[*]";
......@@ -478,7 +478,7 @@ ZigType *get_pointer_to_type_extra(CodeGen *g, ZigType *child_type, bool is_cons
478478 bit_offset, bit_offset + unaligned_bit_count, const_str, volatile_str, buf_ptr(&child_type->name));
479479 }
480480
481 assert(child_type->id != TypeTableEntryIdInvalid);
481 assert(child_type->id != ZigTypeIdInvalid);
482482
483483 entry->zero_bits = !type_has_bits(child_type);
484484
......@@ -568,7 +568,7 @@ ZigType *get_optional_type(CodeGen *g, ZigType *child_type) {
568568 } else {
569569 assertNoError(ensure_complete_type(g, child_type));
570570
571 ZigType *entry = new_type_table_entry(TypeTableEntryIdOptional);
571 ZigType *entry = new_type_table_entry(ZigTypeIdOptional);
572572 assert(child_type->type_ref || child_type->zero_bits);
573573 entry->is_copyable = type_is_copyable(g, child_type).unwrap();
574574
......@@ -646,11 +646,11 @@ ZigType *get_optional_type(CodeGen *g, ZigType *child_type) {
646646}
647647
648648ZigType *get_error_union_type(CodeGen *g, ZigType *err_set_type, ZigType *payload_type) {
649 assert(err_set_type->id == TypeTableEntryIdErrorSet);
649 assert(err_set_type->id == ZigTypeIdErrorSet);
650650 assert(!type_is_invalid(payload_type));
651651
652652 TypeId type_id = {};
653 type_id.id = TypeTableEntryIdErrorUnion;
653 type_id.id = ZigTypeIdErrorUnion;
654654 type_id.data.error_union.err_set_type = err_set_type;
655655 type_id.data.error_union.payload_type = payload_type;
656656
......@@ -659,7 +659,7 @@ ZigType *get_error_union_type(CodeGen *g, ZigType *err_set_type, ZigType *payloa
659659 return existing_entry->value;
660660 }
661661
662 ZigType *entry = new_type_table_entry(TypeTableEntryIdErrorUnion);
662 ZigType *entry = new_type_table_entry(ZigTypeIdErrorUnion);
663663 entry->is_copyable = true;
664664 assert(payload_type->di_type);
665665 assertNoError(ensure_complete_type(g, payload_type));
......@@ -742,7 +742,7 @@ ZigType *get_error_union_type(CodeGen *g, ZigType *err_set_type, ZigType *payloa
742742
743743ZigType *get_array_type(CodeGen *g, ZigType *child_type, uint64_t array_size) {
744744 TypeId type_id = {};
745 type_id.id = TypeTableEntryIdArray;
745 type_id.id = ZigTypeIdArray;
746746 type_id.data.array.child_type = child_type;
747747 type_id.data.array.size = array_size;
748748 auto existing_entry = g->type_table.maybe_get(type_id);
......@@ -753,7 +753,7 @@ ZigType *get_array_type(CodeGen *g, ZigType *child_type, uint64_t array_size) {
753753
754754 assertNoError(ensure_complete_type(g, child_type));
755755
756 ZigType *entry = new_type_table_entry(TypeTableEntryIdArray);
756 ZigType *entry = new_type_table_entry(ZigTypeIdArray);
757757 entry->zero_bits = (array_size == 0) || child_type->zero_bits;
758758 entry->is_copyable = false;
759759
......@@ -812,7 +812,7 @@ static void slice_type_common_init(CodeGen *g, ZigType *pointer_type, ZigType *e
812812}
813813
814814ZigType *get_slice_type(CodeGen *g, ZigType *ptr_type) {
815 assert(ptr_type->id == TypeTableEntryIdPointer);
815 assert(ptr_type->id == ZigTypeIdPointer);
816816 assert(ptr_type->data.pointer.ptr_len == PtrLenUnknown);
817817
818818 ZigType **parent_pointer = &ptr_type->data.pointer.slice_parent;
......@@ -820,7 +820,7 @@ ZigType *get_slice_type(CodeGen *g, ZigType *ptr_type) {
820820 return *parent_pointer;
821821 }
822822
823 ZigType *entry = new_type_table_entry(TypeTableEntryIdStruct);
823 ZigType *entry = new_type_table_entry(ZigTypeIdStruct);
824824 entry->is_copyable = true;
825825
826826 // replace the & with [] to go from a ptr type name to a slice type name
......@@ -853,7 +853,7 @@ ZigType *get_slice_type(CodeGen *g, ZigType *ptr_type) {
853853 // and debug info is the same as if the child type were []T.
854854 if (is_slice(child_type)) {
855855 ZigType *child_ptr_type = child_type->data.structure.fields[slice_ptr_index].type_entry;
856 assert(child_ptr_type->id == TypeTableEntryIdPointer);
856 assert(child_ptr_type->id == ZigTypeIdPointer);
857857 ZigType *grand_child_type = child_ptr_type->data.pointer.child_type;
858858 if (child_ptr_type->data.pointer.is_const || child_ptr_type->data.pointer.is_volatile ||
859859 child_ptr_type->data.pointer.alignment != get_abi_alignment(g, grand_child_type))
......@@ -972,7 +972,7 @@ ZigType *get_slice_type(CodeGen *g, ZigType *ptr_type) {
972972}
973973
974974ZigType *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const char *name) {
975 ZigType *entry = new_type_table_entry(TypeTableEntryIdOpaque);
975 ZigType *entry = new_type_table_entry(ZigTypeIdOpaque);
976976
977977 buf_init_from_str(&entry->name, name);
978978
......@@ -993,11 +993,11 @@ ZigType *get_opaque_type(CodeGen *g, Scope *scope, AstNode *source_node, const c
993993
994994ZigType *get_bound_fn_type(CodeGen *g, ZigFn *fn_entry) {
995995 ZigType *fn_type = fn_entry->type_entry;
996 assert(fn_type->id == TypeTableEntryIdFn);
996 assert(fn_type->id == ZigTypeIdFn);
997997 if (fn_type->data.fn.bound_fn_parent)
998998 return fn_type->data.fn.bound_fn_parent;
999999
1000 ZigType *bound_fn_type = new_type_table_entry(TypeTableEntryIdBoundFn);
1000 ZigType *bound_fn_type = new_type_table_entry(ZigTypeIdBoundFn);
10011001 bound_fn_type->is_copyable = false;
10021002 bound_fn_type->data.bound_fn.fn_type = fn_type;
10031003 bound_fn_type->zero_bits = true;
......@@ -1054,7 +1054,7 @@ static bool calling_convention_allows_zig_types(CallingConvention cc) {
10541054ZigType *get_ptr_to_stack_trace_type(CodeGen *g) {
10551055 if (g->stack_trace_type == nullptr) {
10561056 ConstExprValue *stack_trace_type_val = get_builtin_value(g, "StackTrace");
1057 assert(stack_trace_type_val->type->id == TypeTableEntryIdMetaType);
1057 assert(stack_trace_type_val->type->id == ZigTypeIdMetaType);
10581058 g->stack_trace_type = stack_trace_type_val->data.x_type;
10591059 g->ptr_to_stack_trace_type = get_pointer_to_type(g, g->stack_trace_type, false);
10601060 }
......@@ -1070,12 +1070,12 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
10701070 if (fn_type_id->return_type != nullptr) {
10711071 if ((err = ensure_complete_type(g, fn_type_id->return_type)))
10721072 return g->builtin_types.entry_invalid;
1073 assert(fn_type_id->return_type->id != TypeTableEntryIdOpaque);
1073 assert(fn_type_id->return_type->id != ZigTypeIdOpaque);
10741074 } else {
10751075 zig_panic("TODO implement inferred return types https://github.com/ziglang/zig/issues/447");
10761076 }
10771077
1078 ZigType *fn_type = new_type_table_entry(TypeTableEntryIdFn);
1078 ZigType *fn_type = new_type_table_entry(ZigTypeIdFn);
10791079 fn_type->is_copyable = true;
10801080 fn_type->data.fn.fn_type_id = *fn_type_id;
10811081
......@@ -1222,11 +1222,11 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
12221222static ZigTypeId container_to_type(ContainerKind kind) {
12231223 switch (kind) {
12241224 case ContainerKindStruct:
1225 return TypeTableEntryIdStruct;
1225 return ZigTypeIdStruct;
12261226 case ContainerKindEnum:
1227 return TypeTableEntryIdEnum;
1227 return ZigTypeIdEnum;
12281228 case ContainerKindUnion:
1229 return TypeTableEntryIdUnion;
1229 return ZigTypeIdUnion;
12301230 }
12311231 zig_unreachable();
12321232}
......@@ -1275,7 +1275,7 @@ static IrInstruction *analyze_const_value(CodeGen *g, Scope *scope, AstNode *nod
12751275
12761276ZigType *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node) {
12771277 IrInstruction *result = analyze_const_value(g, scope, node, g->builtin_types.entry_type, nullptr);
1278 if (result->value.type->id == TypeTableEntryIdInvalid)
1278 if (result->value.type->id == ZigTypeIdInvalid)
12791279 return g->builtin_types.entry_invalid;
12801280
12811281 assert(result->value.special != ConstValSpecialRuntime);
......@@ -1283,7 +1283,7 @@ ZigType *analyze_type_expr(CodeGen *g, Scope *scope, AstNode *node) {
12831283}
12841284
12851285ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
1286 ZigType *fn_type = new_type_table_entry(TypeTableEntryIdFn);
1286 ZigType *fn_type = new_type_table_entry(ZigTypeIdFn);
12871287 fn_type->is_copyable = false;
12881288 buf_resize(&fn_type->name, 0);
12891289 if (fn_type->data.fn.fn_type_id.cc == CallingConventionAsync) {
......@@ -1384,41 +1384,41 @@ static bool analyze_const_string(CodeGen *g, Scope *scope, AstNode *node, Buf **
13841384
13851385static bool type_allowed_in_packed_struct(ZigType *type_entry) {
13861386 switch (type_entry->id) {
1387 case TypeTableEntryIdInvalid:
1387 case ZigTypeIdInvalid:
13881388 zig_unreachable();
1389 case TypeTableEntryIdMetaType:
1390 case TypeTableEntryIdUnreachable:
1391 case TypeTableEntryIdComptimeFloat:
1392 case TypeTableEntryIdComptimeInt:
1393 case TypeTableEntryIdUndefined:
1394 case TypeTableEntryIdNull:
1395 case TypeTableEntryIdErrorUnion:
1396 case TypeTableEntryIdErrorSet:
1397 case TypeTableEntryIdNamespace:
1398 case TypeTableEntryIdBlock:
1399 case TypeTableEntryIdBoundFn:
1400 case TypeTableEntryIdArgTuple:
1401 case TypeTableEntryIdOpaque:
1402 case TypeTableEntryIdPromise:
1389 case ZigTypeIdMetaType:
1390 case ZigTypeIdUnreachable:
1391 case ZigTypeIdComptimeFloat:
1392 case ZigTypeIdComptimeInt:
1393 case ZigTypeIdUndefined:
1394 case ZigTypeIdNull:
1395 case ZigTypeIdErrorUnion:
1396 case ZigTypeIdErrorSet:
1397 case ZigTypeIdNamespace:
1398 case ZigTypeIdBlock:
1399 case ZigTypeIdBoundFn:
1400 case ZigTypeIdArgTuple:
1401 case ZigTypeIdOpaque:
1402 case ZigTypeIdPromise:
14031403 return false;
1404 case TypeTableEntryIdVoid:
1405 case TypeTableEntryIdBool:
1406 case TypeTableEntryIdInt:
1407 case TypeTableEntryIdFloat:
1408 case TypeTableEntryIdPointer:
1409 case TypeTableEntryIdArray:
1410 case TypeTableEntryIdFn:
1404 case ZigTypeIdVoid:
1405 case ZigTypeIdBool:
1406 case ZigTypeIdInt:
1407 case ZigTypeIdFloat:
1408 case ZigTypeIdPointer:
1409 case ZigTypeIdArray:
1410 case ZigTypeIdFn:
14111411 return true;
1412 case TypeTableEntryIdStruct:
1412 case ZigTypeIdStruct:
14131413 return type_entry->data.structure.layout == ContainerLayoutPacked;
1414 case TypeTableEntryIdUnion:
1414 case ZigTypeIdUnion:
14151415 return type_entry->data.unionation.layout == ContainerLayoutPacked;
1416 case TypeTableEntryIdOptional:
1416 case ZigTypeIdOptional:
14171417 {
14181418 ZigType *child_type = type_entry->data.maybe.child_type;
14191419 return type_is_codegen_pointer(child_type);
14201420 }
1421 case TypeTableEntryIdEnum:
1421 case ZigTypeIdEnum:
14221422 return type_entry->data.enumeration.decl_node->data.container_decl.init_arg_expr != nullptr;
14231423 }
14241424 zig_unreachable();
......@@ -1426,27 +1426,27 @@ static bool type_allowed_in_packed_struct(ZigType *type_entry) {
14261426
14271427static bool type_allowed_in_extern(CodeGen *g, ZigType *type_entry) {
14281428 switch (type_entry->id) {
1429 case TypeTableEntryIdInvalid:
1429 case ZigTypeIdInvalid:
14301430 zig_unreachable();
1431 case TypeTableEntryIdMetaType:
1432 case TypeTableEntryIdComptimeFloat:
1433 case TypeTableEntryIdComptimeInt:
1434 case TypeTableEntryIdUndefined:
1435 case TypeTableEntryIdNull:
1436 case TypeTableEntryIdErrorUnion:
1437 case TypeTableEntryIdErrorSet:
1438 case TypeTableEntryIdNamespace:
1439 case TypeTableEntryIdBlock:
1440 case TypeTableEntryIdBoundFn:
1441 case TypeTableEntryIdArgTuple:
1442 case TypeTableEntryIdPromise:
1443 case TypeTableEntryIdVoid:
1431 case ZigTypeIdMetaType:
1432 case ZigTypeIdComptimeFloat:
1433 case ZigTypeIdComptimeInt:
1434 case ZigTypeIdUndefined:
1435 case ZigTypeIdNull:
1436 case ZigTypeIdErrorUnion:
1437 case ZigTypeIdErrorSet:
1438 case ZigTypeIdNamespace:
1439 case ZigTypeIdBlock:
1440 case ZigTypeIdBoundFn:
1441 case ZigTypeIdArgTuple:
1442 case ZigTypeIdPromise:
1443 case ZigTypeIdVoid:
14441444 return false;
1445 case TypeTableEntryIdOpaque:
1446 case TypeTableEntryIdUnreachable:
1447 case TypeTableEntryIdBool:
1445 case ZigTypeIdOpaque:
1446 case ZigTypeIdUnreachable:
1447 case ZigTypeIdBool:
14481448 return true;
1449 case TypeTableEntryIdInt:
1449 case ZigTypeIdInt:
14501450 switch (type_entry->data.integral.bit_count) {
14511451 case 8:
14521452 case 16:
......@@ -1457,36 +1457,36 @@ static bool type_allowed_in_extern(CodeGen *g, ZigType *type_entry) {
14571457 default:
14581458 return false;
14591459 }
1460 case TypeTableEntryIdFloat:
1460 case ZigTypeIdFloat:
14611461 return true;
1462 case TypeTableEntryIdArray:
1462 case ZigTypeIdArray:
14631463 return type_allowed_in_extern(g, type_entry->data.array.child_type);
1464 case TypeTableEntryIdFn:
1464 case ZigTypeIdFn:
14651465 return type_entry->data.fn.fn_type_id.cc == CallingConventionC;
1466 case TypeTableEntryIdPointer:
1466 case ZigTypeIdPointer:
14671467 if (type_size(g, type_entry) == 0)
14681468 return false;
14691469 return true;
1470 case TypeTableEntryIdStruct:
1470 case ZigTypeIdStruct:
14711471 return type_entry->data.structure.layout == ContainerLayoutExtern || type_entry->data.structure.layout == ContainerLayoutPacked;
1472 case TypeTableEntryIdOptional:
1472 case ZigTypeIdOptional:
14731473 {
14741474 ZigType *child_type = type_entry->data.maybe.child_type;
1475 if (child_type->id != TypeTableEntryIdPointer && child_type->id != TypeTableEntryIdFn) {
1475 if (child_type->id != ZigTypeIdPointer && child_type->id != ZigTypeIdFn) {
14761476 return false;
14771477 }
14781478 return type_allowed_in_extern(g, child_type);
14791479 }
1480 case TypeTableEntryIdEnum:
1480 case ZigTypeIdEnum:
14811481 return type_entry->data.enumeration.layout == ContainerLayoutExtern || type_entry->data.enumeration.layout == ContainerLayoutPacked;
1482 case TypeTableEntryIdUnion:
1482 case ZigTypeIdUnion:
14831483 return type_entry->data.unionation.layout == ContainerLayoutExtern || type_entry->data.unionation.layout == ContainerLayoutPacked;
14841484 }
14851485 zig_unreachable();
14861486}
14871487
14881488ZigType *get_auto_err_set_type(CodeGen *g, ZigFn *fn_entry) {
1489 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
1489 ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);
14901490 buf_resize(&err_set_type->name, 0);
14911491 buf_appendf(&err_set_type->name, "@typeOf(%s).ReturnType.ErrorSet", buf_ptr(&fn_entry->symbol_name));
14921492 err_set_type->is_copyable = true;
......@@ -1581,36 +1581,36 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc
15811581 }
15821582
15831583 switch (type_entry->id) {
1584 case TypeTableEntryIdInvalid:
1584 case ZigTypeIdInvalid:
15851585 zig_unreachable();
1586 case TypeTableEntryIdUnreachable:
1587 case TypeTableEntryIdUndefined:
1588 case TypeTableEntryIdNull:
1589 case TypeTableEntryIdArgTuple:
1590 case TypeTableEntryIdOpaque:
1586 case ZigTypeIdUnreachable:
1587 case ZigTypeIdUndefined:
1588 case ZigTypeIdNull:
1589 case ZigTypeIdArgTuple:
1590 case ZigTypeIdOpaque:
15911591 add_node_error(g, param_node->data.param_decl.type,
15921592 buf_sprintf("parameter of type '%s' not allowed", buf_ptr(&type_entry->name)));
15931593 return g->builtin_types.entry_invalid;
1594 case TypeTableEntryIdComptimeFloat:
1595 case TypeTableEntryIdComptimeInt:
1596 case TypeTableEntryIdNamespace:
1597 case TypeTableEntryIdBlock:
1598 case TypeTableEntryIdBoundFn:
1599 case TypeTableEntryIdMetaType:
1600 case TypeTableEntryIdVoid:
1601 case TypeTableEntryIdBool:
1602 case TypeTableEntryIdInt:
1603 case TypeTableEntryIdFloat:
1604 case TypeTableEntryIdPointer:
1605 case TypeTableEntryIdArray:
1606 case TypeTableEntryIdStruct:
1607 case TypeTableEntryIdOptional:
1608 case TypeTableEntryIdErrorUnion:
1609 case TypeTableEntryIdErrorSet:
1610 case TypeTableEntryIdEnum:
1611 case TypeTableEntryIdUnion:
1612 case TypeTableEntryIdFn:
1613 case TypeTableEntryIdPromise:
1594 case ZigTypeIdComptimeFloat:
1595 case ZigTypeIdComptimeInt:
1596 case ZigTypeIdNamespace:
1597 case ZigTypeIdBlock:
1598 case ZigTypeIdBoundFn:
1599 case ZigTypeIdMetaType:
1600 case ZigTypeIdVoid:
1601 case ZigTypeIdBool:
1602 case ZigTypeIdInt:
1603 case ZigTypeIdFloat:
1604 case ZigTypeIdPointer:
1605 case ZigTypeIdArray:
1606 case ZigTypeIdStruct:
1607 case ZigTypeIdOptional:
1608 case ZigTypeIdErrorUnion:
1609 case ZigTypeIdErrorSet:
1610 case ZigTypeIdEnum:
1611 case ZigTypeIdUnion:
1612 case ZigTypeIdFn:
1613 case ZigTypeIdPromise:
16141614 if ((err = type_ensure_zero_bits_known(g, type_entry)))
16151615 return g->builtin_types.entry_invalid;
16161616 if (type_requires_comptime(type_entry)) {
......@@ -1659,7 +1659,7 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc
16591659 }
16601660
16611661 if (!calling_convention_allows_zig_types(fn_type_id.cc) &&
1662 fn_type_id.return_type->id != TypeTableEntryIdVoid &&
1662 fn_type_id.return_type->id != ZigTypeIdVoid &&
16631663 !type_allowed_in_extern(g, fn_type_id.return_type))
16641664 {
16651665 add_node_error(g, fn_proto->return_type,
......@@ -1670,38 +1670,38 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc
16701670 }
16711671
16721672 switch (fn_type_id.return_type->id) {
1673 case TypeTableEntryIdInvalid:
1673 case ZigTypeIdInvalid:
16741674 zig_unreachable();
16751675
1676 case TypeTableEntryIdUndefined:
1677 case TypeTableEntryIdNull:
1678 case TypeTableEntryIdArgTuple:
1679 case TypeTableEntryIdOpaque:
1676 case ZigTypeIdUndefined:
1677 case ZigTypeIdNull:
1678 case ZigTypeIdArgTuple:
1679 case ZigTypeIdOpaque:
16801680 add_node_error(g, fn_proto->return_type,
16811681 buf_sprintf("return type '%s' not allowed", buf_ptr(&fn_type_id.return_type->name)));
16821682 return g->builtin_types.entry_invalid;
16831683
1684 case TypeTableEntryIdComptimeFloat:
1685 case TypeTableEntryIdComptimeInt:
1686 case TypeTableEntryIdNamespace:
1687 case TypeTableEntryIdBlock:
1688 case TypeTableEntryIdBoundFn:
1689 case TypeTableEntryIdMetaType:
1690 case TypeTableEntryIdUnreachable:
1691 case TypeTableEntryIdVoid:
1692 case TypeTableEntryIdBool:
1693 case TypeTableEntryIdInt:
1694 case TypeTableEntryIdFloat:
1695 case TypeTableEntryIdPointer:
1696 case TypeTableEntryIdArray:
1697 case TypeTableEntryIdStruct:
1698 case TypeTableEntryIdOptional:
1699 case TypeTableEntryIdErrorUnion:
1700 case TypeTableEntryIdErrorSet:
1701 case TypeTableEntryIdEnum:
1702 case TypeTableEntryIdUnion:
1703 case TypeTableEntryIdFn:
1704 case TypeTableEntryIdPromise:
1684 case ZigTypeIdComptimeFloat:
1685 case ZigTypeIdComptimeInt:
1686 case ZigTypeIdNamespace:
1687 case ZigTypeIdBlock:
1688 case ZigTypeIdBoundFn:
1689 case ZigTypeIdMetaType:
1690 case ZigTypeIdUnreachable:
1691 case ZigTypeIdVoid:
1692 case ZigTypeIdBool:
1693 case ZigTypeIdInt:
1694 case ZigTypeIdFloat:
1695 case ZigTypeIdPointer:
1696 case ZigTypeIdArray:
1697 case ZigTypeIdStruct:
1698 case ZigTypeIdOptional:
1699 case ZigTypeIdErrorUnion:
1700 case ZigTypeIdErrorSet:
1701 case ZigTypeIdEnum:
1702 case ZigTypeIdUnion:
1703 case ZigTypeIdFn:
1704 case ZigTypeIdPromise:
17051705 if ((err = type_ensure_zero_bits_known(g, fn_type_id.return_type)))
17061706 return g->builtin_types.entry_invalid;
17071707 if (type_requires_comptime(fn_type_id.return_type)) {
......@@ -1725,13 +1725,13 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc
17251725
17261726bool type_is_invalid(ZigType *type_entry) {
17271727 switch (type_entry->id) {
1728 case TypeTableEntryIdInvalid:
1728 case ZigTypeIdInvalid:
17291729 return true;
1730 case TypeTableEntryIdStruct:
1730 case ZigTypeIdStruct:
17311731 return type_entry->data.structure.is_invalid;
1732 case TypeTableEntryIdEnum:
1732 case ZigTypeIdEnum:
17331733 return type_entry->data.enumeration.is_invalid;
1734 case TypeTableEntryIdUnion:
1734 case ZigTypeIdUnion:
17351735 return type_entry->data.unionation.is_invalid;
17361736 default:
17371737 return false;
......@@ -1741,7 +1741,7 @@ bool type_is_invalid(ZigType *type_entry) {
17411741
17421742
17431743static Error resolve_enum_type(CodeGen *g, ZigType *enum_type) {
1744 assert(enum_type->id == TypeTableEntryIdEnum);
1744 assert(enum_type->id == ZigTypeIdEnum);
17451745
17461746 if (enum_type->data.enumeration.is_invalid)
17471747 return ErrorSemanticAnalyzeFail;
......@@ -1837,7 +1837,7 @@ static Error resolve_enum_type(CodeGen *g, ZigType *enum_type) {
18371837ZigType *get_struct_type(CodeGen *g, const char *type_name, const char *field_names[],
18381838 ZigType *field_types[], size_t field_count)
18391839{
1840 ZigType *struct_type = new_type_table_entry(TypeTableEntryIdStruct);
1840 ZigType *struct_type = new_type_table_entry(ZigTypeIdStruct);
18411841
18421842 buf_init_from_str(&struct_type->name, type_name);
18431843
......@@ -1914,7 +1914,7 @@ ZigType *get_struct_type(CodeGen *g, const char *type_name, const char *field_na
19141914}
19151915
19161916static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) {
1917 assert(struct_type->id == TypeTableEntryIdStruct);
1917 assert(struct_type->id == ZigTypeIdStruct);
19181918
19191919 if (struct_type->data.structure.complete)
19201920 return ErrorNone;
......@@ -2092,7 +2092,7 @@ static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) {
20922092
20932093 // if the field is a function, actually the debug info should be a pointer.
20942094 ZigLLVMDIType *field_di_type;
2095 if (field_type->id == TypeTableEntryIdFn) {
2095 if (field_type->id == ZigTypeIdFn) {
20962096 ZigType *field_ptr_type = get_pointer_to_type(g, field_type, true);
20972097 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, field_ptr_type->type_ref);
20982098 uint64_t debug_align_in_bits = 8*LLVMABISizeOfType(g->target_data_ref, field_ptr_type->type_ref);
......@@ -2148,7 +2148,7 @@ static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) {
21482148}
21492149
21502150static Error resolve_union_type(CodeGen *g, ZigType *union_type) {
2151 assert(union_type->id == TypeTableEntryIdUnion);
2151 assert(union_type->id == ZigTypeIdUnion);
21522152
21532153 if (union_type->data.unionation.complete)
21542154 return ErrorNone;
......@@ -2388,7 +2388,7 @@ static Error resolve_union_type(CodeGen *g, ZigType *union_type) {
23882388}
23892389
23902390static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) {
2391 assert(enum_type->id == TypeTableEntryIdEnum);
2391 assert(enum_type->id == ZigTypeIdEnum);
23922392
23932393 if (enum_type->data.enumeration.zero_bits_known)
23942394 return ErrorNone;
......@@ -2440,7 +2440,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) {
24402440 ZigType *wanted_tag_int_type = analyze_type_expr(g, scope, decl_node->data.container_decl.init_arg_expr);
24412441 if (type_is_invalid(wanted_tag_int_type)) {
24422442 enum_type->data.enumeration.is_invalid = true;
2443 } else if (wanted_tag_int_type->id != TypeTableEntryIdInt) {
2443 } else if (wanted_tag_int_type->id != ZigTypeIdInt) {
24442444 enum_type->data.enumeration.is_invalid = true;
24452445 add_node_error(g, decl_node->data.container_decl.init_arg_expr,
24462446 buf_sprintf("expected integer, found '%s'", buf_ptr(&wanted_tag_int_type->name)));
......@@ -2489,12 +2489,12 @@ static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) {
24892489 // In a second pass we will fill in the unspecified ones.
24902490 if (tag_value != nullptr) {
24912491 IrInstruction *result_inst = analyze_const_value(g, scope, tag_value, tag_int_type, nullptr);
2492 if (result_inst->value.type->id == TypeTableEntryIdInvalid) {
2492 if (result_inst->value.type->id == ZigTypeIdInvalid) {
24932493 enum_type->data.enumeration.is_invalid = true;
24942494 continue;
24952495 }
24962496 assert(result_inst->value.special != ConstValSpecialRuntime);
2497 assert(result_inst->value.type->id == TypeTableEntryIdInt);
2497 assert(result_inst->value.type->id == ZigTypeIdInt);
24982498 auto entry = occupied_tag_values.put_unique(result_inst->value.data.x_bigint, tag_value);
24992499 if (entry == nullptr) {
25002500 bigint_init_bigint(&type_enum_field->value, &result_inst->value.data.x_bigint);
......@@ -2551,7 +2551,7 @@ static Error resolve_enum_zero_bits(CodeGen *g, ZigType *enum_type) {
25512551}
25522552
25532553static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) {
2554 assert(struct_type->id == TypeTableEntryIdStruct);
2554 assert(struct_type->id == ZigTypeIdStruct);
25552555
25562556 Error err;
25572557
......@@ -2670,7 +2670,7 @@ static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) {
26702670}
26712671
26722672static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
2673 assert(union_type->id == TypeTableEntryIdUnion);
2673 assert(union_type->id == ZigTypeIdUnion);
26742674
26752675 Error err;
26762676
......@@ -2751,7 +2751,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
27512751 union_type->data.unionation.is_invalid = true;
27522752 return ErrorSemanticAnalyzeFail;
27532753 }
2754 if (tag_int_type->id != TypeTableEntryIdInt) {
2754 if (tag_int_type->id != ZigTypeIdInt) {
27552755 add_node_error(g, enum_type_node,
27562756 buf_sprintf("expected integer tag type, found '%s'", buf_ptr(&tag_int_type->name)));
27572757 union_type->data.unionation.is_invalid = true;
......@@ -2762,7 +2762,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
27622762 }
27632763 abi_alignment_so_far = get_abi_alignment(g, tag_int_type);
27642764
2765 tag_type = new_type_table_entry(TypeTableEntryIdEnum);
2765 tag_type = new_type_table_entry(ZigTypeIdEnum);
27662766 buf_resize(&tag_type->name, 0);
27672767 buf_appendf(&tag_type->name, "@TagType(%s)", buf_ptr(&union_type->name));
27682768 tag_type->is_copyable = true;
......@@ -2784,7 +2784,7 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
27842784 union_type->data.unionation.is_invalid = true;
27852785 return ErrorSemanticAnalyzeFail;
27862786 }
2787 if (enum_type->id != TypeTableEntryIdEnum) {
2787 if (enum_type->id != ZigTypeIdEnum) {
27882788 union_type->data.unionation.is_invalid = true;
27892789 add_node_error(g, enum_type_node,
27902790 buf_sprintf("expected enum tag type, found '%s'", buf_ptr(&enum_type->name)));
......@@ -2862,12 +2862,12 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) {
28622862 if (tag_value != nullptr) {
28632863 ZigType *tag_int_type = tag_type->data.enumeration.tag_int_type;
28642864 IrInstruction *result_inst = analyze_const_value(g, scope, tag_value, tag_int_type, nullptr);
2865 if (result_inst->value.type->id == TypeTableEntryIdInvalid) {
2865 if (result_inst->value.type->id == ZigTypeIdInvalid) {
28662866 union_type->data.unionation.is_invalid = true;
28672867 continue;
28682868 }
28692869 assert(result_inst->value.special != ConstValSpecialRuntime);
2870 assert(result_inst->value.type->id == TypeTableEntryIdInt);
2870 assert(result_inst->value.type->id == ZigTypeIdInt);
28712871 auto entry = occupied_tag_values.put_unique(result_inst->value.data.x_bigint, tag_value);
28722872 if (entry == nullptr) {
28732873 bigint_init_bigint(&union_field->enum_field->value, &result_inst->value.data.x_bigint);
......@@ -3192,7 +3192,7 @@ static void resolve_decl_fn(CodeGen *g, TldFn *tld_fn) {
31923192 }
31933193 }
31943194
3195 if (fn_table_entry->type_entry->id == TypeTableEntryIdInvalid) {
3195 if (fn_table_entry->type_entry->id == ZigTypeIdInvalid) {
31963196 tld_fn->base.resolution = TldResolutionInvalid;
31973197 return;
31983198 }
......@@ -3448,13 +3448,13 @@ static void resolve_decl_container(CodeGen *g, TldContainer *tld_container) {
34483448 assert(type_entry);
34493449
34503450 switch (type_entry->id) {
3451 case TypeTableEntryIdStruct:
3451 case ZigTypeIdStruct:
34523452 resolve_struct_type(g, tld_container->type_entry);
34533453 return;
3454 case TypeTableEntryIdEnum:
3454 case ZigTypeIdEnum:
34553455 resolve_enum_type(g, tld_container->type_entry);
34563456 return;
3457 case TypeTableEntryIdUnion:
3457 case ZigTypeIdUnion:
34583458 resolve_union_type(g, tld_container->type_entry);
34593459 return;
34603460 default:
......@@ -3464,36 +3464,36 @@ static void resolve_decl_container(CodeGen *g, TldContainer *tld_container) {
34643464
34653465ZigType *validate_var_type(CodeGen *g, AstNode *source_node, ZigType *type_entry) {
34663466 switch (type_entry->id) {
3467 case TypeTableEntryIdInvalid:
3467 case ZigTypeIdInvalid:
34683468 return g->builtin_types.entry_invalid;
3469 case TypeTableEntryIdUnreachable:
3470 case TypeTableEntryIdUndefined:
3471 case TypeTableEntryIdNull:
3472 case TypeTableEntryIdBlock:
3473 case TypeTableEntryIdArgTuple:
3474 case TypeTableEntryIdOpaque:
3469 case ZigTypeIdUnreachable:
3470 case ZigTypeIdUndefined:
3471 case ZigTypeIdNull:
3472 case ZigTypeIdBlock:
3473 case ZigTypeIdArgTuple:
3474 case ZigTypeIdOpaque:
34753475 add_node_error(g, source_node, buf_sprintf("variable of type '%s' not allowed",
34763476 buf_ptr(&type_entry->name)));
34773477 return g->builtin_types.entry_invalid;
3478 case TypeTableEntryIdComptimeFloat:
3479 case TypeTableEntryIdComptimeInt:
3480 case TypeTableEntryIdNamespace:
3481 case TypeTableEntryIdMetaType:
3482 case TypeTableEntryIdVoid:
3483 case TypeTableEntryIdBool:
3484 case TypeTableEntryIdInt:
3485 case TypeTableEntryIdFloat:
3486 case TypeTableEntryIdPointer:
3487 case TypeTableEntryIdArray:
3488 case TypeTableEntryIdStruct:
3489 case TypeTableEntryIdOptional:
3490 case TypeTableEntryIdErrorUnion:
3491 case TypeTableEntryIdErrorSet:
3492 case TypeTableEntryIdEnum:
3493 case TypeTableEntryIdUnion:
3494 case TypeTableEntryIdFn:
3495 case TypeTableEntryIdBoundFn:
3496 case TypeTableEntryIdPromise:
3478 case ZigTypeIdComptimeFloat:
3479 case ZigTypeIdComptimeInt:
3480 case ZigTypeIdNamespace:
3481 case ZigTypeIdMetaType:
3482 case ZigTypeIdVoid:
3483 case ZigTypeIdBool:
3484 case ZigTypeIdInt:
3485 case ZigTypeIdFloat:
3486 case ZigTypeIdPointer:
3487 case ZigTypeIdArray:
3488 case ZigTypeIdStruct:
3489 case ZigTypeIdOptional:
3490 case ZigTypeIdErrorUnion:
3491 case ZigTypeIdErrorSet:
3492 case ZigTypeIdEnum:
3493 case ZigTypeIdUnion:
3494 case ZigTypeIdFn:
3495 case ZigTypeIdBoundFn:
3496 case ZigTypeIdPromise:
34973497 return type_entry;
34983498 }
34993499 zig_unreachable();
......@@ -3598,30 +3598,30 @@ static void resolve_decl_var(CodeGen *g, TldVar *tld_var) {
35983598
35993599 // TODO more validation for types that can't be used for export/extern variables
36003600 ZigType *implicit_type = nullptr;
3601 if (explicit_type && explicit_type->id == TypeTableEntryIdInvalid) {
3601 if (explicit_type && explicit_type->id == ZigTypeIdInvalid) {
36023602 implicit_type = explicit_type;
36033603 } else if (var_decl->expr) {
36043604 init_value = analyze_const_value(g, tld_var->base.parent_scope, var_decl->expr, explicit_type, var_decl->symbol);
36053605 assert(init_value);
36063606 implicit_type = init_value->value.type;
36073607
3608 if (implicit_type->id == TypeTableEntryIdUnreachable) {
3608 if (implicit_type->id == ZigTypeIdUnreachable) {
36093609 add_node_error(g, source_node, buf_sprintf("variable initialization is unreachable"));
36103610 implicit_type = g->builtin_types.entry_invalid;
36113611 } else if ((!is_const || linkage == VarLinkageExternal) &&
3612 (implicit_type->id == TypeTableEntryIdComptimeFloat ||
3613 implicit_type->id == TypeTableEntryIdComptimeInt))
3612 (implicit_type->id == ZigTypeIdComptimeFloat ||
3613 implicit_type->id == ZigTypeIdComptimeInt))
36143614 {
36153615 add_node_error(g, source_node, buf_sprintf("unable to infer variable type"));
36163616 implicit_type = g->builtin_types.entry_invalid;
3617 } else if (implicit_type->id == TypeTableEntryIdNull) {
3617 } else if (implicit_type->id == ZigTypeIdNull) {
36183618 add_node_error(g, source_node, buf_sprintf("unable to infer variable type"));
36193619 implicit_type = g->builtin_types.entry_invalid;
3620 } else if (implicit_type->id == TypeTableEntryIdMetaType && !is_const) {
3620 } else if (implicit_type->id == ZigTypeIdMetaType && !is_const) {
36213621 add_node_error(g, source_node, buf_sprintf("variable of type 'type' must be constant"));
36223622 implicit_type = g->builtin_types.entry_invalid;
36233623 }
3624 assert(implicit_type->id == TypeTableEntryIdInvalid || init_value->value.special != ConstValSpecialRuntime);
3624 assert(implicit_type->id == ZigTypeIdInvalid || init_value->value.special != ConstValSpecialRuntime);
36253625 } else if (linkage != VarLinkageExternal) {
36263626 add_node_error(g, source_node, buf_sprintf("variables must be initialized"));
36273627 implicit_type = g->builtin_types.entry_invalid;
......@@ -3790,7 +3790,7 @@ ZigFn *scope_get_fn_if_root(Scope *scope) {
37903790}
37913791
37923792TypeEnumField *find_enum_type_field(ZigType *enum_type, Buf *name) {
3793 assert(enum_type->id == TypeTableEntryIdEnum);
3793 assert(enum_type->id == ZigTypeIdEnum);
37943794 if (enum_type->data.enumeration.src_field_count == 0)
37953795 return nullptr;
37963796 auto entry = enum_type->data.enumeration.fields_by_name.maybe_get(name);
......@@ -3800,7 +3800,7 @@ TypeEnumField *find_enum_type_field(ZigType *enum_type, Buf *name) {
38003800}
38013801
38023802TypeStructField *find_struct_type_field(ZigType *type_entry, Buf *name) {
3803 assert(type_entry->id == TypeTableEntryIdStruct);
3803 assert(type_entry->id == ZigTypeIdStruct);
38043804 assert(type_entry->data.structure.complete);
38053805 if (type_entry->data.structure.src_field_count == 0)
38063806 return nullptr;
......@@ -3811,7 +3811,7 @@ TypeStructField *find_struct_type_field(ZigType *type_entry, Buf *name) {
38113811}
38123812
38133813TypeUnionField *find_union_type_field(ZigType *type_entry, Buf *name) {
3814 assert(type_entry->id == TypeTableEntryIdUnion);
3814 assert(type_entry->id == ZigTypeIdUnion);
38153815 assert(type_entry->data.unionation.zero_bits_known);
38163816 if (type_entry->data.unionation.src_field_count == 0)
38173817 return nullptr;
......@@ -3822,7 +3822,7 @@ TypeUnionField *find_union_type_field(ZigType *type_entry, Buf *name) {
38223822}
38233823
38243824TypeUnionField *find_union_field_by_tag(ZigType *type_entry, const BigInt *tag) {
3825 assert(type_entry->id == TypeTableEntryIdUnion);
3825 assert(type_entry->id == ZigTypeIdUnion);
38263826 assert(type_entry->data.unionation.zero_bits_known);
38273827 for (uint32_t i = 0; i < type_entry->data.unionation.src_field_count; i += 1) {
38283828 TypeUnionField *field = &type_entry->data.unionation.fields[i];
......@@ -3847,47 +3847,47 @@ TypeEnumField *find_enum_field_by_tag(ZigType *enum_type, const BigInt *tag) {
38473847
38483848static bool is_container(ZigType *type_entry) {
38493849 switch (type_entry->id) {
3850 case TypeTableEntryIdInvalid:
3850 case ZigTypeIdInvalid:
38513851 zig_unreachable();
3852 case TypeTableEntryIdStruct:
3853 case TypeTableEntryIdEnum:
3854 case TypeTableEntryIdUnion:
3852 case ZigTypeIdStruct:
3853 case ZigTypeIdEnum:
3854 case ZigTypeIdUnion:
38553855 return true;
3856 case TypeTableEntryIdPointer:
3857 case TypeTableEntryIdMetaType:
3858 case TypeTableEntryIdVoid:
3859 case TypeTableEntryIdBool:
3860 case TypeTableEntryIdUnreachable:
3861 case TypeTableEntryIdInt:
3862 case TypeTableEntryIdFloat:
3863 case TypeTableEntryIdArray:
3864 case TypeTableEntryIdComptimeFloat:
3865 case TypeTableEntryIdComptimeInt:
3866 case TypeTableEntryIdUndefined:
3867 case TypeTableEntryIdNull:
3868 case TypeTableEntryIdOptional:
3869 case TypeTableEntryIdErrorUnion:
3870 case TypeTableEntryIdErrorSet:
3871 case TypeTableEntryIdFn:
3872 case TypeTableEntryIdNamespace:
3873 case TypeTableEntryIdBlock:
3874 case TypeTableEntryIdBoundFn:
3875 case TypeTableEntryIdArgTuple:
3876 case TypeTableEntryIdOpaque:
3877 case TypeTableEntryIdPromise:
3856 case ZigTypeIdPointer:
3857 case ZigTypeIdMetaType:
3858 case ZigTypeIdVoid:
3859 case ZigTypeIdBool:
3860 case ZigTypeIdUnreachable:
3861 case ZigTypeIdInt:
3862 case ZigTypeIdFloat:
3863 case ZigTypeIdArray:
3864 case ZigTypeIdComptimeFloat:
3865 case ZigTypeIdComptimeInt:
3866 case ZigTypeIdUndefined:
3867 case ZigTypeIdNull:
3868 case ZigTypeIdOptional:
3869 case ZigTypeIdErrorUnion:
3870 case ZigTypeIdErrorSet:
3871 case ZigTypeIdFn:
3872 case ZigTypeIdNamespace:
3873 case ZigTypeIdBlock:
3874 case ZigTypeIdBoundFn:
3875 case ZigTypeIdArgTuple:
3876 case ZigTypeIdOpaque:
3877 case ZigTypeIdPromise:
38783878 return false;
38793879 }
38803880 zig_unreachable();
38813881}
38823882
38833883bool is_ref(ZigType *type_entry) {
3884 return type_entry->id == TypeTableEntryIdPointer && type_entry->data.pointer.ptr_len == PtrLenSingle;
3884 return type_entry->id == ZigTypeIdPointer && type_entry->data.pointer.ptr_len == PtrLenSingle;
38853885}
38863886
38873887bool is_array_ref(ZigType *type_entry) {
38883888 ZigType *array = is_ref(type_entry) ?
38893889 type_entry->data.pointer.child_type : type_entry;
3890 return array->id == TypeTableEntryIdArray;
3890 return array->id == ZigTypeIdArray;
38913891}
38923892
38933893bool is_container_ref(ZigType *type_entry) {
......@@ -3903,50 +3903,50 @@ ZigType *container_ref_type(ZigType *type_entry) {
39033903
39043904void resolve_container_type(CodeGen *g, ZigType *type_entry) {
39053905 switch (type_entry->id) {
3906 case TypeTableEntryIdStruct:
3906 case ZigTypeIdStruct:
39073907 resolve_struct_type(g, type_entry);
39083908 break;
3909 case TypeTableEntryIdEnum:
3909 case ZigTypeIdEnum:
39103910 resolve_enum_type(g, type_entry);
39113911 break;
3912 case TypeTableEntryIdUnion:
3912 case ZigTypeIdUnion:
39133913 resolve_union_type(g, type_entry);
39143914 break;
3915 case TypeTableEntryIdPointer:
3916 case TypeTableEntryIdMetaType:
3917 case TypeTableEntryIdVoid:
3918 case TypeTableEntryIdBool:
3919 case TypeTableEntryIdUnreachable:
3920 case TypeTableEntryIdInt:
3921 case TypeTableEntryIdFloat:
3922 case TypeTableEntryIdArray:
3923 case TypeTableEntryIdComptimeFloat:
3924 case TypeTableEntryIdComptimeInt:
3925 case TypeTableEntryIdUndefined:
3926 case TypeTableEntryIdNull:
3927 case TypeTableEntryIdOptional:
3928 case TypeTableEntryIdErrorUnion:
3929 case TypeTableEntryIdErrorSet:
3930 case TypeTableEntryIdFn:
3931 case TypeTableEntryIdNamespace:
3932 case TypeTableEntryIdBlock:
3933 case TypeTableEntryIdBoundFn:
3934 case TypeTableEntryIdInvalid:
3935 case TypeTableEntryIdArgTuple:
3936 case TypeTableEntryIdOpaque:
3937 case TypeTableEntryIdPromise:
3915 case ZigTypeIdPointer:
3916 case ZigTypeIdMetaType:
3917 case ZigTypeIdVoid:
3918 case ZigTypeIdBool:
3919 case ZigTypeIdUnreachable:
3920 case ZigTypeIdInt:
3921 case ZigTypeIdFloat:
3922 case ZigTypeIdArray:
3923 case ZigTypeIdComptimeFloat:
3924 case ZigTypeIdComptimeInt:
3925 case ZigTypeIdUndefined:
3926 case ZigTypeIdNull:
3927 case ZigTypeIdOptional:
3928 case ZigTypeIdErrorUnion:
3929 case ZigTypeIdErrorSet:
3930 case ZigTypeIdFn:
3931 case ZigTypeIdNamespace:
3932 case ZigTypeIdBlock:
3933 case ZigTypeIdBoundFn:
3934 case ZigTypeIdInvalid:
3935 case ZigTypeIdArgTuple:
3936 case ZigTypeIdOpaque:
3937 case ZigTypeIdPromise:
39383938 zig_unreachable();
39393939 }
39403940}
39413941
39423942ZigType *get_codegen_ptr_type(ZigType *type) {
3943 if (type->id == TypeTableEntryIdPointer) return type;
3944 if (type->id == TypeTableEntryIdFn) return type;
3945 if (type->id == TypeTableEntryIdPromise) return type;
3946 if (type->id == TypeTableEntryIdOptional) {
3947 if (type->data.maybe.child_type->id == TypeTableEntryIdPointer) return type->data.maybe.child_type;
3948 if (type->data.maybe.child_type->id == TypeTableEntryIdFn) return type->data.maybe.child_type;
3949 if (type->data.maybe.child_type->id == TypeTableEntryIdPromise) return type->data.maybe.child_type;
3943 if (type->id == ZigTypeIdPointer) return type;
3944 if (type->id == ZigTypeIdFn) return type;
3945 if (type->id == ZigTypeIdPromise) return type;
3946 if (type->id == ZigTypeIdOptional) {
3947 if (type->data.maybe.child_type->id == ZigTypeIdPointer) return type->data.maybe.child_type;
3948 if (type->data.maybe.child_type->id == ZigTypeIdFn) return type->data.maybe.child_type;
3949 if (type->data.maybe.child_type->id == ZigTypeIdPromise) return type->data.maybe.child_type;
39503950 }
39513951 return nullptr;
39523952}
......@@ -3957,11 +3957,11 @@ bool type_is_codegen_pointer(ZigType *type) {
39573957
39583958uint32_t get_ptr_align(ZigType *type) {
39593959 ZigType *ptr_type = get_codegen_ptr_type(type);
3960 if (ptr_type->id == TypeTableEntryIdPointer) {
3960 if (ptr_type->id == ZigTypeIdPointer) {
39613961 return ptr_type->data.pointer.alignment;
3962 } else if (ptr_type->id == TypeTableEntryIdFn) {
3962 } else if (ptr_type->id == ZigTypeIdFn) {
39633963 return (ptr_type->data.fn.fn_type_id.alignment == 0) ? 1 : ptr_type->data.fn.fn_type_id.alignment;
3964 } else if (ptr_type->id == TypeTableEntryIdPromise) {
3964 } else if (ptr_type->id == ZigTypeIdPromise) {
39653965 return 1;
39663966 } else {
39673967 zig_unreachable();
......@@ -3970,11 +3970,11 @@ uint32_t get_ptr_align(ZigType *type) {
39703970
39713971bool get_ptr_const(ZigType *type) {
39723972 ZigType *ptr_type = get_codegen_ptr_type(type);
3973 if (ptr_type->id == TypeTableEntryIdPointer) {
3973 if (ptr_type->id == ZigTypeIdPointer) {
39743974 return ptr_type->data.pointer.is_const;
3975 } else if (ptr_type->id == TypeTableEntryIdFn) {
3975 } else if (ptr_type->id == ZigTypeIdFn) {
39763976 return true;
3977 } else if (ptr_type->id == TypeTableEntryIdPromise) {
3977 } else if (ptr_type->id == ZigTypeIdPromise) {
39783978 return true;
39793979 } else {
39803980 zig_unreachable();
......@@ -4067,13 +4067,13 @@ void analyze_fn_ir(CodeGen *g, ZigFn *fn_table_entry, AstNode *return_type_node)
40674067 return;
40684068 }
40694069
4070 if (fn_type_id->return_type->id == TypeTableEntryIdErrorUnion) {
4070 if (fn_type_id->return_type->id == ZigTypeIdErrorUnion) {
40714071 ZigType *return_err_set_type = fn_type_id->return_type->data.error_union.err_set_type;
40724072 if (return_err_set_type->data.error_set.infer_fn != nullptr) {
40734073 ZigType *inferred_err_set_type;
4074 if (fn_table_entry->src_implicit_return_type->id == TypeTableEntryIdErrorSet) {
4074 if (fn_table_entry->src_implicit_return_type->id == ZigTypeIdErrorSet) {
40754075 inferred_err_set_type = fn_table_entry->src_implicit_return_type;
4076 } else if (fn_table_entry->src_implicit_return_type->id == TypeTableEntryIdErrorUnion) {
4076 } else if (fn_table_entry->src_implicit_return_type->id == ZigTypeIdErrorUnion) {
40774077 inferred_err_set_type = fn_table_entry->src_implicit_return_type->data.error_union.err_set_type;
40784078 } else {
40794079 add_node_error(g, return_type_node,
......@@ -4154,7 +4154,7 @@ static void add_symbols_from_import(CodeGen *g, AstNode *src_use_node, AstNode *
41544154 }
41554155
41564156 IrInstruction *use_target_value = src_use_node->data.use.value;
4157 if (use_target_value->value.type->id == TypeTableEntryIdInvalid) {
4157 if (use_target_value->value.type->id == ZigTypeIdInvalid) {
41584158 dst_use_node->owner->any_imports_failed = true;
41594159 return;
41604160 }
......@@ -4230,7 +4230,7 @@ void preview_use_decl(CodeGen *g, AstNode *node) {
42304230 IrInstruction *result = analyze_const_value(g, &node->owner->decls_scope->base,
42314231 node->data.use.expr, g->builtin_types.entry_namespace, nullptr);
42324232
4233 if (result->value.type->id == TypeTableEntryIdInvalid)
4233 if (result->value.type->id == ZigTypeIdInvalid)
42344234 node->owner->any_imports_failed = true;
42354235
42364236 node->data.use.value = result;
......@@ -4357,7 +4357,7 @@ void semantic_analyze(CodeGen *g) {
43574357
43584358ZigType *get_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
43594359 TypeId type_id = {};
4360 type_id.id = TypeTableEntryIdInt;
4360 type_id.id = ZigTypeIdInt;
43614361 type_id.data.integer.is_signed = is_signed;
43624362 type_id.data.integer.bit_count = size_in_bits;
43634363
......@@ -4382,38 +4382,38 @@ ZigType *get_c_int_type(CodeGen *g, CIntType c_int_type) {
43824382
43834383bool handle_is_ptr(ZigType *type_entry) {
43844384 switch (type_entry->id) {
4385 case TypeTableEntryIdInvalid:
4386 case TypeTableEntryIdMetaType:
4387 case TypeTableEntryIdComptimeFloat:
4388 case TypeTableEntryIdComptimeInt:
4389 case TypeTableEntryIdUndefined:
4390 case TypeTableEntryIdNull:
4391 case TypeTableEntryIdNamespace:
4392 case TypeTableEntryIdBlock:
4393 case TypeTableEntryIdBoundFn:
4394 case TypeTableEntryIdArgTuple:
4395 case TypeTableEntryIdOpaque:
4385 case ZigTypeIdInvalid:
4386 case ZigTypeIdMetaType:
4387 case ZigTypeIdComptimeFloat:
4388 case ZigTypeIdComptimeInt:
4389 case ZigTypeIdUndefined:
4390 case ZigTypeIdNull:
4391 case ZigTypeIdNamespace:
4392 case ZigTypeIdBlock:
4393 case ZigTypeIdBoundFn:
4394 case ZigTypeIdArgTuple:
4395 case ZigTypeIdOpaque:
43964396 zig_unreachable();
4397 case TypeTableEntryIdUnreachable:
4398 case TypeTableEntryIdVoid:
4399 case TypeTableEntryIdBool:
4400 case TypeTableEntryIdInt:
4401 case TypeTableEntryIdFloat:
4402 case TypeTableEntryIdPointer:
4403 case TypeTableEntryIdErrorSet:
4404 case TypeTableEntryIdFn:
4405 case TypeTableEntryIdEnum:
4406 case TypeTableEntryIdPromise:
4397 case ZigTypeIdUnreachable:
4398 case ZigTypeIdVoid:
4399 case ZigTypeIdBool:
4400 case ZigTypeIdInt:
4401 case ZigTypeIdFloat:
4402 case ZigTypeIdPointer:
4403 case ZigTypeIdErrorSet:
4404 case ZigTypeIdFn:
4405 case ZigTypeIdEnum:
4406 case ZigTypeIdPromise:
44074407 return false;
4408 case TypeTableEntryIdArray:
4409 case TypeTableEntryIdStruct:
4408 case ZigTypeIdArray:
4409 case ZigTypeIdStruct:
44104410 return type_has_bits(type_entry);
4411 case TypeTableEntryIdErrorUnion:
4411 case ZigTypeIdErrorUnion:
44124412 return type_has_bits(type_entry->data.error_union.payload_type);
4413 case TypeTableEntryIdOptional:
4413 case ZigTypeIdOptional:
44144414 return type_has_bits(type_entry->data.maybe.child_type) &&
44154415 !type_is_codegen_pointer(type_entry->data.maybe.child_type);
4416 case TypeTableEntryIdUnion:
4416 case ZigTypeIdUnion:
44174417 assert(type_entry->data.unionation.complete);
44184418 if (type_entry->data.unionation.gen_field_count == 0)
44194419 return false;
......@@ -4697,16 +4697,16 @@ static uint32_t hash_const_val_ptr(ConstExprValue *const_val) {
46974697static uint32_t hash_const_val(ConstExprValue *const_val) {
46984698 assert(const_val->special == ConstValSpecialStatic);
46994699 switch (const_val->type->id) {
4700 case TypeTableEntryIdOpaque:
4700 case ZigTypeIdOpaque:
47014701 zig_unreachable();
4702 case TypeTableEntryIdBool:
4702 case ZigTypeIdBool:
47034703 return const_val->data.x_bool ? (uint32_t)127863866 : (uint32_t)215080464;
4704 case TypeTableEntryIdMetaType:
4704 case ZigTypeIdMetaType:
47054705 return hash_ptr(const_val->data.x_type);
4706 case TypeTableEntryIdVoid:
4706 case ZigTypeIdVoid:
47074707 return (uint32_t)4149439618;
4708 case TypeTableEntryIdInt:
4709 case TypeTableEntryIdComptimeInt:
4708 case ZigTypeIdInt:
4709 case ZigTypeIdComptimeInt:
47104710 {
47114711 uint32_t result = 1331471175;
47124712 for (size_t i = 0; i < const_val->data.x_bigint.digit_count; i += 1) {
......@@ -4715,7 +4715,7 @@ static uint32_t hash_const_val(ConstExprValue *const_val) {
47154715 }
47164716 return result;
47174717 }
4718 case TypeTableEntryIdEnum:
4718 case ZigTypeIdEnum:
47194719 {
47204720 uint32_t result = 31643936;
47214721 for (size_t i = 0; i < const_val->data.x_enum_tag.digit_count; i += 1) {
......@@ -4724,7 +4724,7 @@ static uint32_t hash_const_val(ConstExprValue *const_val) {
47244724 }
47254725 return result;
47264726 }
4727 case TypeTableEntryIdFloat:
4727 case ZigTypeIdFloat:
47284728 switch (const_val->type->data.floating.bit_count) {
47294729 case 16:
47304730 {
......@@ -4754,39 +4754,39 @@ static uint32_t hash_const_val(ConstExprValue *const_val) {
47544754 default:
47554755 zig_unreachable();
47564756 }
4757 case TypeTableEntryIdComptimeFloat:
4757 case ZigTypeIdComptimeFloat:
47584758 {
47594759 float128_t f128 = bigfloat_to_f128(&const_val->data.x_bigfloat);
47604760 uint32_t ints[4];
47614761 memcpy(&ints[0], &f128, 16);
47624762 return ints[0] ^ ints[1] ^ ints[2] ^ ints[3] ^ 0xed8b3dfb;
47634763 }
4764 case TypeTableEntryIdArgTuple:
4764 case ZigTypeIdArgTuple:
47654765 return (uint32_t)const_val->data.x_arg_tuple.start_index * (uint32_t)281907309 +
47664766 (uint32_t)const_val->data.x_arg_tuple.end_index * (uint32_t)2290442768;
4767 case TypeTableEntryIdFn:
4767 case ZigTypeIdFn:
47684768 assert(const_val->data.x_ptr.mut == ConstPtrMutComptimeConst);
47694769 assert(const_val->data.x_ptr.special == ConstPtrSpecialFunction);
47704770 return 3677364617 ^ hash_ptr(const_val->data.x_ptr.data.fn.fn_entry);
4771 case TypeTableEntryIdPointer:
4771 case ZigTypeIdPointer:
47724772 return hash_const_val_ptr(const_val);
4773 case TypeTableEntryIdPromise:
4773 case ZigTypeIdPromise:
47744774 // TODO better hashing algorithm
47754775 return 223048345;
4776 case TypeTableEntryIdUndefined:
4776 case ZigTypeIdUndefined:
47774777 return 162837799;
4778 case TypeTableEntryIdNull:
4778 case ZigTypeIdNull:
47794779 return 844854567;
4780 case TypeTableEntryIdArray:
4780 case ZigTypeIdArray:
47814781 // TODO better hashing algorithm
47824782 return 1166190605;
4783 case TypeTableEntryIdStruct:
4783 case ZigTypeIdStruct:
47844784 // TODO better hashing algorithm
47854785 return 1532530855;
4786 case TypeTableEntryIdUnion:
4786 case ZigTypeIdUnion:
47874787 // TODO better hashing algorithm
47884788 return 2709806591;
4789 case TypeTableEntryIdOptional:
4789 case ZigTypeIdOptional:
47904790 if (get_codegen_ptr_type(const_val->type) != nullptr) {
47914791 return hash_const_val(const_val) * 1992916303;
47924792 } else {
......@@ -4796,19 +4796,19 @@ static uint32_t hash_const_val(ConstExprValue *const_val) {
47964796 return 4016830364;
47974797 }
47984798 }
4799 case TypeTableEntryIdErrorUnion:
4799 case ZigTypeIdErrorUnion:
48004800 // TODO better hashing algorithm
48014801 return 3415065496;
4802 case TypeTableEntryIdErrorSet:
4802 case ZigTypeIdErrorSet:
48034803 assert(const_val->data.x_err_set != nullptr);
48044804 return const_val->data.x_err_set->value ^ 2630160122;
4805 case TypeTableEntryIdNamespace:
4805 case ZigTypeIdNamespace:
48064806 return hash_ptr(const_val->data.x_import);
4807 case TypeTableEntryIdBlock:
4807 case ZigTypeIdBlock:
48084808 return hash_ptr(const_val->data.x_block);
4809 case TypeTableEntryIdBoundFn:
4810 case TypeTableEntryIdInvalid:
4811 case TypeTableEntryIdUnreachable:
4809 case ZigTypeIdBoundFn:
4810 case ZigTypeIdInvalid:
4811 case ZigTypeIdUnreachable:
48124812 zig_unreachable();
48134813 }
48144814 zig_unreachable();
......@@ -4851,32 +4851,32 @@ bool generic_fn_type_id_eql(GenericFnTypeId *a, GenericFnTypeId *b) {
48514851static bool can_mutate_comptime_var_state(ConstExprValue *value) {
48524852 assert(value != nullptr);
48534853 switch (value->type->id) {
4854 case TypeTableEntryIdInvalid:
4854 case ZigTypeIdInvalid:
48554855 zig_unreachable();
4856 case TypeTableEntryIdMetaType:
4857 case TypeTableEntryIdVoid:
4858 case TypeTableEntryIdBool:
4859 case TypeTableEntryIdUnreachable:
4860 case TypeTableEntryIdInt:
4861 case TypeTableEntryIdFloat:
4862 case TypeTableEntryIdComptimeFloat:
4863 case TypeTableEntryIdComptimeInt:
4864 case TypeTableEntryIdUndefined:
4865 case TypeTableEntryIdNull:
4866 case TypeTableEntryIdNamespace:
4867 case TypeTableEntryIdBoundFn:
4868 case TypeTableEntryIdFn:
4869 case TypeTableEntryIdBlock:
4870 case TypeTableEntryIdOpaque:
4871 case TypeTableEntryIdPromise:
4872 case TypeTableEntryIdErrorSet:
4873 case TypeTableEntryIdEnum:
4856 case ZigTypeIdMetaType:
4857 case ZigTypeIdVoid:
4858 case ZigTypeIdBool:
4859 case ZigTypeIdUnreachable:
4860 case ZigTypeIdInt:
4861 case ZigTypeIdFloat:
4862 case ZigTypeIdComptimeFloat:
4863 case ZigTypeIdComptimeInt:
4864 case ZigTypeIdUndefined:
4865 case ZigTypeIdNull:
4866 case ZigTypeIdNamespace:
4867 case ZigTypeIdBoundFn:
4868 case ZigTypeIdFn:
4869 case ZigTypeIdBlock:
4870 case ZigTypeIdOpaque:
4871 case ZigTypeIdPromise:
4872 case ZigTypeIdErrorSet:
4873 case ZigTypeIdEnum:
48744874 return false;
48754875
4876 case TypeTableEntryIdPointer:
4876 case ZigTypeIdPointer:
48774877 return value->data.x_ptr.mut == ConstPtrMutComptimeVar;
48784878
4879 case TypeTableEntryIdArray:
4879 case ZigTypeIdArray:
48804880 if (value->type->data.array.len == 0)
48814881 return false;
48824882 if (value->data.x_array.special == ConstArraySpecialUndef)
......@@ -4887,30 +4887,30 @@ static bool can_mutate_comptime_var_state(ConstExprValue *value) {
48874887 }
48884888 return false;
48894889
4890 case TypeTableEntryIdStruct:
4890 case ZigTypeIdStruct:
48914891 for (uint32_t i = 0; i < value->type->data.structure.src_field_count; i += 1) {
48924892 if (can_mutate_comptime_var_state(&value->data.x_struct.fields[i]))
48934893 return true;
48944894 }
48954895 return false;
48964896
4897 case TypeTableEntryIdOptional:
4897 case ZigTypeIdOptional:
48984898 if (get_codegen_ptr_type(value->type) != nullptr)
48994899 return value->data.x_ptr.mut == ConstPtrMutComptimeVar;
49004900 if (value->data.x_optional == nullptr)
49014901 return false;
49024902 return can_mutate_comptime_var_state(value->data.x_optional);
49034903
4904 case TypeTableEntryIdErrorUnion:
4904 case ZigTypeIdErrorUnion:
49054905 if (value->data.x_err_union.err != nullptr)
49064906 return false;
49074907 assert(value->data.x_err_union.payload != nullptr);
49084908 return can_mutate_comptime_var_state(value->data.x_err_union.payload);
49094909
4910 case TypeTableEntryIdUnion:
4910 case ZigTypeIdUnion:
49114911 return can_mutate_comptime_var_state(value->data.x_union.payload);
49124912
4913 case TypeTableEntryIdArgTuple:
4913 case ZigTypeIdArgTuple:
49144914 zig_panic("TODO var args at comptime is currently not supported");
49154915 }
49164916 zig_unreachable();
......@@ -4918,41 +4918,41 @@ static bool can_mutate_comptime_var_state(ConstExprValue *value) {
49184918
49194919static bool return_type_is_cacheable(ZigType *return_type) {
49204920 switch (return_type->id) {
4921 case TypeTableEntryIdInvalid:
4921 case ZigTypeIdInvalid:
49224922 zig_unreachable();
4923 case TypeTableEntryIdMetaType:
4924 case TypeTableEntryIdVoid:
4925 case TypeTableEntryIdBool:
4926 case TypeTableEntryIdUnreachable:
4927 case TypeTableEntryIdInt:
4928 case TypeTableEntryIdFloat:
4929 case TypeTableEntryIdComptimeFloat:
4930 case TypeTableEntryIdComptimeInt:
4931 case TypeTableEntryIdUndefined:
4932 case TypeTableEntryIdNull:
4933 case TypeTableEntryIdNamespace:
4934 case TypeTableEntryIdBoundFn:
4935 case TypeTableEntryIdFn:
4936 case TypeTableEntryIdBlock:
4937 case TypeTableEntryIdOpaque:
4938 case TypeTableEntryIdPromise:
4939 case TypeTableEntryIdErrorSet:
4940 case TypeTableEntryIdEnum:
4941 case TypeTableEntryIdPointer:
4923 case ZigTypeIdMetaType:
4924 case ZigTypeIdVoid:
4925 case ZigTypeIdBool:
4926 case ZigTypeIdUnreachable:
4927 case ZigTypeIdInt:
4928 case ZigTypeIdFloat:
4929 case ZigTypeIdComptimeFloat:
4930 case ZigTypeIdComptimeInt:
4931 case ZigTypeIdUndefined:
4932 case ZigTypeIdNull:
4933 case ZigTypeIdNamespace:
4934 case ZigTypeIdBoundFn:
4935 case ZigTypeIdFn:
4936 case ZigTypeIdBlock:
4937 case ZigTypeIdOpaque:
4938 case ZigTypeIdPromise:
4939 case ZigTypeIdErrorSet:
4940 case ZigTypeIdEnum:
4941 case ZigTypeIdPointer:
49424942 return true;
49434943
4944 case TypeTableEntryIdArray:
4945 case TypeTableEntryIdStruct:
4946 case TypeTableEntryIdUnion:
4944 case ZigTypeIdArray:
4945 case ZigTypeIdStruct:
4946 case ZigTypeIdUnion:
49474947 return false;
49484948
4949 case TypeTableEntryIdOptional:
4949 case ZigTypeIdOptional:
49504950 return return_type_is_cacheable(return_type->data.maybe.child_type);
49514951
4952 case TypeTableEntryIdErrorUnion:
4952 case ZigTypeIdErrorUnion:
49534953 return return_type_is_cacheable(return_type->data.error_union.payload_type);
49544954
4955 case TypeTableEntryIdArgTuple:
4955 case ZigTypeIdArgTuple:
49564956 zig_panic("TODO var args at comptime is currently not supported");
49574957 }
49584958 zig_unreachable();
......@@ -5029,54 +5029,54 @@ bool fn_eval_eql(Scope *a, Scope *b) {
50295029
50305030bool type_has_bits(ZigType *type_entry) {
50315031 assert(type_entry);
5032 assert(type_entry->id != TypeTableEntryIdInvalid);
5032 assert(type_entry->id != ZigTypeIdInvalid);
50335033 assert(type_has_zero_bits_known(type_entry));
50345034 return !type_entry->zero_bits;
50355035}
50365036
50375037bool type_requires_comptime(ZigType *type_entry) {
50385038 switch (type_entry->id) {
5039 case TypeTableEntryIdInvalid:
5040 case TypeTableEntryIdOpaque:
5039 case ZigTypeIdInvalid:
5040 case ZigTypeIdOpaque:
50415041 zig_unreachable();
5042 case TypeTableEntryIdComptimeFloat:
5043 case TypeTableEntryIdComptimeInt:
5044 case TypeTableEntryIdUndefined:
5045 case TypeTableEntryIdNull:
5046 case TypeTableEntryIdMetaType:
5047 case TypeTableEntryIdNamespace:
5048 case TypeTableEntryIdBlock:
5049 case TypeTableEntryIdBoundFn:
5050 case TypeTableEntryIdArgTuple:
5042 case ZigTypeIdComptimeFloat:
5043 case ZigTypeIdComptimeInt:
5044 case ZigTypeIdUndefined:
5045 case ZigTypeIdNull:
5046 case ZigTypeIdMetaType:
5047 case ZigTypeIdNamespace:
5048 case ZigTypeIdBlock:
5049 case ZigTypeIdBoundFn:
5050 case ZigTypeIdArgTuple:
50515051 return true;
5052 case TypeTableEntryIdArray:
5052 case ZigTypeIdArray:
50535053 return type_requires_comptime(type_entry->data.array.child_type);
5054 case TypeTableEntryIdStruct:
5054 case ZigTypeIdStruct:
50555055 assert(type_has_zero_bits_known(type_entry));
50565056 return type_entry->data.structure.requires_comptime;
5057 case TypeTableEntryIdUnion:
5057 case ZigTypeIdUnion:
50585058 assert(type_has_zero_bits_known(type_entry));
50595059 return type_entry->data.unionation.requires_comptime;
5060 case TypeTableEntryIdOptional:
5060 case ZigTypeIdOptional:
50615061 return type_requires_comptime(type_entry->data.maybe.child_type);
5062 case TypeTableEntryIdErrorUnion:
5062 case ZigTypeIdErrorUnion:
50635063 return type_requires_comptime(type_entry->data.error_union.payload_type);
5064 case TypeTableEntryIdPointer:
5065 if (type_entry->data.pointer.child_type->id == TypeTableEntryIdOpaque) {
5064 case ZigTypeIdPointer:
5065 if (type_entry->data.pointer.child_type->id == ZigTypeIdOpaque) {
50665066 return false;
50675067 } else {
50685068 return type_requires_comptime(type_entry->data.pointer.child_type);
50695069 }
5070 case TypeTableEntryIdFn:
5070 case ZigTypeIdFn:
50715071 return type_entry->data.fn.is_generic;
5072 case TypeTableEntryIdEnum:
5073 case TypeTableEntryIdErrorSet:
5074 case TypeTableEntryIdBool:
5075 case TypeTableEntryIdInt:
5076 case TypeTableEntryIdFloat:
5077 case TypeTableEntryIdVoid:
5078 case TypeTableEntryIdUnreachable:
5079 case TypeTableEntryIdPromise:
5072 case ZigTypeIdEnum:
5073 case ZigTypeIdErrorSet:
5074 case ZigTypeIdBool:
5075 case ZigTypeIdInt:
5076 case ZigTypeIdFloat:
5077 case ZigTypeIdVoid:
5078 case ZigTypeIdUnreachable:
5079 case ZigTypeIdPromise:
50805080 return false;
50815081 }
50825082 zig_unreachable();
......@@ -5192,9 +5192,9 @@ ConstExprValue *create_const_signed(ZigType *type, int64_t x) {
51925192void init_const_float(ConstExprValue *const_val, ZigType *type, double value) {
51935193 const_val->special = ConstValSpecialStatic;
51945194 const_val->type = type;
5195 if (type->id == TypeTableEntryIdComptimeFloat) {
5195 if (type->id == ZigTypeIdComptimeFloat) {
51965196 bigfloat_init_64(&const_val->data.x_bigfloat, value);
5197 } else if (type->id == TypeTableEntryIdFloat) {
5197 } else if (type->id == ZigTypeIdFloat) {
51985198 switch (type->data.floating.bit_count) {
51995199 case 16:
52005200 const_val->data.x_f16 = zig_double_to_f16(value);
......@@ -5273,7 +5273,7 @@ ConstExprValue *create_const_type(CodeGen *g, ZigType *type_value) {
52735273void init_const_slice(CodeGen *g, ConstExprValue *const_val, ConstExprValue *array_val,
52745274 size_t start, size_t len, bool is_const)
52755275{
5276 assert(array_val->type->id == TypeTableEntryIdArray);
5276 assert(array_val->type->id == ZigTypeIdArray);
52775277
52785278 ZigType *ptr_type = get_pointer_to_type_extra(g, array_val->type->data.array.child_type,
52795279 is_const, false, PtrLenUnknown, get_abi_alignment(g, array_val->type->data.array.child_type),
......@@ -5297,7 +5297,7 @@ ConstExprValue *create_const_slice(CodeGen *g, ConstExprValue *array_val, size_t
52975297void init_const_ptr_array(CodeGen *g, ConstExprValue *const_val, ConstExprValue *array_val,
52985298 size_t elem_index, bool is_const, PtrLen ptr_len)
52995299{
5300 assert(array_val->type->id == TypeTableEntryIdArray);
5300 assert(array_val->type->id == ZigTypeIdArray);
53015301 ZigType *child_type = array_val->type->data.array.child_type;
53025302
53035303 const_val->special = ConstValSpecialStatic;
......@@ -5363,10 +5363,10 @@ ConstExprValue *create_const_arg_tuple(CodeGen *g, size_t arg_index_start, size_
53635363void init_const_undefined(CodeGen *g, ConstExprValue *const_val) {
53645364 Error err;
53655365 ZigType *wanted_type = const_val->type;
5366 if (wanted_type->id == TypeTableEntryIdArray) {
5366 if (wanted_type->id == ZigTypeIdArray) {
53675367 const_val->special = ConstValSpecialStatic;
53685368 const_val->data.x_array.special = ConstArraySpecialUndef;
5369 } else if (wanted_type->id == TypeTableEntryIdStruct) {
5369 } else if (wanted_type->id == ZigTypeIdStruct) {
53705370 if ((err = ensure_complete_type(g, wanted_type))) {
53715371 return;
53725372 }
......@@ -5403,13 +5403,13 @@ ConstExprValue *create_const_vals(size_t count) {
54035403Error ensure_complete_type(CodeGen *g, ZigType *type_entry) {
54045404 if (type_is_invalid(type_entry))
54055405 return ErrorSemanticAnalyzeFail;
5406 if (type_entry->id == TypeTableEntryIdStruct) {
5406 if (type_entry->id == ZigTypeIdStruct) {
54075407 if (!type_entry->data.structure.complete)
54085408 return resolve_struct_type(g, type_entry);
5409 } else if (type_entry->id == TypeTableEntryIdEnum) {
5409 } else if (type_entry->id == ZigTypeIdEnum) {
54105410 if (!type_entry->data.enumeration.complete)
54115411 return resolve_enum_type(g, type_entry);
5412 } else if (type_entry->id == TypeTableEntryIdUnion) {
5412 } else if (type_entry->id == ZigTypeIdUnion) {
54135413 if (!type_entry->data.unionation.complete)
54145414 return resolve_union_type(g, type_entry);
54155415 }
......@@ -5419,11 +5419,11 @@ Error ensure_complete_type(CodeGen *g, ZigType *type_entry) {
54195419Error type_ensure_zero_bits_known(CodeGen *g, ZigType *type_entry) {
54205420 if (type_is_invalid(type_entry))
54215421 return ErrorSemanticAnalyzeFail;
5422 if (type_entry->id == TypeTableEntryIdStruct) {
5422 if (type_entry->id == ZigTypeIdStruct) {
54235423 return resolve_struct_zero_bits(g, type_entry);
5424 } else if (type_entry->id == TypeTableEntryIdEnum) {
5424 } else if (type_entry->id == ZigTypeIdEnum) {
54255425 return resolve_enum_zero_bits(g, type_entry);
5426 } else if (type_entry->id == TypeTableEntryIdUnion) {
5426 } else if (type_entry->id == ZigTypeIdUnion) {
54275427 return resolve_union_zero_bits(g, type_entry);
54285428 }
54295429 return ErrorNone;
......@@ -5488,11 +5488,11 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
54885488 assert(a->special == ConstValSpecialStatic);
54895489 assert(b->special == ConstValSpecialStatic);
54905490 switch (a->type->id) {
5491 case TypeTableEntryIdOpaque:
5491 case ZigTypeIdOpaque:
54925492 zig_unreachable();
5493 case TypeTableEntryIdEnum:
5493 case ZigTypeIdEnum:
54945494 return bigint_cmp(&a->data.x_enum_tag, &b->data.x_enum_tag) == CmpEQ;
5495 case TypeTableEntryIdUnion: {
5495 case ZigTypeIdUnion: {
54965496 ConstUnionValue *union1 = &a->data.x_union;
54975497 ConstUnionValue *union2 = &b->data.x_union;
54985498
......@@ -5507,15 +5507,15 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
55075507 }
55085508 return false;
55095509 }
5510 case TypeTableEntryIdMetaType:
5510 case ZigTypeIdMetaType:
55115511 return a->data.x_type == b->data.x_type;
5512 case TypeTableEntryIdVoid:
5512 case ZigTypeIdVoid:
55135513 return true;
5514 case TypeTableEntryIdErrorSet:
5514 case ZigTypeIdErrorSet:
55155515 return a->data.x_err_set->value == b->data.x_err_set->value;
5516 case TypeTableEntryIdBool:
5516 case ZigTypeIdBool:
55175517 return a->data.x_bool == b->data.x_bool;
5518 case TypeTableEntryIdFloat:
5518 case ZigTypeIdFloat:
55195519 assert(a->type->data.floating.bit_count == b->type->data.floating.bit_count);
55205520 switch (a->type->data.floating.bit_count) {
55215521 case 16:
......@@ -5529,15 +5529,15 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
55295529 default:
55305530 zig_unreachable();
55315531 }
5532 case TypeTableEntryIdComptimeFloat:
5532 case ZigTypeIdComptimeFloat:
55335533 return bigfloat_cmp(&a->data.x_bigfloat, &b->data.x_bigfloat) == CmpEQ;
5534 case TypeTableEntryIdInt:
5535 case TypeTableEntryIdComptimeInt:
5534 case ZigTypeIdInt:
5535 case ZigTypeIdComptimeInt:
55365536 return bigint_cmp(&a->data.x_bigint, &b->data.x_bigint) == CmpEQ;
5537 case TypeTableEntryIdPointer:
5538 case TypeTableEntryIdFn:
5537 case ZigTypeIdPointer:
5538 case ZigTypeIdFn:
55395539 return const_values_equal_ptr(a, b);
5540 case TypeTableEntryIdArray: {
5540 case ZigTypeIdArray: {
55415541 assert(a->type->data.array.len == b->type->data.array.len);
55425542 assert(a->data.x_array.special != ConstArraySpecialUndef);
55435543 assert(b->data.x_array.special != ConstArraySpecialUndef);
......@@ -5553,7 +5553,7 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
55535553
55545554 return true;
55555555 }
5556 case TypeTableEntryIdStruct:
5556 case ZigTypeIdStruct:
55575557 for (size_t i = 0; i < a->type->data.structure.src_field_count; i += 1) {
55585558 ConstExprValue *field_a = &a->data.x_struct.fields[i];
55595559 ConstExprValue *field_b = &b->data.x_struct.fields[i];
......@@ -5561,11 +5561,11 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
55615561 return false;
55625562 }
55635563 return true;
5564 case TypeTableEntryIdUndefined:
5564 case ZigTypeIdUndefined:
55655565 zig_panic("TODO");
5566 case TypeTableEntryIdNull:
5566 case ZigTypeIdNull:
55675567 zig_panic("TODO");
5568 case TypeTableEntryIdOptional:
5568 case ZigTypeIdOptional:
55695569 if (get_codegen_ptr_type(a->type) != nullptr)
55705570 return const_values_equal_ptr(a, b);
55715571 if (a->data.x_optional == nullptr || b->data.x_optional == nullptr) {
......@@ -5573,26 +5573,26 @@ bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
55735573 } else {
55745574 return const_values_equal(a->data.x_optional, b->data.x_optional);
55755575 }
5576 case TypeTableEntryIdErrorUnion:
5576 case ZigTypeIdErrorUnion:
55775577 zig_panic("TODO");
5578 case TypeTableEntryIdNamespace:
5578 case ZigTypeIdNamespace:
55795579 return a->data.x_import == b->data.x_import;
5580 case TypeTableEntryIdBlock:
5580 case ZigTypeIdBlock:
55815581 return a->data.x_block == b->data.x_block;
5582 case TypeTableEntryIdArgTuple:
5582 case ZigTypeIdArgTuple:
55835583 return a->data.x_arg_tuple.start_index == b->data.x_arg_tuple.start_index &&
55845584 a->data.x_arg_tuple.end_index == b->data.x_arg_tuple.end_index;
5585 case TypeTableEntryIdBoundFn:
5586 case TypeTableEntryIdInvalid:
5587 case TypeTableEntryIdUnreachable:
5588 case TypeTableEntryIdPromise:
5585 case ZigTypeIdBoundFn:
5586 case ZigTypeIdInvalid:
5587 case ZigTypeIdUnreachable:
5588 case ZigTypeIdPromise:
55895589 zig_unreachable();
55905590 }
55915591 zig_unreachable();
55925592}
55935593
55945594void eval_min_max_value_int(CodeGen *g, ZigType *int_type, BigInt *bigint, bool is_max) {
5595 assert(int_type->id == TypeTableEntryIdInt);
5595 assert(int_type->id == ZigTypeIdInt);
55965596 if (int_type->data.integral.bit_count == 0) {
55975597 bigint_init_unsigned(bigint, 0);
55985598 return;
......@@ -5629,13 +5629,13 @@ void eval_min_max_value_int(CodeGen *g, ZigType *int_type, BigInt *bigint, bool
56295629}
56305630
56315631void eval_min_max_value(CodeGen *g, ZigType *type_entry, ConstExprValue *const_val, bool is_max) {
5632 if (type_entry->id == TypeTableEntryIdInt) {
5632 if (type_entry->id == ZigTypeIdInt) {
56335633 const_val->special = ConstValSpecialStatic;
56345634 eval_min_max_value_int(g, type_entry, &const_val->data.x_bigint, is_max);
5635 } else if (type_entry->id == TypeTableEntryIdBool) {
5635 } else if (type_entry->id == ZigTypeIdBool) {
56365636 const_val->special = ConstValSpecialStatic;
56375637 const_val->data.x_bool = is_max;
5638 } else if (type_entry->id == TypeTableEntryIdVoid) {
5638 } else if (type_entry->id == ZigTypeIdVoid) {
56395639 // nothing to do
56405640 } else {
56415641 zig_unreachable();
......@@ -5692,18 +5692,18 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
56925692
56935693 ZigType *type_entry = const_val->type;
56945694 switch (type_entry->id) {
5695 case TypeTableEntryIdOpaque:
5695 case ZigTypeIdOpaque:
56965696 zig_unreachable();
5697 case TypeTableEntryIdInvalid:
5697 case ZigTypeIdInvalid:
56985698 buf_appendf(buf, "(invalid)");
56995699 return;
5700 case TypeTableEntryIdVoid:
5700 case ZigTypeIdVoid:
57015701 buf_appendf(buf, "{}");
57025702 return;
5703 case TypeTableEntryIdComptimeFloat:
5703 case ZigTypeIdComptimeFloat:
57045704 bigfloat_append_buf(buf, &const_val->data.x_bigfloat);
57055705 return;
5706 case TypeTableEntryIdFloat:
5706 case ZigTypeIdFloat:
57075707 switch (type_entry->data.floating.bit_count) {
57085708 case 16:
57095709 buf_appendf(buf, "%f", zig_f16_to_double(const_val->data.x_f16));
......@@ -5731,23 +5731,23 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
57315731 default:
57325732 zig_unreachable();
57335733 }
5734 case TypeTableEntryIdComptimeInt:
5735 case TypeTableEntryIdInt:
5734 case ZigTypeIdComptimeInt:
5735 case ZigTypeIdInt:
57365736 bigint_append_buf(buf, &const_val->data.x_bigint, 10);
57375737 return;
5738 case TypeTableEntryIdMetaType:
5738 case ZigTypeIdMetaType:
57395739 buf_appendf(buf, "%s", buf_ptr(&const_val->data.x_type->name));
57405740 return;
5741 case TypeTableEntryIdUnreachable:
5741 case ZigTypeIdUnreachable:
57425742 buf_appendf(buf, "unreachable");
57435743 return;
5744 case TypeTableEntryIdBool:
5744 case ZigTypeIdBool:
57455745 {
57465746 const char *value = const_val->data.x_bool ? "true" : "false";
57475747 buf_appendf(buf, "%s", value);
57485748 return;
57495749 }
5750 case TypeTableEntryIdFn:
5750 case ZigTypeIdFn:
57515751 {
57525752 assert(const_val->data.x_ptr.mut == ConstPtrMutComptimeConst);
57535753 assert(const_val->data.x_ptr.special == ConstPtrSpecialFunction);
......@@ -5755,15 +5755,15 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
57555755 buf_appendf(buf, "%s", buf_ptr(&fn_entry->symbol_name));
57565756 return;
57575757 }
5758 case TypeTableEntryIdPointer:
5758 case ZigTypeIdPointer:
57595759 return render_const_val_ptr(g, buf, const_val, type_entry);
5760 case TypeTableEntryIdBlock:
5760 case ZigTypeIdBlock:
57615761 {
57625762 AstNode *node = const_val->data.x_block->source_node;
57635763 buf_appendf(buf, "(scope:%" ZIG_PRI_usize ":%" ZIG_PRI_usize ")", node->line + 1, node->column + 1);
57645764 return;
57655765 }
5766 case TypeTableEntryIdArray:
5766 case ZigTypeIdArray:
57675767 {
57685768 ZigType *child_type = type_entry->data.array.child_type;
57695769 uint64_t len = type_entry->data.array.len;
......@@ -5774,7 +5774,7 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
57745774 }
57755775
57765776 // if it's []u8, assume UTF-8 and output a string
5777 if (child_type->id == TypeTableEntryIdInt &&
5777 if (child_type->id == ZigTypeIdInt &&
57785778 child_type->data.integral.bit_count == 8 &&
57795779 !child_type->data.integral.is_signed)
57805780 {
......@@ -5804,17 +5804,17 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
58045804 buf_appendf(buf, "}");
58055805 return;
58065806 }
5807 case TypeTableEntryIdNull:
5807 case ZigTypeIdNull:
58085808 {
58095809 buf_appendf(buf, "null");
58105810 return;
58115811 }
5812 case TypeTableEntryIdUndefined:
5812 case ZigTypeIdUndefined:
58135813 {
58145814 buf_appendf(buf, "undefined");
58155815 return;
58165816 }
5817 case TypeTableEntryIdOptional:
5817 case ZigTypeIdOptional:
58185818 {
58195819 if (get_codegen_ptr_type(const_val->type) != nullptr)
58205820 return render_const_val_ptr(g, buf, const_val, type_entry->data.maybe.child_type);
......@@ -5825,7 +5825,7 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
58255825 }
58265826 return;
58275827 }
5828 case TypeTableEntryIdNamespace:
5828 case ZigTypeIdNamespace:
58295829 {
58305830 ImportTableEntry *import = const_val->data.x_import;
58315831 if (import->c_import_node) {
......@@ -5835,51 +5835,51 @@ void render_const_value(CodeGen *g, Buf *buf, ConstExprValue *const_val) {
58355835 }
58365836 return;
58375837 }
5838 case TypeTableEntryIdBoundFn:
5838 case ZigTypeIdBoundFn:
58395839 {
58405840 ZigFn *fn_entry = const_val->data.x_bound_fn.fn;
58415841 buf_appendf(buf, "(bound fn %s)", buf_ptr(&fn_entry->symbol_name));
58425842 return;
58435843 }
5844 case TypeTableEntryIdStruct:
5844 case ZigTypeIdStruct:
58455845 {
58465846 buf_appendf(buf, "(struct %s constant)", buf_ptr(&type_entry->name));
58475847 return;
58485848 }
5849 case TypeTableEntryIdEnum:
5849 case ZigTypeIdEnum:
58505850 {
58515851 TypeEnumField *field = find_enum_field_by_tag(type_entry, &const_val->data.x_enum_tag);
58525852 buf_appendf(buf, "%s.%s", buf_ptr(&type_entry->name), buf_ptr(field->name));
58535853 return;
58545854 }
5855 case TypeTableEntryIdErrorUnion:
5855 case ZigTypeIdErrorUnion:
58565856 {
58575857 buf_appendf(buf, "(error union %s constant)", buf_ptr(&type_entry->name));
58585858 return;
58595859 }
5860 case TypeTableEntryIdUnion:
5860 case ZigTypeIdUnion:
58615861 {
58625862 buf_appendf(buf, "(union %s constant)", buf_ptr(&type_entry->name));
58635863 return;
58645864 }
5865 case TypeTableEntryIdErrorSet:
5865 case ZigTypeIdErrorSet:
58665866 {
58675867 buf_appendf(buf, "%s.%s", buf_ptr(&type_entry->name), buf_ptr(&const_val->data.x_err_set->name));
58685868 return;
58695869 }
5870 case TypeTableEntryIdArgTuple:
5870 case ZigTypeIdArgTuple:
58715871 {
58725872 buf_appendf(buf, "(args value)");
58735873 return;
58745874 }
5875 case TypeTableEntryIdPromise:
5875 case ZigTypeIdPromise:
58765876 zig_unreachable();
58775877 }
58785878 zig_unreachable();
58795879}
58805880
58815881ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
5882 ZigType *entry = new_type_table_entry(TypeTableEntryIdInt);
5882 ZigType *entry = new_type_table_entry(ZigTypeIdInt);
58835883 entry->is_copyable = true;
58845884 entry->type_ref = (size_in_bits == 0) ? LLVMVoidType() : LLVMIntType(size_in_bits);
58855885 entry->zero_bits = (size_in_bits == 0);
......@@ -5913,32 +5913,32 @@ ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) {
59135913
59145914uint32_t type_id_hash(TypeId x) {
59155915 switch (x.id) {
5916 case TypeTableEntryIdInvalid:
5917 case TypeTableEntryIdOpaque:
5918 case TypeTableEntryIdMetaType:
5919 case TypeTableEntryIdVoid:
5920 case TypeTableEntryIdBool:
5921 case TypeTableEntryIdUnreachable:
5922 case TypeTableEntryIdFloat:
5923 case TypeTableEntryIdStruct:
5924 case TypeTableEntryIdComptimeFloat:
5925 case TypeTableEntryIdComptimeInt:
5926 case TypeTableEntryIdUndefined:
5927 case TypeTableEntryIdNull:
5928 case TypeTableEntryIdOptional:
5929 case TypeTableEntryIdErrorSet:
5930 case TypeTableEntryIdEnum:
5931 case TypeTableEntryIdUnion:
5932 case TypeTableEntryIdFn:
5933 case TypeTableEntryIdNamespace:
5934 case TypeTableEntryIdBlock:
5935 case TypeTableEntryIdBoundFn:
5936 case TypeTableEntryIdArgTuple:
5937 case TypeTableEntryIdPromise:
5916 case ZigTypeIdInvalid:
5917 case ZigTypeIdOpaque:
5918 case ZigTypeIdMetaType:
5919 case ZigTypeIdVoid:
5920 case ZigTypeIdBool:
5921 case ZigTypeIdUnreachable:
5922 case ZigTypeIdFloat:
5923 case ZigTypeIdStruct:
5924 case ZigTypeIdComptimeFloat:
5925 case ZigTypeIdComptimeInt:
5926 case ZigTypeIdUndefined:
5927 case ZigTypeIdNull:
5928 case ZigTypeIdOptional:
5929 case ZigTypeIdErrorSet:
5930 case ZigTypeIdEnum:
5931 case ZigTypeIdUnion:
5932 case ZigTypeIdFn:
5933 case ZigTypeIdNamespace:
5934 case ZigTypeIdBlock:
5935 case ZigTypeIdBoundFn:
5936 case ZigTypeIdArgTuple:
5937 case ZigTypeIdPromise:
59385938 zig_unreachable();
5939 case TypeTableEntryIdErrorUnion:
5939 case ZigTypeIdErrorUnion:
59405940 return hash_ptr(x.data.error_union.err_set_type) ^ hash_ptr(x.data.error_union.payload_type);
5941 case TypeTableEntryIdPointer:
5941 case ZigTypeIdPointer:
59425942 return hash_ptr(x.data.pointer.child_type) +
59435943 ((x.data.pointer.ptr_len == PtrLenSingle) ? (uint32_t)1120226602 : (uint32_t)3200913342) +
59445944 (x.data.pointer.is_const ? (uint32_t)2749109194 : (uint32_t)4047371087) +
......@@ -5946,10 +5946,10 @@ uint32_t type_id_hash(TypeId x) {
59465946 (((uint32_t)x.data.pointer.alignment) ^ (uint32_t)0x777fbe0e) +
59475947 (((uint32_t)x.data.pointer.bit_offset) ^ (uint32_t)2639019452) +
59485948 (((uint32_t)x.data.pointer.unaligned_bit_count) ^ (uint32_t)529908881);
5949 case TypeTableEntryIdArray:
5949 case ZigTypeIdArray:
59505950 return hash_ptr(x.data.array.child_type) +
59515951 ((uint32_t)x.data.array.size ^ (uint32_t)2122979968);
5952 case TypeTableEntryIdInt:
5952 case ZigTypeIdInt:
59535953 return (x.data.integer.is_signed ? (uint32_t)2652528194 : (uint32_t)163929201) +
59545954 (((uint32_t)x.data.integer.bit_count) ^ (uint32_t)2998081557);
59555955 }
......@@ -5960,34 +5960,34 @@ bool type_id_eql(TypeId a, TypeId b) {
59605960 if (a.id != b.id)
59615961 return false;
59625962 switch (a.id) {
5963 case TypeTableEntryIdInvalid:
5964 case TypeTableEntryIdMetaType:
5965 case TypeTableEntryIdVoid:
5966 case TypeTableEntryIdBool:
5967 case TypeTableEntryIdUnreachable:
5968 case TypeTableEntryIdFloat:
5969 case TypeTableEntryIdStruct:
5970 case TypeTableEntryIdComptimeFloat:
5971 case TypeTableEntryIdComptimeInt:
5972 case TypeTableEntryIdUndefined:
5973 case TypeTableEntryIdNull:
5974 case TypeTableEntryIdOptional:
5975 case TypeTableEntryIdPromise:
5976 case TypeTableEntryIdErrorSet:
5977 case TypeTableEntryIdEnum:
5978 case TypeTableEntryIdUnion:
5979 case TypeTableEntryIdFn:
5980 case TypeTableEntryIdNamespace:
5981 case TypeTableEntryIdBlock:
5982 case TypeTableEntryIdBoundFn:
5983 case TypeTableEntryIdArgTuple:
5984 case TypeTableEntryIdOpaque:
5963 case ZigTypeIdInvalid:
5964 case ZigTypeIdMetaType:
5965 case ZigTypeIdVoid:
5966 case ZigTypeIdBool:
5967 case ZigTypeIdUnreachable:
5968 case ZigTypeIdFloat:
5969 case ZigTypeIdStruct:
5970 case ZigTypeIdComptimeFloat:
5971 case ZigTypeIdComptimeInt:
5972 case ZigTypeIdUndefined:
5973 case ZigTypeIdNull:
5974 case ZigTypeIdOptional:
5975 case ZigTypeIdPromise:
5976 case ZigTypeIdErrorSet:
5977 case ZigTypeIdEnum:
5978 case ZigTypeIdUnion:
5979 case ZigTypeIdFn:
5980 case ZigTypeIdNamespace:
5981 case ZigTypeIdBlock:
5982 case ZigTypeIdBoundFn:
5983 case ZigTypeIdArgTuple:
5984 case ZigTypeIdOpaque:
59855985 zig_unreachable();
5986 case TypeTableEntryIdErrorUnion:
5986 case ZigTypeIdErrorUnion:
59875987 return a.data.error_union.err_set_type == b.data.error_union.err_set_type &&
59885988 a.data.error_union.payload_type == b.data.error_union.payload_type;
59895989
5990 case TypeTableEntryIdPointer:
5990 case ZigTypeIdPointer:
59915991 return a.data.pointer.child_type == b.data.pointer.child_type &&
59925992 a.data.pointer.ptr_len == b.data.pointer.ptr_len &&
59935993 a.data.pointer.is_const == b.data.pointer.is_const &&
......@@ -5995,10 +5995,10 @@ bool type_id_eql(TypeId a, TypeId b) {
59955995 a.data.pointer.alignment == b.data.pointer.alignment &&
59965996 a.data.pointer.bit_offset == b.data.pointer.bit_offset &&
59975997 a.data.pointer.unaligned_bit_count == b.data.pointer.unaligned_bit_count;
5998 case TypeTableEntryIdArray:
5998 case ZigTypeIdArray:
59995999 return a.data.array.child_type == b.data.array.child_type &&
60006000 a.data.array.size == b.data.array.size;
6001 case TypeTableEntryIdInt:
6001 case ZigTypeIdInt:
60026002 return a.data.integer.is_signed == b.data.integer.is_signed &&
60036003 a.data.integer.bit_count == b.data.integer.bit_count;
60046004 }
......@@ -6050,7 +6050,7 @@ bool zig_llvm_fn_key_eql(ZigLLVMFnKey a, ZigLLVMFnKey b) {
60506050}
60516051
60526052void expand_undef_array(CodeGen *g, ConstExprValue *const_val) {
6053 assert(const_val->type->id == TypeTableEntryIdArray);
6053 assert(const_val->type->id == ZigTypeIdArray);
60546054 if (const_val->data.x_array.special == ConstArraySpecialUndef) {
60556055 const_val->data.x_array.special = ConstArraySpecialNone;
60566056 size_t elem_count = const_val->type->data.array.len;
......@@ -6072,43 +6072,43 @@ void expand_undef_array(CodeGen *g, ConstExprValue *const_val) {
60726072ConstParent *get_const_val_parent(CodeGen *g, ConstExprValue *value) {
60736073 assert(value->type);
60746074 ZigType *type_entry = value->type;
6075 if (type_entry->id == TypeTableEntryIdArray) {
6075 if (type_entry->id == ZigTypeIdArray) {
60766076 expand_undef_array(g, value);
60776077 return &value->data.x_array.s_none.parent;
6078 } else if (type_entry->id == TypeTableEntryIdStruct) {
6078 } else if (type_entry->id == ZigTypeIdStruct) {
60796079 return &value->data.x_struct.parent;
6080 } else if (type_entry->id == TypeTableEntryIdUnion) {
6080 } else if (type_entry->id == ZigTypeIdUnion) {
60816081 return &value->data.x_union.parent;
60826082 }
60836083 return nullptr;
60846084}
60856085
60866086static const ZigTypeId all_type_ids[] = {
6087 TypeTableEntryIdMetaType,
6088 TypeTableEntryIdVoid,
6089 TypeTableEntryIdBool,
6090 TypeTableEntryIdUnreachable,
6091 TypeTableEntryIdInt,
6092 TypeTableEntryIdFloat,
6093 TypeTableEntryIdPointer,
6094 TypeTableEntryIdArray,
6095 TypeTableEntryIdStruct,
6096 TypeTableEntryIdComptimeFloat,
6097 TypeTableEntryIdComptimeInt,
6098 TypeTableEntryIdUndefined,
6099 TypeTableEntryIdNull,
6100 TypeTableEntryIdOptional,
6101 TypeTableEntryIdErrorUnion,
6102 TypeTableEntryIdErrorSet,
6103 TypeTableEntryIdEnum,
6104 TypeTableEntryIdUnion,
6105 TypeTableEntryIdFn,
6106 TypeTableEntryIdNamespace,
6107 TypeTableEntryIdBlock,
6108 TypeTableEntryIdBoundFn,
6109 TypeTableEntryIdArgTuple,
6110 TypeTableEntryIdOpaque,
6111 TypeTableEntryIdPromise,
6087 ZigTypeIdMetaType,
6088 ZigTypeIdVoid,
6089 ZigTypeIdBool,
6090 ZigTypeIdUnreachable,
6091 ZigTypeIdInt,
6092 ZigTypeIdFloat,
6093 ZigTypeIdPointer,
6094 ZigTypeIdArray,
6095 ZigTypeIdStruct,
6096 ZigTypeIdComptimeFloat,
6097 ZigTypeIdComptimeInt,
6098 ZigTypeIdUndefined,
6099 ZigTypeIdNull,
6100 ZigTypeIdOptional,
6101 ZigTypeIdErrorUnion,
6102 ZigTypeIdErrorSet,
6103 ZigTypeIdEnum,
6104 ZigTypeIdUnion,
6105 ZigTypeIdFn,
6106 ZigTypeIdNamespace,
6107 ZigTypeIdBlock,
6108 ZigTypeIdBoundFn,
6109 ZigTypeIdArgTuple,
6110 ZigTypeIdOpaque,
6111 ZigTypeIdPromise,
61126112};
61136113
61146114ZigTypeId type_id_at_index(size_t index) {
......@@ -6122,59 +6122,59 @@ size_t type_id_len() {
61226122
61236123size_t type_id_index(ZigType *entry) {
61246124 switch (entry->id) {
6125 case TypeTableEntryIdInvalid:
6125 case ZigTypeIdInvalid:
61266126 zig_unreachable();
6127 case TypeTableEntryIdMetaType:
6127 case ZigTypeIdMetaType:
61286128 return 0;
6129 case TypeTableEntryIdVoid:
6129 case ZigTypeIdVoid:
61306130 return 1;
6131 case TypeTableEntryIdBool:
6131 case ZigTypeIdBool:
61326132 return 2;
6133 case TypeTableEntryIdUnreachable:
6133 case ZigTypeIdUnreachable:
61346134 return 3;
6135 case TypeTableEntryIdInt:
6135 case ZigTypeIdInt:
61366136 return 4;
6137 case TypeTableEntryIdFloat:
6137 case ZigTypeIdFloat:
61386138 return 5;
6139 case TypeTableEntryIdPointer:
6139 case ZigTypeIdPointer:
61406140 return 6;
6141 case TypeTableEntryIdArray:
6141 case ZigTypeIdArray:
61426142 return 7;
6143 case TypeTableEntryIdStruct:
6143 case ZigTypeIdStruct:
61446144 if (entry->data.structure.is_slice)
61456145 return 6;
61466146 return 8;
6147 case TypeTableEntryIdComptimeFloat:
6147 case ZigTypeIdComptimeFloat:
61486148 return 9;
6149 case TypeTableEntryIdComptimeInt:
6149 case ZigTypeIdComptimeInt:
61506150 return 10;
6151 case TypeTableEntryIdUndefined:
6151 case ZigTypeIdUndefined:
61526152 return 11;
6153 case TypeTableEntryIdNull:
6153 case ZigTypeIdNull:
61546154 return 12;
6155 case TypeTableEntryIdOptional:
6155 case ZigTypeIdOptional:
61566156 return 13;
6157 case TypeTableEntryIdErrorUnion:
6157 case ZigTypeIdErrorUnion:
61586158 return 14;
6159 case TypeTableEntryIdErrorSet:
6159 case ZigTypeIdErrorSet:
61606160 return 15;
6161 case TypeTableEntryIdEnum:
6161 case ZigTypeIdEnum:
61626162 return 16;
6163 case TypeTableEntryIdUnion:
6163 case ZigTypeIdUnion:
61646164 return 17;
6165 case TypeTableEntryIdFn:
6165 case ZigTypeIdFn:
61666166 return 18;
6167 case TypeTableEntryIdNamespace:
6167 case ZigTypeIdNamespace:
61686168 return 19;
6169 case TypeTableEntryIdBlock:
6169 case ZigTypeIdBlock:
61706170 return 20;
6171 case TypeTableEntryIdBoundFn:
6171 case ZigTypeIdBoundFn:
61726172 return 21;
6173 case TypeTableEntryIdArgTuple:
6173 case ZigTypeIdArgTuple:
61746174 return 22;
6175 case TypeTableEntryIdOpaque:
6175 case ZigTypeIdOpaque:
61766176 return 23;
6177 case TypeTableEntryIdPromise:
6177 case ZigTypeIdPromise:
61786178 return 24;
61796179 }
61806180 zig_unreachable();
......@@ -6182,57 +6182,57 @@ size_t type_id_index(ZigType *entry) {
61826182
61836183const char *type_id_name(ZigTypeId id) {
61846184 switch (id) {
6185 case TypeTableEntryIdInvalid:
6185 case ZigTypeIdInvalid:
61866186 zig_unreachable();
6187 case TypeTableEntryIdMetaType:
6187 case ZigTypeIdMetaType:
61886188 return "Type";
6189 case TypeTableEntryIdVoid:
6189 case ZigTypeIdVoid:
61906190 return "Void";
6191 case TypeTableEntryIdBool:
6191 case ZigTypeIdBool:
61926192 return "Bool";
6193 case TypeTableEntryIdUnreachable:
6193 case ZigTypeIdUnreachable:
61946194 return "NoReturn";
6195 case TypeTableEntryIdInt:
6195 case ZigTypeIdInt:
61966196 return "Int";
6197 case TypeTableEntryIdFloat:
6197 case ZigTypeIdFloat:
61986198 return "Float";
6199 case TypeTableEntryIdPointer:
6199 case ZigTypeIdPointer:
62006200 return "Pointer";
6201 case TypeTableEntryIdArray:
6201 case ZigTypeIdArray:
62026202 return "Array";
6203 case TypeTableEntryIdStruct:
6203 case ZigTypeIdStruct:
62046204 return "Struct";
6205 case TypeTableEntryIdComptimeFloat:
6205 case ZigTypeIdComptimeFloat:
62066206 return "ComptimeFloat";
6207 case TypeTableEntryIdComptimeInt:
6207 case ZigTypeIdComptimeInt:
62086208 return "ComptimeInt";
6209 case TypeTableEntryIdUndefined:
6209 case ZigTypeIdUndefined:
62106210 return "Undefined";
6211 case TypeTableEntryIdNull:
6211 case ZigTypeIdNull:
62126212 return "Null";
6213 case TypeTableEntryIdOptional:
6213 case ZigTypeIdOptional:
62146214 return "Optional";
6215 case TypeTableEntryIdErrorUnion:
6215 case ZigTypeIdErrorUnion:
62166216 return "ErrorUnion";
6217 case TypeTableEntryIdErrorSet:
6217 case ZigTypeIdErrorSet:
62186218 return "ErrorSet";
6219 case TypeTableEntryIdEnum:
6219 case ZigTypeIdEnum:
62206220 return "Enum";
6221 case TypeTableEntryIdUnion:
6221 case ZigTypeIdUnion:
62226222 return "Union";
6223 case TypeTableEntryIdFn:
6223 case ZigTypeIdFn:
62246224 return "Fn";
6225 case TypeTableEntryIdNamespace:
6225 case ZigTypeIdNamespace:
62266226 return "Namespace";
6227 case TypeTableEntryIdBlock:
6227 case ZigTypeIdBlock:
62286228 return "Block";
6229 case TypeTableEntryIdBoundFn:
6229 case ZigTypeIdBoundFn:
62306230 return "BoundFn";
6231 case TypeTableEntryIdArgTuple:
6231 case ZigTypeIdArgTuple:
62326232 return "ArgTuple";
6233 case TypeTableEntryIdOpaque:
6233 case ZigTypeIdOpaque:
62346234 return "Opaque";
6235 case TypeTableEntryIdPromise:
6235 case ZigTypeIdPromise:
62366236 return "Promise";
62376237 }
62386238 zig_unreachable();
......@@ -6272,18 +6272,18 @@ uint32_t get_abi_alignment(CodeGen *g, ZigType *type_entry) {
62726272
62736273 // We need to make this function work without requiring ensure_complete_type
62746274 // so that we can have structs with fields that are pointers to their own type.
6275 if (type_entry->id == TypeTableEntryIdStruct) {
6275 if (type_entry->id == ZigTypeIdStruct) {
62766276 assert(type_entry->data.structure.abi_alignment != 0);
62776277 return type_entry->data.structure.abi_alignment;
6278 } else if (type_entry->id == TypeTableEntryIdUnion) {
6278 } else if (type_entry->id == ZigTypeIdUnion) {
62796279 assert(type_entry->data.unionation.abi_alignment != 0);
62806280 return type_entry->data.unionation.abi_alignment;
6281 } else if (type_entry->id == TypeTableEntryIdOpaque) {
6281 } else if (type_entry->id == ZigTypeIdOpaque) {
62826282 return 1;
62836283 } else {
62846284 uint32_t llvm_alignment = LLVMABIAlignmentOfType(g->target_data_ref, type_entry->type_ref);
62856285 // promises have at least alignment 8 so that we can have 3 extra bits when doing atomicrmw
6286 if (type_entry->id == TypeTableEntryIdPromise && llvm_alignment < 8) {
6286 if (type_entry->id == ZigTypeIdPromise && llvm_alignment < 8) {
62876287 return 8;
62886288 }
62896289 return llvm_alignment;
......@@ -6317,7 +6317,7 @@ ConstExprValue *get_builtin_value(CodeGen *codegen, const char *name) {
63176317}
63186318
63196319bool type_is_global_error_set(ZigType *err_set_type) {
6320 assert(err_set_type->id == TypeTableEntryIdErrorSet);
6320 assert(err_set_type->id == ZigTypeIdErrorSet);
63216321 assert(err_set_type->data.error_set.infer_fn == nullptr);
63226322 return err_set_type->data.error_set.err_count == UINT32_MAX;
63236323}
......@@ -6327,7 +6327,7 @@ uint32_t get_coro_frame_align_bytes(CodeGen *g) {
63276327}
63286328
63296329bool type_can_fail(ZigType *type_entry) {
6330 return type_entry->id == TypeTableEntryIdErrorUnion || type_entry->id == TypeTableEntryIdErrorSet;
6330 return type_entry->id == ZigTypeIdErrorUnion || type_entry->id == ZigTypeIdErrorSet;
63316331}
63326332
63336333bool fn_type_can_fail(FnTypeId *fn_type_id) {
src/codegen.cpp+277-277
......@@ -533,7 +533,7 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, ZigFn *fn_table_entry) {
533533 }
534534
535535 ZigType *return_type = fn_type->data.fn.fn_type_id.return_type;
536 if (return_type->id == TypeTableEntryIdUnreachable) {
536 if (return_type->id == ZigTypeIdUnreachable) {
537537 addLLVMFnAttr(fn_table_entry->llvm_value, "noreturn");
538538 }
539539
......@@ -600,10 +600,10 @@ static LLVMValueRef fn_llvm_value(CodeGen *g, ZigFn *fn_table_entry) {
600600 if (param_info->is_noalias) {
601601 addLLVMArgAttr(fn_table_entry->llvm_value, (unsigned)gen_index, "noalias");
602602 }
603 if ((param_type->id == TypeTableEntryIdPointer && param_type->data.pointer.is_const) || is_byval) {
603 if ((param_type->id == ZigTypeIdPointer && param_type->data.pointer.is_const) || is_byval) {
604604 addLLVMArgAttr(fn_table_entry->llvm_value, (unsigned)gen_index, "readonly");
605605 }
606 if (param_type->id == TypeTableEntryIdPointer) {
606 if (param_type->id == ZigTypeIdPointer) {
607607 addLLVMArgAttr(fn_table_entry->llvm_value, (unsigned)gen_index, "nonnull");
608608 }
609609 }
......@@ -693,7 +693,7 @@ static LLVMValueRef get_arithmetic_overflow_fn(CodeGen *g, ZigType *type_entry,
693693{
694694 char fn_name[64];
695695
696 assert(type_entry->id == TypeTableEntryIdInt);
696 assert(type_entry->id == ZigTypeIdInt);
697697 const char *signed_str = type_entry->data.integral.is_signed ? signed_name : unsigned_name;
698698 sprintf(fn_name, "llvm.%s.with.overflow.i%" PRIu32, signed_str, type_entry->data.integral.bit_count);
699699
......@@ -713,7 +713,7 @@ static LLVMValueRef get_arithmetic_overflow_fn(CodeGen *g, ZigType *type_entry,
713713}
714714
715715static LLVMValueRef get_int_overflow_fn(CodeGen *g, ZigType *type_entry, AddSubMul add_sub_mul) {
716 assert(type_entry->id == TypeTableEntryIdInt);
716 assert(type_entry->id == ZigTypeIdInt);
717717
718718 ZigLLVMFnKey key = {};
719719 key.id = ZigLLVMFnIdOverflowArithmetic;
......@@ -743,7 +743,7 @@ static LLVMValueRef get_int_overflow_fn(CodeGen *g, ZigType *type_entry, AddSubM
743743}
744744
745745static LLVMValueRef get_float_fn(CodeGen *g, ZigType *type_entry, ZigLLVMFnId fn_id) {
746 assert(type_entry->id == TypeTableEntryIdFloat);
746 assert(type_entry->id == ZigTypeIdFloat);
747747
748748 ZigLLVMFnKey key = {};
749749 key.id = fn_id;
......@@ -788,7 +788,7 @@ static LLVMValueRef gen_store_untyped(CodeGen *g, LLVMValueRef value, LLVMValueR
788788}
789789
790790static LLVMValueRef gen_store(CodeGen *g, LLVMValueRef value, LLVMValueRef ptr, ZigType *ptr_type) {
791 assert(ptr_type->id == TypeTableEntryIdPointer);
791 assert(ptr_type->id == ZigTypeIdPointer);
792792 return gen_store_untyped(g, value, ptr, ptr_type->data.pointer.alignment, ptr_type->data.pointer.is_volatile);
793793}
794794
......@@ -806,7 +806,7 @@ static LLVMValueRef gen_load_untyped(CodeGen *g, LLVMValueRef ptr, uint32_t alig
806806}
807807
808808static LLVMValueRef gen_load(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type, const char *name) {
809 assert(ptr_type->id == TypeTableEntryIdPointer);
809 assert(ptr_type->id == ZigTypeIdPointer);
810810 return gen_load_untyped(g, ptr, ptr_type->data.pointer.alignment, ptr_type->data.pointer.is_volatile, name);
811811}
812812
......@@ -815,7 +815,7 @@ static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, ZigType *type
815815 if (handle_is_ptr(type)) {
816816 return ptr;
817817 } else {
818 assert(ptr_type->id == TypeTableEntryIdPointer);
818 assert(ptr_type->id == ZigTypeIdPointer);
819819 return gen_load(g, ptr, ptr_type, "");
820820 }
821821 } else {
......@@ -1656,17 +1656,17 @@ static LLVMValueRef gen_widen_or_shorten(CodeGen *g, bool want_runtime_safety, Z
16561656
16571657 uint64_t actual_bits;
16581658 uint64_t wanted_bits;
1659 if (actual_type->id == TypeTableEntryIdFloat) {
1659 if (actual_type->id == ZigTypeIdFloat) {
16601660 actual_bits = actual_type->data.floating.bit_count;
16611661 wanted_bits = wanted_type->data.floating.bit_count;
1662 } else if (actual_type->id == TypeTableEntryIdInt) {
1662 } else if (actual_type->id == ZigTypeIdInt) {
16631663 actual_bits = actual_type->data.integral.bit_count;
16641664 wanted_bits = wanted_type->data.integral.bit_count;
16651665 } else {
16661666 zig_unreachable();
16671667 }
16681668
1669 if (actual_bits >= wanted_bits && actual_type->id == TypeTableEntryIdInt &&
1669 if (actual_bits >= wanted_bits && actual_type->id == ZigTypeIdInt &&
16701670 !wanted_type->data.integral.is_signed && actual_type->data.integral.is_signed &&
16711671 want_runtime_safety)
16721672 {
......@@ -1686,9 +1686,9 @@ static LLVMValueRef gen_widen_or_shorten(CodeGen *g, bool want_runtime_safety, Z
16861686 if (actual_bits == wanted_bits) {
16871687 return expr_val;
16881688 } else if (actual_bits < wanted_bits) {
1689 if (actual_type->id == TypeTableEntryIdFloat) {
1689 if (actual_type->id == ZigTypeIdFloat) {
16901690 return LLVMBuildFPExt(g->builder, expr_val, wanted_type->type_ref, "");
1691 } else if (actual_type->id == TypeTableEntryIdInt) {
1691 } else if (actual_type->id == ZigTypeIdInt) {
16921692 if (actual_type->data.integral.is_signed) {
16931693 return LLVMBuildSExt(g->builder, expr_val, wanted_type->type_ref, "");
16941694 } else {
......@@ -1698,9 +1698,9 @@ static LLVMValueRef gen_widen_or_shorten(CodeGen *g, bool want_runtime_safety, Z
16981698 zig_unreachable();
16991699 }
17001700 } else if (actual_bits > wanted_bits) {
1701 if (actual_type->id == TypeTableEntryIdFloat) {
1701 if (actual_type->id == ZigTypeIdFloat) {
17021702 return LLVMBuildFPTrunc(g->builder, expr_val, wanted_type->type_ref, "");
1703 } else if (actual_type->id == TypeTableEntryIdInt) {
1703 } else if (actual_type->id == ZigTypeIdInt) {
17041704 LLVMValueRef trunc_val = LLVMBuildTrunc(g->builder, expr_val, wanted_type->type_ref, "");
17051705 if (!want_runtime_safety) {
17061706 return trunc_val;
......@@ -1792,7 +1792,7 @@ static LLVMRealPredicate cmp_op_to_real_predicate(IrBinOp cmp_op) {
17921792static LLVMValueRef gen_assign_raw(CodeGen *g, LLVMValueRef ptr, ZigType *ptr_type,
17931793 LLVMValueRef value)
17941794{
1795 assert(ptr_type->id == TypeTableEntryIdPointer);
1795 assert(ptr_type->id == ZigTypeIdPointer);
17961796 ZigType *child_type = ptr_type->data.pointer.child_type;
17971797
17981798 if (!type_has_bits(child_type))
......@@ -1878,7 +1878,7 @@ static LLVMValueRef ir_llvm_value(CodeGen *g, IrInstruction *instruction) {
18781878 render_const_val_global(g, &instruction->value, "");
18791879 ZigType *ptr_type = get_pointer_to_type(g, instruction->value.type, true);
18801880 instruction->llvm_value = LLVMBuildBitCast(g->builder, instruction->value.global_refs->llvm_global, ptr_type->type_ref, "");
1881 } else if (instruction->value.type->id == TypeTableEntryIdPointer) {
1881 } else if (instruction->value.type->id == ZigTypeIdPointer) {
18821882 instruction->llvm_value = LLVMBuildBitCast(g->builder, instruction->value.global_refs->llvm_value, instruction->value.type->type_ref, "");
18831883 } else {
18841884 instruction->llvm_value = instruction->value.global_refs->llvm_value;
......@@ -1929,7 +1929,7 @@ static LLVMValueRef gen_overflow_shl_op(CodeGen *g, ZigType *type_entry,
19291929 // if the values don't match, we have an overflow
19301930 // for signed left shifting we do the same except arithmetic shift right
19311931
1932 assert(type_entry->id == TypeTableEntryIdInt);
1932 assert(type_entry->id == ZigTypeIdInt);
19331933
19341934 LLVMValueRef result = LLVMBuildShl(g->builder, val1, val2, "");
19351935 LLVMValueRef orig_val;
......@@ -1954,7 +1954,7 @@ static LLVMValueRef gen_overflow_shl_op(CodeGen *g, ZigType *type_entry,
19541954static LLVMValueRef gen_overflow_shr_op(CodeGen *g, ZigType *type_entry,
19551955 LLVMValueRef val1, LLVMValueRef val2)
19561956{
1957 assert(type_entry->id == TypeTableEntryIdInt);
1957 assert(type_entry->id == ZigTypeIdInt);
19581958
19591959 LLVMValueRef result;
19601960 if (type_entry->data.integral.is_signed) {
......@@ -1977,7 +1977,7 @@ static LLVMValueRef gen_overflow_shr_op(CodeGen *g, ZigType *type_entry,
19771977}
19781978
19791979static LLVMValueRef gen_floor(CodeGen *g, LLVMValueRef val, ZigType *type_entry) {
1980 if (type_entry->id == TypeTableEntryIdInt)
1980 if (type_entry->id == ZigTypeIdInt)
19811981 return val;
19821982
19831983 LLVMValueRef floor_fn = get_float_fn(g, type_entry, ZigLLVMFnIdFloor);
......@@ -1985,7 +1985,7 @@ static LLVMValueRef gen_floor(CodeGen *g, LLVMValueRef val, ZigType *type_entry)
19851985}
19861986
19871987static LLVMValueRef gen_ceil(CodeGen *g, LLVMValueRef val, ZigType *type_entry) {
1988 if (type_entry->id == TypeTableEntryIdInt)
1988 if (type_entry->id == ZigTypeIdInt)
19891989 return val;
19901990
19911991 LLVMValueRef ceil_fn = get_float_fn(g, type_entry, ZigLLVMFnIdCeil);
......@@ -2023,11 +2023,11 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_runtime_safety, bool want_fast
20232023 ZigLLVMSetFastMath(g->builder, want_fast_math);
20242024
20252025 LLVMValueRef zero = LLVMConstNull(type_entry->type_ref);
2026 if (want_runtime_safety && (want_fast_math || type_entry->id != TypeTableEntryIdFloat)) {
2026 if (want_runtime_safety && (want_fast_math || type_entry->id != ZigTypeIdFloat)) {
20272027 LLVMValueRef is_zero_bit;
2028 if (type_entry->id == TypeTableEntryIdInt) {
2028 if (type_entry->id == ZigTypeIdInt) {
20292029 is_zero_bit = LLVMBuildICmp(g->builder, LLVMIntEQ, val2, zero, "");
2030 } else if (type_entry->id == TypeTableEntryIdFloat) {
2030 } else if (type_entry->id == ZigTypeIdFloat) {
20312031 is_zero_bit = LLVMBuildFCmp(g->builder, LLVMRealOEQ, val2, zero, "");
20322032 } else {
20332033 zig_unreachable();
......@@ -2041,7 +2041,7 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_runtime_safety, bool want_fast
20412041
20422042 LLVMPositionBuilderAtEnd(g->builder, div_zero_ok_block);
20432043
2044 if (type_entry->id == TypeTableEntryIdInt && type_entry->data.integral.is_signed) {
2044 if (type_entry->id == ZigTypeIdInt && type_entry->data.integral.is_signed) {
20452045 LLVMValueRef neg_1_value = LLVMConstInt(type_entry->type_ref, -1, true);
20462046 BigInt int_min_bi = {0};
20472047 eval_min_max_value_int(g, type_entry, &int_min_bi, false);
......@@ -2060,7 +2060,7 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_runtime_safety, bool want_fast
20602060 }
20612061 }
20622062
2063 if (type_entry->id == TypeTableEntryIdFloat) {
2063 if (type_entry->id == ZigTypeIdFloat) {
20642064 LLVMValueRef result = LLVMBuildFDiv(g->builder, val1, val2, "");
20652065 switch (div_kind) {
20662066 case DivKindFloat:
......@@ -2111,7 +2111,7 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_runtime_safety, bool want_fast
21112111 zig_unreachable();
21122112 }
21132113
2114 assert(type_entry->id == TypeTableEntryIdInt);
2114 assert(type_entry->id == ZigTypeIdInt);
21152115
21162116 switch (div_kind) {
21172117 case DivKindFloat:
......@@ -2184,10 +2184,10 @@ static LLVMValueRef gen_rem(CodeGen *g, bool want_runtime_safety, bool want_fast
21842184 LLVMValueRef zero = LLVMConstNull(type_entry->type_ref);
21852185 if (want_runtime_safety) {
21862186 LLVMValueRef is_zero_bit;
2187 if (type_entry->id == TypeTableEntryIdInt) {
2187 if (type_entry->id == ZigTypeIdInt) {
21882188 LLVMIntPredicate pred = type_entry->data.integral.is_signed ? LLVMIntSLE : LLVMIntEQ;
21892189 is_zero_bit = LLVMBuildICmp(g->builder, pred, val2, zero, "");
2190 } else if (type_entry->id == TypeTableEntryIdFloat) {
2190 } else if (type_entry->id == ZigTypeIdFloat) {
21912191 is_zero_bit = LLVMBuildFCmp(g->builder, LLVMRealOEQ, val2, zero, "");
21922192 } else {
21932193 zig_unreachable();
......@@ -2202,7 +2202,7 @@ static LLVMValueRef gen_rem(CodeGen *g, bool want_runtime_safety, bool want_fast
22022202 LLVMPositionBuilderAtEnd(g->builder, rem_zero_ok_block);
22032203 }
22042204
2205 if (type_entry->id == TypeTableEntryIdFloat) {
2205 if (type_entry->id == ZigTypeIdFloat) {
22062206 if (rem_kind == RemKindRem) {
22072207 return LLVMBuildFRem(g->builder, val1, val2, "");
22082208 } else {
......@@ -2213,7 +2213,7 @@ static LLVMValueRef gen_rem(CodeGen *g, bool want_runtime_safety, bool want_fast
22132213 return LLVMBuildSelect(g->builder, ltz, c, a, "");
22142214 }
22152215 } else {
2216 assert(type_entry->id == TypeTableEntryIdInt);
2216 assert(type_entry->id == ZigTypeIdInt);
22172217 if (type_entry->data.integral.is_signed) {
22182218 if (rem_kind == RemKindRem) {
22192219 return LLVMBuildSRem(g->builder, val1, val2, "");
......@@ -2241,8 +2241,8 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
22412241 assert(op1->value.type == op2->value.type || op_id == IrBinOpBitShiftLeftLossy ||
22422242 op_id == IrBinOpBitShiftLeftExact || op_id == IrBinOpBitShiftRightLossy ||
22432243 op_id == IrBinOpBitShiftRightExact ||
2244 (op1->value.type->id == TypeTableEntryIdErrorSet && op2->value.type->id == TypeTableEntryIdErrorSet) ||
2245 (op1->value.type->id == TypeTableEntryIdPointer &&
2244 (op1->value.type->id == ZigTypeIdErrorSet && op2->value.type->id == ZigTypeIdErrorSet) ||
2245 (op1->value.type->id == ZigTypeIdPointer &&
22462246 (op_id == IrBinOpAdd || op_id == IrBinOpSub) &&
22472247 op1->value.type->data.pointer.ptr_len == PtrLenUnknown)
22482248 );
......@@ -2272,16 +2272,16 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
22722272 case IrBinOpCmpGreaterThan:
22732273 case IrBinOpCmpLessOrEq:
22742274 case IrBinOpCmpGreaterOrEq:
2275 if (type_entry->id == TypeTableEntryIdFloat) {
2275 if (type_entry->id == ZigTypeIdFloat) {
22762276 ZigLLVMSetFastMath(g->builder, ir_want_fast_math(g, &bin_op_instruction->base));
22772277 LLVMRealPredicate pred = cmp_op_to_real_predicate(op_id);
22782278 return LLVMBuildFCmp(g->builder, pred, op1_value, op2_value, "");
2279 } else if (type_entry->id == TypeTableEntryIdInt) {
2279 } else if (type_entry->id == ZigTypeIdInt) {
22802280 LLVMIntPredicate pred = cmp_op_to_int_predicate(op_id, type_entry->data.integral.is_signed);
22812281 return LLVMBuildICmp(g->builder, pred, op1_value, op2_value, "");
2282 } else if (type_entry->id == TypeTableEntryIdEnum ||
2283 type_entry->id == TypeTableEntryIdErrorSet ||
2284 type_entry->id == TypeTableEntryIdBool ||
2282 } else if (type_entry->id == ZigTypeIdEnum ||
2283 type_entry->id == ZigTypeIdErrorSet ||
2284 type_entry->id == ZigTypeIdBool ||
22852285 get_codegen_ptr_type(type_entry) != nullptr)
22862286 {
22872287 LLVMIntPredicate pred = cmp_op_to_int_predicate(op_id, false);
......@@ -2291,14 +2291,14 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
22912291 }
22922292 case IrBinOpAdd:
22932293 case IrBinOpAddWrap:
2294 if (type_entry->id == TypeTableEntryIdPointer) {
2294 if (type_entry->id == ZigTypeIdPointer) {
22952295 assert(type_entry->data.pointer.ptr_len == PtrLenUnknown);
22962296 // TODO runtime safety
22972297 return LLVMBuildInBoundsGEP(g->builder, op1_value, &op2_value, 1, "");
2298 } else if (type_entry->id == TypeTableEntryIdFloat) {
2298 } else if (type_entry->id == ZigTypeIdFloat) {
22992299 ZigLLVMSetFastMath(g->builder, ir_want_fast_math(g, &bin_op_instruction->base));
23002300 return LLVMBuildFAdd(g->builder, op1_value, op2_value, "");
2301 } else if (type_entry->id == TypeTableEntryIdInt) {
2301 } else if (type_entry->id == ZigTypeIdInt) {
23022302 bool is_wrapping = (op_id == IrBinOpAddWrap);
23032303 if (is_wrapping) {
23042304 return LLVMBuildAdd(g->builder, op1_value, op2_value, "");
......@@ -2321,7 +2321,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
23212321 case IrBinOpBitShiftLeftLossy:
23222322 case IrBinOpBitShiftLeftExact:
23232323 {
2324 assert(type_entry->id == TypeTableEntryIdInt);
2324 assert(type_entry->id == ZigTypeIdInt);
23252325 LLVMValueRef op2_casted = gen_widen_or_shorten(g, false, op2->value.type,
23262326 type_entry, op2_value);
23272327 bool is_sloppy = (op_id == IrBinOpBitShiftLeftLossy);
......@@ -2338,7 +2338,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
23382338 case IrBinOpBitShiftRightLossy:
23392339 case IrBinOpBitShiftRightExact:
23402340 {
2341 assert(type_entry->id == TypeTableEntryIdInt);
2341 assert(type_entry->id == ZigTypeIdInt);
23422342 LLVMValueRef op2_casted = gen_widen_or_shorten(g, false, op2->value.type,
23432343 type_entry, op2_value);
23442344 bool is_sloppy = (op_id == IrBinOpBitShiftRightLossy);
......@@ -2358,15 +2358,15 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
23582358 }
23592359 case IrBinOpSub:
23602360 case IrBinOpSubWrap:
2361 if (type_entry->id == TypeTableEntryIdPointer) {
2361 if (type_entry->id == ZigTypeIdPointer) {
23622362 assert(type_entry->data.pointer.ptr_len == PtrLenUnknown);
23632363 // TODO runtime safety
23642364 LLVMValueRef subscript_value = LLVMBuildNeg(g->builder, op2_value, "");
23652365 return LLVMBuildInBoundsGEP(g->builder, op1_value, &subscript_value, 1, "");
2366 } else if (type_entry->id == TypeTableEntryIdFloat) {
2366 } else if (type_entry->id == ZigTypeIdFloat) {
23672367 ZigLLVMSetFastMath(g->builder, ir_want_fast_math(g, &bin_op_instruction->base));
23682368 return LLVMBuildFSub(g->builder, op1_value, op2_value, "");
2369 } else if (type_entry->id == TypeTableEntryIdInt) {
2369 } else if (type_entry->id == ZigTypeIdInt) {
23702370 bool is_wrapping = (op_id == IrBinOpSubWrap);
23712371 if (is_wrapping) {
23722372 return LLVMBuildSub(g->builder, op1_value, op2_value, "");
......@@ -2382,10 +2382,10 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
23822382 }
23832383 case IrBinOpMult:
23842384 case IrBinOpMultWrap:
2385 if (type_entry->id == TypeTableEntryIdFloat) {
2385 if (type_entry->id == ZigTypeIdFloat) {
23862386 ZigLLVMSetFastMath(g->builder, ir_want_fast_math(g, &bin_op_instruction->base));
23872387 return LLVMBuildFMul(g->builder, op1_value, op2_value, "");
2388 } else if (type_entry->id == TypeTableEntryIdInt) {
2388 } else if (type_entry->id == ZigTypeIdInt) {
23892389 bool is_wrapping = (op_id == IrBinOpMultWrap);
23902390 if (is_wrapping) {
23912391 return LLVMBuildMul(g->builder, op1_value, op2_value, "");
......@@ -2422,7 +2422,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, IrExecutable *executable,
24222422}
24232423
24242424static void add_error_range_check(CodeGen *g, ZigType *err_set_type, ZigType *int_type, LLVMValueRef target_val) {
2425 assert(err_set_type->id == TypeTableEntryIdErrorSet);
2425 assert(err_set_type->id == ZigTypeIdErrorSet);
24262426
24272427 if (type_is_global_error_set(err_set_type)) {
24282428 LLVMValueRef zero = LLVMConstNull(int_type->type_ref);
......@@ -2486,9 +2486,9 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
24862486 case CastOpResizeSlice:
24872487 {
24882488 assert(cast_instruction->tmp_ptr);
2489 assert(wanted_type->id == TypeTableEntryIdStruct);
2489 assert(wanted_type->id == ZigTypeIdStruct);
24902490 assert(wanted_type->data.structure.is_slice);
2491 assert(actual_type->id == TypeTableEntryIdStruct);
2491 assert(actual_type->id == ZigTypeIdStruct);
24922492 assert(actual_type->data.structure.is_slice);
24932493
24942494 ZigType *actual_pointer_type = actual_type->data.structure.fields[0].type_entry;
......@@ -2549,9 +2549,9 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
25492549 case CastOpBytesToSlice:
25502550 {
25512551 assert(cast_instruction->tmp_ptr);
2552 assert(wanted_type->id == TypeTableEntryIdStruct);
2552 assert(wanted_type->id == ZigTypeIdStruct);
25532553 assert(wanted_type->data.structure.is_slice);
2554 assert(actual_type->id == TypeTableEntryIdArray);
2554 assert(actual_type->id == ZigTypeIdArray);
25552555
25562556 ZigType *wanted_pointer_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
25572557 ZigType *wanted_child_type = wanted_pointer_type->data.pointer.child_type;
......@@ -2573,14 +2573,14 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
25732573 return cast_instruction->tmp_ptr;
25742574 }
25752575 case CastOpIntToFloat:
2576 assert(actual_type->id == TypeTableEntryIdInt);
2576 assert(actual_type->id == ZigTypeIdInt);
25772577 if (actual_type->data.integral.is_signed) {
25782578 return LLVMBuildSIToFP(g->builder, expr_val, wanted_type->type_ref, "");
25792579 } else {
25802580 return LLVMBuildUIToFP(g->builder, expr_val, wanted_type->type_ref, "");
25812581 }
25822582 case CastOpFloatToInt: {
2583 assert(wanted_type->id == TypeTableEntryIdInt);
2583 assert(wanted_type->id == ZigTypeIdInt);
25842584 ZigLLVMSetFastMath(g->builder, ir_want_fast_math(g, &cast_instruction->base));
25852585
25862586 bool want_safety = ir_want_runtime_safety(g, &cast_instruction->base);
......@@ -2615,8 +2615,8 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
26152615 return result;
26162616 }
26172617 case CastOpBoolToInt:
2618 assert(wanted_type->id == TypeTableEntryIdInt);
2619 assert(actual_type->id == TypeTableEntryIdBool);
2618 assert(wanted_type->id == ZigTypeIdInt);
2619 assert(actual_type->id == ZigTypeIdBool);
26202620 return LLVMBuildZExt(g->builder, expr_val, wanted_type->type_ref, "");
26212621 case CastOpErrSet:
26222622 if (ir_want_runtime_safety(g, &cast_instruction->base)) {
......@@ -2627,9 +2627,9 @@ static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutable *executable,
26272627 return LLVMBuildBitCast(g->builder, expr_val, wanted_type->type_ref, "");
26282628 case CastOpPtrOfArrayToSlice: {
26292629 assert(cast_instruction->tmp_ptr);
2630 assert(actual_type->id == TypeTableEntryIdPointer);
2630 assert(actual_type->id == ZigTypeIdPointer);
26312631 ZigType *array_type = actual_type->data.pointer.child_type;
2632 assert(array_type->id == TypeTableEntryIdArray);
2632 assert(array_type->id == ZigTypeIdArray);
26332633
26342634 LLVMValueRef ptr_field_ptr = LLVMBuildStructGEP(g->builder, cast_instruction->tmp_ptr,
26352635 slice_ptr_index, "");
......@@ -2678,7 +2678,7 @@ static LLVMValueRef ir_render_widen_or_shorten(CodeGen *g, IrExecutable *executa
26782678 // TODO instead of this logic, use the Noop instruction to change the type from
26792679 // enum_tag to the underlying int type
26802680 ZigType *int_type;
2681 if (actual_type->id == TypeTableEntryIdEnum) {
2681 if (actual_type->id == ZigTypeIdEnum) {
26822682 int_type = actual_type->data.enumeration.tag_int_type;
26832683 } else {
26842684 int_type = actual_type;
......@@ -2702,7 +2702,7 @@ static LLVMValueRef ir_render_ptr_to_int(CodeGen *g, IrExecutable *executable, I
27022702
27032703static LLVMValueRef ir_render_int_to_enum(CodeGen *g, IrExecutable *executable, IrInstructionIntToEnum *instruction) {
27042704 ZigType *wanted_type = instruction->base.value.type;
2705 assert(wanted_type->id == TypeTableEntryIdEnum);
2705 assert(wanted_type->id == ZigTypeIdEnum);
27062706 ZigType *tag_int_type = wanted_type->data.enumeration.tag_int_type;
27072707
27082708 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
......@@ -2729,10 +2729,10 @@ static LLVMValueRef ir_render_int_to_enum(CodeGen *g, IrExecutable *executable,
27292729
27302730static LLVMValueRef ir_render_int_to_err(CodeGen *g, IrExecutable *executable, IrInstructionIntToErr *instruction) {
27312731 ZigType *wanted_type = instruction->base.value.type;
2732 assert(wanted_type->id == TypeTableEntryIdErrorSet);
2732 assert(wanted_type->id == ZigTypeIdErrorSet);
27332733
27342734 ZigType *actual_type = instruction->target->value.type;
2735 assert(actual_type->id == TypeTableEntryIdInt);
2735 assert(actual_type->id == ZigTypeIdInt);
27362736 assert(!actual_type->data.integral.is_signed);
27372737
27382738 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
......@@ -2746,16 +2746,16 @@ static LLVMValueRef ir_render_int_to_err(CodeGen *g, IrExecutable *executable, I
27462746
27472747static LLVMValueRef ir_render_err_to_int(CodeGen *g, IrExecutable *executable, IrInstructionErrToInt *instruction) {
27482748 ZigType *wanted_type = instruction->base.value.type;
2749 assert(wanted_type->id == TypeTableEntryIdInt);
2749 assert(wanted_type->id == ZigTypeIdInt);
27502750 assert(!wanted_type->data.integral.is_signed);
27512751
27522752 ZigType *actual_type = instruction->target->value.type;
27532753 LLVMValueRef target_val = ir_llvm_value(g, instruction->target);
27542754
2755 if (actual_type->id == TypeTableEntryIdErrorSet) {
2755 if (actual_type->id == ZigTypeIdErrorSet) {
27562756 return gen_widen_or_shorten(g, ir_want_runtime_safety(g, &instruction->base),
27572757 g->err_tag_type, wanted_type, target_val);
2758 } else if (actual_type->id == TypeTableEntryIdErrorUnion) {
2758 } else if (actual_type->id == ZigTypeIdErrorUnion) {
27592759 // this should have been a compile time constant
27602760 assert(type_has_bits(actual_type->data.error_union.err_set_type));
27612761
......@@ -2809,10 +2809,10 @@ static LLVMValueRef ir_render_un_op(CodeGen *g, IrExecutable *executable, IrInst
28092809 case IrUnOpNegation:
28102810 case IrUnOpNegationWrap:
28112811 {
2812 if (expr_type->id == TypeTableEntryIdFloat) {
2812 if (expr_type->id == ZigTypeIdFloat) {
28132813 ZigLLVMSetFastMath(g->builder, ir_want_fast_math(g, &un_op_instruction->base));
28142814 return LLVMBuildFNeg(g->builder, expr, "");
2815 } else if (expr_type->id == TypeTableEntryIdInt) {
2815 } else if (expr_type->id == ZigTypeIdInt) {
28162816 if (op_id == IrUnOpNegationWrap) {
28172817 return LLVMBuildNeg(g->builder, expr, "");
28182818 } else if (ir_want_runtime_safety(g, &un_op_instruction->base)) {
......@@ -2921,7 +2921,7 @@ static LLVMValueRef ir_render_load_ptr(CodeGen *g, IrExecutable *executable, IrI
29212921
29222922 LLVMValueRef ptr = ir_llvm_value(g, instruction->ptr);
29232923 ZigType *ptr_type = instruction->ptr->value.type;
2924 assert(ptr_type->id == TypeTableEntryIdPointer);
2924 assert(ptr_type->id == ZigTypeIdPointer);
29252925
29262926 uint32_t unaligned_bit_count = ptr_type->data.pointer.unaligned_bit_count;
29272927 if (unaligned_bit_count == 0)
......@@ -2946,7 +2946,7 @@ static LLVMValueRef ir_render_store_ptr(CodeGen *g, IrExecutable *executable, Ir
29462946 LLVMValueRef ptr = ir_llvm_value(g, instruction->ptr);
29472947 LLVMValueRef value = ir_llvm_value(g, instruction->value);
29482948
2949 assert(instruction->ptr->value.type->id == TypeTableEntryIdPointer);
2949 assert(instruction->ptr->value.type->id == ZigTypeIdPointer);
29502950 ZigType *ptr_type = instruction->ptr->value.type;
29512951
29522952 gen_assign_raw(g, ptr, ptr_type, value);
......@@ -2967,7 +2967,7 @@ static LLVMValueRef ir_render_var_ptr(CodeGen *g, IrExecutable *executable, IrIn
29672967static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrInstructionElemPtr *instruction) {
29682968 LLVMValueRef array_ptr_ptr = ir_llvm_value(g, instruction->array_ptr);
29692969 ZigType *array_ptr_type = instruction->array_ptr->value.type;
2970 assert(array_ptr_type->id == TypeTableEntryIdPointer);
2970 assert(array_ptr_type->id == ZigTypeIdPointer);
29712971 ZigType *array_type = array_ptr_type->data.pointer.child_type;
29722972 LLVMValueRef array_ptr = get_handle_value(g, array_ptr_ptr, array_type, array_ptr_type);
29732973 LLVMValueRef subscript_value = ir_llvm_value(g, instruction->elem_index);
......@@ -2978,11 +2978,11 @@ static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrI
29782978
29792979 bool safety_check_on = ir_want_runtime_safety(g, &instruction->base) && instruction->safety_check_on;
29802980
2981 if (array_type->id == TypeTableEntryIdArray ||
2982 (array_type->id == TypeTableEntryIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle))
2981 if (array_type->id == ZigTypeIdArray ||
2982 (array_type->id == ZigTypeIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle))
29832983 {
2984 if (array_type->id == TypeTableEntryIdPointer) {
2985 assert(array_type->data.pointer.child_type->id == TypeTableEntryIdArray);
2984 if (array_type->id == ZigTypeIdPointer) {
2985 assert(array_type->data.pointer.child_type->id == ZigTypeIdArray);
29862986 array_type = array_type->data.pointer.child_type;
29872987 }
29882988 if (safety_check_on) {
......@@ -2994,7 +2994,7 @@ static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrI
29942994 return array_ptr_ptr;
29952995 }
29962996 ZigType *child_type = array_type->data.array.child_type;
2997 if (child_type->id == TypeTableEntryIdStruct &&
2997 if (child_type->id == ZigTypeIdStruct &&
29982998 child_type->data.structure.layout == ContainerLayoutPacked)
29992999 {
30003000 size_t unaligned_bit_count = instruction->base.value.type->data.pointer.unaligned_bit_count;
......@@ -3017,13 +3017,13 @@ static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrI
30173017 subscript_value
30183018 };
30193019 return LLVMBuildInBoundsGEP(g->builder, array_ptr, indices, 2, "");
3020 } else if (array_type->id == TypeTableEntryIdPointer) {
3020 } else if (array_type->id == ZigTypeIdPointer) {
30213021 assert(LLVMGetTypeKind(LLVMTypeOf(array_ptr)) == LLVMPointerTypeKind);
30223022 LLVMValueRef indices[] = {
30233023 subscript_value
30243024 };
30253025 return LLVMBuildInBoundsGEP(g->builder, array_ptr, indices, 1, "");
3026 } else if (array_type->id == TypeTableEntryIdStruct) {
3026 } else if (array_type->id == ZigTypeIdStruct) {
30273027 assert(array_type->data.structure.is_slice);
30283028 if (!type_has_bits(instruction->base.value.type)) {
30293029 if (safety_check_on) {
......@@ -3056,8 +3056,8 @@ static LLVMValueRef ir_render_elem_ptr(CodeGen *g, IrExecutable *executable, IrI
30563056
30573057static bool get_prefix_arg_err_ret_stack(CodeGen *g, FnTypeId *fn_type_id) {
30583058 return g->have_err_ret_tracing &&
3059 (fn_type_id->return_type->id == TypeTableEntryIdErrorUnion ||
3060 fn_type_id->return_type->id == TypeTableEntryIdErrorSet ||
3059 (fn_type_id->return_type->id == ZigTypeIdErrorUnion ||
3060 fn_type_id->return_type->id == ZigTypeIdErrorSet ||
30613061 fn_type_id->cc == CallingConventionAsync);
30623062}
30633063
......@@ -3201,7 +3201,7 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
32013201 return instruction->tmp_ptr;
32023202 }
32033203
3204 if (src_return_type->id == TypeTableEntryIdUnreachable) {
3204 if (src_return_type->id == ZigTypeIdUnreachable) {
32053205 return LLVMBuildUnreachable(g->builder);
32063206 } else if (!ret_has_bits) {
32073207 return nullptr;
......@@ -3221,14 +3221,14 @@ static LLVMValueRef ir_render_struct_field_ptr(CodeGen *g, IrExecutable *executa
32213221 IrInstructionStructFieldPtr *instruction)
32223222{
32233223 LLVMValueRef struct_ptr = ir_llvm_value(g, instruction->struct_ptr);
3224 // not necessarily a pointer. could be TypeTableEntryIdStruct
3224 // not necessarily a pointer. could be ZigTypeIdStruct
32253225 ZigType *struct_ptr_type = instruction->struct_ptr->value.type;
32263226 TypeStructField *field = instruction->field;
32273227
32283228 if (!type_has_bits(field->type_entry))
32293229 return nullptr;
32303230
3231 if (struct_ptr_type->id == TypeTableEntryIdPointer &&
3231 if (struct_ptr_type->id == ZigTypeIdPointer &&
32323232 struct_ptr_type->data.pointer.unaligned_bit_count != 0)
32333233 {
32343234 return struct_ptr;
......@@ -3242,9 +3242,9 @@ static LLVMValueRef ir_render_union_field_ptr(CodeGen *g, IrExecutable *executab
32423242 IrInstructionUnionFieldPtr *instruction)
32433243{
32443244 ZigType *union_ptr_type = instruction->union_ptr->value.type;
3245 assert(union_ptr_type->id == TypeTableEntryIdPointer);
3245 assert(union_ptr_type->id == ZigTypeIdPointer);
32463246 ZigType *union_type = union_ptr_type->data.pointer.child_type;
3247 assert(union_type->id == TypeTableEntryIdUnion);
3247 assert(union_type->id == ZigTypeIdUnion);
32483248
32493249 TypeUnionField *field = instruction->field;
32503250
......@@ -3412,7 +3412,7 @@ static LLVMValueRef ir_render_asm(CodeGen *g, IrExecutable *executable, IrInstru
34123412}
34133413
34143414static LLVMValueRef gen_non_null_bit(CodeGen *g, ZigType *maybe_type, LLVMValueRef maybe_handle) {
3415 assert(maybe_type->id == TypeTableEntryIdOptional);
3415 assert(maybe_type->id == ZigTypeIdOptional);
34163416 ZigType *child_type = maybe_type->data.maybe.child_type;
34173417 if (child_type->zero_bits) {
34183418 return maybe_handle;
......@@ -3437,9 +3437,9 @@ static LLVMValueRef ir_render_unwrap_maybe(CodeGen *g, IrExecutable *executable,
34373437 IrInstructionUnwrapOptional *instruction)
34383438{
34393439 ZigType *ptr_type = instruction->value->value.type;
3440 assert(ptr_type->id == TypeTableEntryIdPointer);
3440 assert(ptr_type->id == ZigTypeIdPointer);
34413441 ZigType *maybe_type = ptr_type->data.pointer.child_type;
3442 assert(maybe_type->id == TypeTableEntryIdOptional);
3442 assert(maybe_type->id == ZigTypeIdOptional);
34433443 ZigType *child_type = maybe_type->data.maybe.child_type;
34443444 LLVMValueRef maybe_ptr = ir_llvm_value(g, instruction->value);
34453445 LLVMValueRef maybe_handle = get_handle_value(g, maybe_ptr, maybe_type, ptr_type);
......@@ -3612,7 +3612,7 @@ static LLVMValueRef ir_render_err_name(CodeGen *g, IrExecutable *executable, IrI
36123612}
36133613
36143614static LLVMValueRef get_enum_tag_name_function(CodeGen *g, ZigType *enum_type) {
3615 assert(enum_type->id == TypeTableEntryIdEnum);
3615 assert(enum_type->id == ZigTypeIdEnum);
36163616 if (enum_type->data.enumeration.name_function)
36173617 return enum_type->data.enumeration.name_function;
36183618
......@@ -3710,7 +3710,7 @@ static LLVMValueRef ir_render_enum_tag_name(CodeGen *g, IrExecutable *executable
37103710 IrInstructionTagName *instruction)
37113711{
37123712 ZigType *enum_type = instruction->target->value.type;
3713 assert(enum_type->id == TypeTableEntryIdEnum);
3713 assert(enum_type->id == ZigTypeIdEnum);
37143714
37153715 LLVMValueRef enum_name_function = get_enum_tag_name_function(g, enum_type);
37163716
......@@ -3723,7 +3723,7 @@ static LLVMValueRef ir_render_field_parent_ptr(CodeGen *g, IrExecutable *executa
37233723 IrInstructionFieldParentPtr *instruction)
37243724{
37253725 ZigType *container_ptr_type = instruction->base.value.type;
3726 assert(container_ptr_type->id == TypeTableEntryIdPointer);
3726 assert(container_ptr_type->id == ZigTypeIdPointer);
37273727
37283728 ZigType *container_type = container_ptr_type->data.pointer.child_type;
37293729
......@@ -3760,27 +3760,27 @@ static LLVMValueRef ir_render_align_cast(CodeGen *g, IrExecutable *executable, I
37603760 uint32_t align_bytes;
37613761 LLVMValueRef ptr_val;
37623762
3763 if (target_type->id == TypeTableEntryIdPointer) {
3763 if (target_type->id == ZigTypeIdPointer) {
37643764 align_bytes = target_type->data.pointer.alignment;
37653765 ptr_val = target_val;
3766 } else if (target_type->id == TypeTableEntryIdFn) {
3766 } else if (target_type->id == ZigTypeIdFn) {
37673767 align_bytes = target_type->data.fn.fn_type_id.alignment;
37683768 ptr_val = target_val;
3769 } else if (target_type->id == TypeTableEntryIdOptional &&
3770 target_type->data.maybe.child_type->id == TypeTableEntryIdPointer)
3769 } else if (target_type->id == ZigTypeIdOptional &&
3770 target_type->data.maybe.child_type->id == ZigTypeIdPointer)
37713771 {
37723772 align_bytes = target_type->data.maybe.child_type->data.pointer.alignment;
37733773 ptr_val = target_val;
3774 } else if (target_type->id == TypeTableEntryIdOptional &&
3775 target_type->data.maybe.child_type->id == TypeTableEntryIdFn)
3774 } else if (target_type->id == ZigTypeIdOptional &&
3775 target_type->data.maybe.child_type->id == ZigTypeIdFn)
37763776 {
37773777 align_bytes = target_type->data.maybe.child_type->data.fn.fn_type_id.alignment;
37783778 ptr_val = target_val;
3779 } else if (target_type->id == TypeTableEntryIdOptional &&
3780 target_type->data.maybe.child_type->id == TypeTableEntryIdPromise)
3779 } else if (target_type->id == ZigTypeIdOptional &&
3780 target_type->data.maybe.child_type->id == ZigTypeIdPromise)
37813781 {
37823782 zig_panic("TODO audit this function");
3783 } else if (target_type->id == TypeTableEntryIdStruct && target_type->data.structure.is_slice) {
3783 } else if (target_type->id == ZigTypeIdStruct && target_type->data.structure.is_slice) {
37843784 ZigType *slice_ptr_type = target_type->data.structure.fields[slice_ptr_index].type_entry;
37853785 align_bytes = slice_ptr_type->data.pointer.alignment;
37863786
......@@ -3878,7 +3878,7 @@ static LLVMValueRef ir_render_cmpxchg(CodeGen *g, IrExecutable *executable, IrIn
38783878 success_order, failure_order, instruction->is_weak);
38793879
38803880 ZigType *maybe_type = instruction->base.value.type;
3881 assert(maybe_type->id == TypeTableEntryIdOptional);
3881 assert(maybe_type->id == ZigTypeIdOptional);
38823882 ZigType *child_type = maybe_type->data.maybe.child_type;
38833883
38843884 if (type_is_codegen_pointer(child_type)) {
......@@ -3932,7 +3932,7 @@ static LLVMValueRef ir_render_memset(CodeGen *g, IrExecutable *executable, IrIns
39323932 LLVMValueRef dest_ptr_casted = LLVMBuildBitCast(g->builder, dest_ptr, ptr_u8, "");
39333933
39343934 ZigType *ptr_type = instruction->dest_ptr->value.type;
3935 assert(ptr_type->id == TypeTableEntryIdPointer);
3935 assert(ptr_type->id == ZigTypeIdPointer);
39363936
39373937 LLVMValueRef is_volatile = ptr_type->data.pointer.is_volatile ?
39383938 LLVMConstAllOnes(LLVMInt1Type()) : LLVMConstNull(LLVMInt1Type());
......@@ -3964,8 +3964,8 @@ static LLVMValueRef ir_render_memcpy(CodeGen *g, IrExecutable *executable, IrIns
39643964 ZigType *dest_ptr_type = instruction->dest_ptr->value.type;
39653965 ZigType *src_ptr_type = instruction->src_ptr->value.type;
39663966
3967 assert(dest_ptr_type->id == TypeTableEntryIdPointer);
3968 assert(src_ptr_type->id == TypeTableEntryIdPointer);
3967 assert(dest_ptr_type->id == ZigTypeIdPointer);
3968 assert(src_ptr_type->id == ZigTypeIdPointer);
39693969
39703970 LLVMValueRef is_volatile = (dest_ptr_type->data.pointer.is_volatile || src_ptr_type->data.pointer.is_volatile) ?
39713971 LLVMConstAllOnes(LLVMInt1Type()) : LLVMConstNull(LLVMInt1Type());
......@@ -3990,7 +3990,7 @@ static LLVMValueRef ir_render_slice(CodeGen *g, IrExecutable *executable, IrInst
39903990
39913991 LLVMValueRef array_ptr_ptr = ir_llvm_value(g, instruction->ptr);
39923992 ZigType *array_ptr_type = instruction->ptr->value.type;
3993 assert(array_ptr_type->id == TypeTableEntryIdPointer);
3993 assert(array_ptr_type->id == ZigTypeIdPointer);
39943994 ZigType *array_type = array_ptr_type->data.pointer.child_type;
39953995 LLVMValueRef array_ptr = get_handle_value(g, array_ptr_ptr, array_type, array_ptr_type);
39963996
......@@ -3998,10 +3998,10 @@ static LLVMValueRef ir_render_slice(CodeGen *g, IrExecutable *executable, IrInst
39983998
39993999 bool want_runtime_safety = instruction->safety_check_on && ir_want_runtime_safety(g, &instruction->base);
40004000
4001 if (array_type->id == TypeTableEntryIdArray ||
4002 (array_type->id == TypeTableEntryIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle))
4001 if (array_type->id == ZigTypeIdArray ||
4002 (array_type->id == ZigTypeIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle))
40034003 {
4004 if (array_type->id == TypeTableEntryIdPointer) {
4004 if (array_type->id == ZigTypeIdPointer) {
40054005 array_type = array_type->data.pointer.child_type;
40064006 }
40074007 LLVMValueRef start_val = ir_llvm_value(g, instruction->start);
......@@ -4042,7 +4042,7 @@ static LLVMValueRef ir_render_slice(CodeGen *g, IrExecutable *executable, IrInst
40424042 gen_store_untyped(g, len_value, len_field_ptr, 0, false);
40434043
40444044 return tmp_struct_ptr;
4045 } else if (array_type->id == TypeTableEntryIdPointer) {
4045 } else if (array_type->id == ZigTypeIdPointer) {
40464046 assert(array_type->data.pointer.ptr_len == PtrLenUnknown);
40474047 LLVMValueRef start_val = ir_llvm_value(g, instruction->start);
40484048 LLVMValueRef end_val = ir_llvm_value(g, instruction->end);
......@@ -4064,7 +4064,7 @@ static LLVMValueRef ir_render_slice(CodeGen *g, IrExecutable *executable, IrInst
40644064 gen_store_untyped(g, len_value, len_field_ptr, 0, false);
40654065
40664066 return tmp_struct_ptr;
4067 } else if (array_type->id == TypeTableEntryIdStruct) {
4067 } else if (array_type->id == ZigTypeIdStruct) {
40684068 assert(array_type->data.structure.is_slice);
40694069 assert(LLVMGetTypeKind(LLVMTypeOf(array_ptr)) == LLVMPointerTypeKind);
40704070 assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(array_ptr))) == LLVMStructTypeKind);
......@@ -4179,7 +4179,7 @@ static LLVMValueRef ir_render_handle(CodeGen *g, IrExecutable *executable,
41794179
41804180static LLVMValueRef render_shl_with_overflow(CodeGen *g, IrInstructionOverflowOp *instruction) {
41814181 ZigType *int_type = instruction->result_ptr_type;
4182 assert(int_type->id == TypeTableEntryIdInt);
4182 assert(int_type->id == ZigTypeIdInt);
41834183
41844184 LLVMValueRef op1 = ir_llvm_value(g, instruction->op1);
41854185 LLVMValueRef op2 = ir_llvm_value(g, instruction->op2);
......@@ -4219,7 +4219,7 @@ static LLVMValueRef ir_render_overflow_op(CodeGen *g, IrExecutable *executable,
42194219 }
42204220
42214221 ZigType *int_type = instruction->result_ptr_type;
4222 assert(int_type->id == TypeTableEntryIdInt);
4222 assert(int_type->id == ZigTypeIdInt);
42234223
42244224 LLVMValueRef fn_val = get_int_overflow_fn(g, int_type, add_sub_mul);
42254225
......@@ -4259,7 +4259,7 @@ static LLVMValueRef ir_render_test_err(CodeGen *g, IrExecutable *executable, IrI
42594259
42604260static LLVMValueRef ir_render_unwrap_err_code(CodeGen *g, IrExecutable *executable, IrInstructionUnwrapErrCode *instruction) {
42614261 ZigType *ptr_type = instruction->value->value.type;
4262 assert(ptr_type->id == TypeTableEntryIdPointer);
4262 assert(ptr_type->id == ZigTypeIdPointer);
42634263 ZigType *err_union_type = ptr_type->data.pointer.child_type;
42644264 ZigType *payload_type = err_union_type->data.error_union.payload_type;
42654265 LLVMValueRef err_union_ptr = ir_llvm_value(g, instruction->value);
......@@ -4275,7 +4275,7 @@ static LLVMValueRef ir_render_unwrap_err_code(CodeGen *g, IrExecutable *executab
42754275
42764276static LLVMValueRef ir_render_unwrap_err_payload(CodeGen *g, IrExecutable *executable, IrInstructionUnwrapErrPayload *instruction) {
42774277 ZigType *ptr_type = instruction->value->value.type;
4278 assert(ptr_type->id == TypeTableEntryIdPointer);
4278 assert(ptr_type->id == ZigTypeIdPointer);
42794279 ZigType *err_union_type = ptr_type->data.pointer.child_type;
42804280 ZigType *payload_type = err_union_type->data.error_union.payload_type;
42814281 LLVMValueRef err_union_ptr = ir_llvm_value(g, instruction->value);
......@@ -4315,7 +4315,7 @@ static LLVMValueRef ir_render_unwrap_err_payload(CodeGen *g, IrExecutable *execu
43154315static LLVMValueRef ir_render_maybe_wrap(CodeGen *g, IrExecutable *executable, IrInstructionOptionalWrap *instruction) {
43164316 ZigType *wanted_type = instruction->base.value.type;
43174317
4318 assert(wanted_type->id == TypeTableEntryIdOptional);
4318 assert(wanted_type->id == ZigTypeIdOptional);
43194319
43204320 ZigType *child_type = wanted_type->data.maybe.child_type;
43214321
......@@ -4342,7 +4342,7 @@ static LLVMValueRef ir_render_maybe_wrap(CodeGen *g, IrExecutable *executable, I
43424342static LLVMValueRef ir_render_err_wrap_code(CodeGen *g, IrExecutable *executable, IrInstructionErrWrapCode *instruction) {
43434343 ZigType *wanted_type = instruction->base.value.type;
43444344
4345 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
4345 assert(wanted_type->id == ZigTypeIdErrorUnion);
43464346
43474347 ZigType *payload_type = wanted_type->data.error_union.payload_type;
43484348 ZigType *err_set_type = wanted_type->data.error_union.err_set_type;
......@@ -4363,7 +4363,7 @@ static LLVMValueRef ir_render_err_wrap_code(CodeGen *g, IrExecutable *executable
43634363static LLVMValueRef ir_render_err_wrap_payload(CodeGen *g, IrExecutable *executable, IrInstructionErrWrapPayload *instruction) {
43644364 ZigType *wanted_type = instruction->base.value.type;
43654365
4366 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
4366 assert(wanted_type->id == ZigTypeIdErrorUnion);
43674367
43684368 ZigType *payload_type = wanted_type->data.error_union.payload_type;
43694369 ZigType *err_set_type = wanted_type->data.error_union.err_set_type;
......@@ -4471,7 +4471,7 @@ static LLVMValueRef ir_render_container_init_list(CodeGen *g, IrExecutable *exec
44714471 IrInstructionContainerInitList *instruction)
44724472{
44734473 ZigType *array_type = instruction->base.value.type;
4474 assert(array_type->id == TypeTableEntryIdArray);
4474 assert(array_type->id == ZigTypeIdArray);
44754475 LLVMValueRef tmp_array_ptr = instruction->tmp_ptr;
44764476 assert(tmp_array_ptr);
44774477
......@@ -4605,7 +4605,7 @@ static LLVMValueRef get_coro_alloc_helper_fn_val(CodeGen *g, LLVMTypeRef alloc_f
46054605 if (g->coro_alloc_helper_fn_val != nullptr)
46064606 return g->coro_alloc_helper_fn_val;
46074607
4608 assert(fn_type->id == TypeTableEntryIdFn);
4608 assert(fn_type->id == ZigTypeIdFn);
46094609
46104610 ZigType *ptr_to_err_code_type = get_pointer_to_type(g, g->builtin_types.entry_global_error_set, false);
46114611
......@@ -4734,7 +4734,7 @@ static LLVMValueRef ir_render_atomic_rmw(CodeGen *g, IrExecutable *executable,
47344734{
47354735 bool is_signed;
47364736 ZigType *operand_type = instruction->operand->value.type;
4737 if (operand_type->id == TypeTableEntryIdInt) {
4737 if (operand_type->id == ZigTypeIdInt) {
47384738 is_signed = operand_type->data.integral.is_signed;
47394739 } else {
47404740 is_signed = false;
......@@ -4789,7 +4789,7 @@ static LLVMValueRef ir_render_mark_err_ret_trace_ptr(CodeGen *g, IrExecutable *e
47894789
47904790static LLVMValueRef ir_render_sqrt(CodeGen *g, IrExecutable *executable, IrInstructionSqrt *instruction) {
47914791 LLVMValueRef op = ir_llvm_value(g, instruction->op);
4792 assert(instruction->base.value.type->id == TypeTableEntryIdFloat);
4792 assert(instruction->base.value.type->id == ZigTypeIdFloat);
47934793 LLVMValueRef fn_val = get_float_fn(g, instruction->base.value.type, ZigLLVMFnIdSqrt);
47944794 return LLVMBuildCall(g->builder, fn_val, &op, 1, "");
47954795}
......@@ -5146,56 +5146,56 @@ static LLVMValueRef pack_const_int(CodeGen *g, LLVMTypeRef big_int_type_ref, Con
51465146 ZigType *type_entry = const_val->type;
51475147 assert(!type_entry->zero_bits);
51485148 switch (type_entry->id) {
5149 case TypeTableEntryIdInvalid:
5150 case TypeTableEntryIdMetaType:
5151 case TypeTableEntryIdUnreachable:
5152 case TypeTableEntryIdComptimeFloat:
5153 case TypeTableEntryIdComptimeInt:
5154 case TypeTableEntryIdUndefined:
5155 case TypeTableEntryIdNull:
5156 case TypeTableEntryIdErrorUnion:
5157 case TypeTableEntryIdErrorSet:
5158 case TypeTableEntryIdNamespace:
5159 case TypeTableEntryIdBlock:
5160 case TypeTableEntryIdBoundFn:
5161 case TypeTableEntryIdArgTuple:
5162 case TypeTableEntryIdVoid:
5163 case TypeTableEntryIdOpaque:
5149 case ZigTypeIdInvalid:
5150 case ZigTypeIdMetaType:
5151 case ZigTypeIdUnreachable:
5152 case ZigTypeIdComptimeFloat:
5153 case ZigTypeIdComptimeInt:
5154 case ZigTypeIdUndefined:
5155 case ZigTypeIdNull:
5156 case ZigTypeIdErrorUnion:
5157 case ZigTypeIdErrorSet:
5158 case ZigTypeIdNamespace:
5159 case ZigTypeIdBlock:
5160 case ZigTypeIdBoundFn:
5161 case ZigTypeIdArgTuple:
5162 case ZigTypeIdVoid:
5163 case ZigTypeIdOpaque:
51645164 zig_unreachable();
5165 case TypeTableEntryIdBool:
5165 case ZigTypeIdBool:
51665166 return LLVMConstInt(big_int_type_ref, const_val->data.x_bool ? 1 : 0, false);
5167 case TypeTableEntryIdEnum:
5167 case ZigTypeIdEnum:
51685168 {
51695169 assert(type_entry->data.enumeration.decl_node->data.container_decl.init_arg_expr != nullptr);
51705170 LLVMValueRef int_val = gen_const_val(g, const_val, "");
51715171 return LLVMConstZExt(int_val, big_int_type_ref);
51725172 }
5173 case TypeTableEntryIdInt:
5173 case ZigTypeIdInt:
51745174 {
51755175 LLVMValueRef int_val = gen_const_val(g, const_val, "");
51765176 return LLVMConstZExt(int_val, big_int_type_ref);
51775177 }
5178 case TypeTableEntryIdFloat:
5178 case ZigTypeIdFloat:
51795179 {
51805180 LLVMValueRef float_val = gen_const_val(g, const_val, "");
51815181 LLVMValueRef int_val = LLVMConstFPToUI(float_val,
51825182 LLVMIntType((unsigned)type_entry->data.floating.bit_count));
51835183 return LLVMConstZExt(int_val, big_int_type_ref);
51845184 }
5185 case TypeTableEntryIdPointer:
5186 case TypeTableEntryIdFn:
5187 case TypeTableEntryIdOptional:
5188 case TypeTableEntryIdPromise:
5185 case ZigTypeIdPointer:
5186 case ZigTypeIdFn:
5187 case ZigTypeIdOptional:
5188 case ZigTypeIdPromise:
51895189 {
51905190 LLVMValueRef ptr_val = gen_const_val(g, const_val, "");
51915191 LLVMValueRef ptr_size_int_val = LLVMConstPtrToInt(ptr_val, g->builtin_types.entry_usize->type_ref);
51925192 return LLVMConstZExt(ptr_size_int_val, big_int_type_ref);
51935193 }
5194 case TypeTableEntryIdArray:
5194 case ZigTypeIdArray:
51955195 zig_panic("TODO bit pack an array");
5196 case TypeTableEntryIdUnion:
5196 case ZigTypeIdUnion:
51975197 zig_panic("TODO bit pack a union");
5198 case TypeTableEntryIdStruct:
5198 case ZigTypeIdStruct:
51995199 {
52005200 assert(type_entry->data.structure.layout == ContainerLayoutPacked);
52015201 bool is_big_endian = g->is_big_endian; // TODO get endianness from struct type
......@@ -5253,7 +5253,7 @@ static LLVMValueRef gen_const_val_ptr(CodeGen *g, ConstExprValue *const_val, con
52535253 render_const_val_global(g, const_val, name);
52545254 ConstExprValue *array_const_val = const_val->data.x_ptr.data.base_array.array_val;
52555255 size_t elem_index = const_val->data.x_ptr.data.base_array.elem_index;
5256 assert(array_const_val->type->id == TypeTableEntryIdArray);
5256 assert(array_const_val->type->id == ZigTypeIdArray);
52575257 if (array_const_val->type->zero_bits) {
52585258 // make this a null pointer
52595259 ZigType *usize = g->builtin_types.entry_usize;
......@@ -5273,7 +5273,7 @@ static LLVMValueRef gen_const_val_ptr(CodeGen *g, ConstExprValue *const_val, con
52735273 {
52745274 render_const_val_global(g, const_val, name);
52755275 ConstExprValue *struct_const_val = const_val->data.x_ptr.data.base_struct.struct_val;
5276 assert(struct_const_val->type->id == TypeTableEntryIdStruct);
5276 assert(struct_const_val->type->id == ZigTypeIdStruct);
52775277 if (struct_const_val->type->zero_bits) {
52785278 // make this a null pointer
52795279 ZigType *usize = g->builtin_types.entry_usize;
......@@ -5322,13 +5322,13 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
53225322 }
53235323
53245324 switch (type_entry->id) {
5325 case TypeTableEntryIdInt:
5325 case ZigTypeIdInt:
53265326 return bigint_to_llvm_const(type_entry->type_ref, &const_val->data.x_bigint);
5327 case TypeTableEntryIdErrorSet:
5327 case ZigTypeIdErrorSet:
53285328 assert(const_val->data.x_err_set != nullptr);
53295329 return LLVMConstInt(g->builtin_types.entry_global_error_set->type_ref,
53305330 const_val->data.x_err_set->value, false);
5331 case TypeTableEntryIdFloat:
5331 case ZigTypeIdFloat:
53325332 switch (type_entry->data.floating.bit_count) {
53335333 case 16:
53345334 return LLVMConstReal(type_entry->type_ref, zig_f16_to_double(const_val->data.x_f16));
......@@ -5348,13 +5348,13 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
53485348 default:
53495349 zig_unreachable();
53505350 }
5351 case TypeTableEntryIdBool:
5351 case ZigTypeIdBool:
53525352 if (const_val->data.x_bool) {
53535353 return LLVMConstAllOnes(LLVMInt1Type());
53545354 } else {
53555355 return LLVMConstNull(LLVMInt1Type());
53565356 }
5357 case TypeTableEntryIdOptional:
5357 case ZigTypeIdOptional:
53585358 {
53595359 ZigType *child_type = type_entry->data.maybe.child_type;
53605360 if (child_type->zero_bits) {
......@@ -5387,7 +5387,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
53875387 }
53885388 }
53895389 }
5390 case TypeTableEntryIdStruct:
5390 case ZigTypeIdStruct:
53915391 {
53925392 LLVMValueRef *fields = allocate<LLVMValueRef>(type_entry->data.structure.gen_field_count);
53935393 size_t src_field_count = type_entry->data.structure.src_field_count;
......@@ -5463,7 +5463,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
54635463 return LLVMConstNamedStruct(type_entry->type_ref, fields, type_entry->data.structure.gen_field_count);
54645464 }
54655465 }
5466 case TypeTableEntryIdArray:
5466 case ZigTypeIdArray:
54675467 {
54685468 uint64_t len = type_entry->data.array.len;
54695469 if (const_val->data.x_array.special == ConstArraySpecialUndef) {
......@@ -5485,7 +5485,7 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
54855485 return LLVMConstArray(element_type_ref, values, (unsigned)len);
54865486 }
54875487 }
5488 case TypeTableEntryIdUnion:
5488 case ZigTypeIdUnion:
54895489 {
54905490 LLVMTypeRef union_type_ref = type_entry->data.unionation.union_type_ref;
54915491
......@@ -5549,15 +5549,15 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
55495549
55505550 }
55515551
5552 case TypeTableEntryIdEnum:
5552 case ZigTypeIdEnum:
55535553 return bigint_to_llvm_const(type_entry->type_ref, &const_val->data.x_enum_tag);
5554 case TypeTableEntryIdFn:
5554 case ZigTypeIdFn:
55555555 assert(const_val->data.x_ptr.special == ConstPtrSpecialFunction);
55565556 assert(const_val->data.x_ptr.mut == ConstPtrMutComptimeConst);
55575557 return fn_llvm_value(g, const_val->data.x_ptr.data.fn.fn_entry);
5558 case TypeTableEntryIdPointer:
5558 case ZigTypeIdPointer:
55595559 return gen_const_val_ptr(g, const_val, name);
5560 case TypeTableEntryIdErrorUnion:
5560 case ZigTypeIdErrorUnion:
55615561 {
55625562 ZigType *payload_type = type_entry->data.error_union.payload_type;
55635563 ZigType *err_set_type = type_entry->data.error_union.err_set_type;
......@@ -5593,21 +5593,21 @@ static LLVMValueRef gen_const_val(CodeGen *g, ConstExprValue *const_val, const c
55935593 }
55945594 }
55955595 }
5596 case TypeTableEntryIdVoid:
5596 case ZigTypeIdVoid:
55975597 return nullptr;
5598 case TypeTableEntryIdInvalid:
5599 case TypeTableEntryIdMetaType:
5600 case TypeTableEntryIdUnreachable:
5601 case TypeTableEntryIdComptimeFloat:
5602 case TypeTableEntryIdComptimeInt:
5603 case TypeTableEntryIdUndefined:
5604 case TypeTableEntryIdNull:
5605 case TypeTableEntryIdNamespace:
5606 case TypeTableEntryIdBlock:
5607 case TypeTableEntryIdBoundFn:
5608 case TypeTableEntryIdArgTuple:
5609 case TypeTableEntryIdOpaque:
5610 case TypeTableEntryIdPromise:
5598 case ZigTypeIdInvalid:
5599 case ZigTypeIdMetaType:
5600 case ZigTypeIdUnreachable:
5601 case ZigTypeIdComptimeFloat:
5602 case ZigTypeIdComptimeInt:
5603 case ZigTypeIdUndefined:
5604 case ZigTypeIdNull:
5605 case ZigTypeIdNamespace:
5606 case ZigTypeIdBlock:
5607 case ZigTypeIdBoundFn:
5608 case ZigTypeIdArgTuple:
5609 case ZigTypeIdOpaque:
5610 case ZigTypeIdPromise:
56115611 zig_unreachable();
56125612
56135613 }
......@@ -5790,7 +5790,7 @@ static void do_code_gen(CodeGen *g) {
57905790 TldVar *tld_var = g->global_vars.at(i);
57915791 ZigVar *var = tld_var->var;
57925792
5793 if (var->value->type->id == TypeTableEntryIdComptimeFloat) {
5793 if (var->value->type->id == ZigTypeIdComptimeFloat) {
57945794 // Generate debug info for it but that's it.
57955795 ConstExprValue *const_val = var->value;
57965796 assert(const_val->special != ConstValSpecialRuntime);
......@@ -5804,7 +5804,7 @@ static void do_code_gen(CodeGen *g) {
58045804 continue;
58055805 }
58065806
5807 if (var->value->type->id == TypeTableEntryIdComptimeInt) {
5807 if (var->value->type->id == ZigTypeIdComptimeInt) {
58085808 // Generate debug info for it but that's it.
58095809 ConstExprValue *const_val = var->value;
58105810 assert(const_val->special != ConstValSpecialRuntime);
......@@ -5852,7 +5852,7 @@ static void do_code_gen(CodeGen *g) {
58525852 LLVMSetAlignment(global_value, var->align_bytes);
58535853
58545854 // TODO debug info for function pointers
5855 if (var->gen_is_const && var->value->type->id != TypeTableEntryIdFn) {
5855 if (var->gen_is_const && var->value->type->id != ZigTypeIdFn) {
58565856 gen_global_var(g, var, var->value->global_refs->llvm_value, var->value->type);
58575857 }
58585858
......@@ -5910,7 +5910,7 @@ static void do_code_gen(CodeGen *g) {
59105910 } else if (instruction->id == IrInstructionIdRef) {
59115911 IrInstructionRef *ref_instruction = (IrInstructionRef *)instruction;
59125912 slot = &ref_instruction->tmp_ptr;
5913 assert(instruction->value.type->id == TypeTableEntryIdPointer);
5913 assert(instruction->value.type->id == ZigTypeIdPointer);
59145914 slot_type = instruction->value.type->data.pointer.child_type;
59155915 } else if (instruction->id == IrInstructionIdContainerInitList) {
59165916 IrInstructionContainerInitList *container_init_list_instruction = (IrInstructionContainerInitList *)instruction;
......@@ -6173,51 +6173,51 @@ static const GlobalLinkageValue global_linkage_values[] = {
61736173static void define_builtin_types(CodeGen *g) {
61746174 {
61756175 // if this type is anywhere in the AST, we should never hit codegen.
6176 ZigType *entry = new_type_table_entry(TypeTableEntryIdInvalid);
6176 ZigType *entry = new_type_table_entry(ZigTypeIdInvalid);
61776177 buf_init_from_str(&entry->name, "(invalid)");
61786178 entry->zero_bits = true;
61796179 g->builtin_types.entry_invalid = entry;
61806180 }
61816181 {
6182 ZigType *entry = new_type_table_entry(TypeTableEntryIdNamespace);
6182 ZigType *entry = new_type_table_entry(ZigTypeIdNamespace);
61836183 buf_init_from_str(&entry->name, "(namespace)");
61846184 entry->zero_bits = true;
61856185 g->builtin_types.entry_namespace = entry;
61866186 }
61876187 {
6188 ZigType *entry = new_type_table_entry(TypeTableEntryIdBlock);
6188 ZigType *entry = new_type_table_entry(ZigTypeIdBlock);
61896189 buf_init_from_str(&entry->name, "(block)");
61906190 entry->zero_bits = true;
61916191 g->builtin_types.entry_block = entry;
61926192 }
61936193 {
6194 ZigType *entry = new_type_table_entry(TypeTableEntryIdComptimeFloat);
6194 ZigType *entry = new_type_table_entry(ZigTypeIdComptimeFloat);
61956195 buf_init_from_str(&entry->name, "comptime_float");
61966196 entry->zero_bits = true;
61976197 g->builtin_types.entry_num_lit_float = entry;
61986198 g->primitive_type_table.put(&entry->name, entry);
61996199 }
62006200 {
6201 ZigType *entry = new_type_table_entry(TypeTableEntryIdComptimeInt);
6201 ZigType *entry = new_type_table_entry(ZigTypeIdComptimeInt);
62026202 buf_init_from_str(&entry->name, "comptime_int");
62036203 entry->zero_bits = true;
62046204 g->builtin_types.entry_num_lit_int = entry;
62056205 g->primitive_type_table.put(&entry->name, entry);
62066206 }
62076207 {
6208 ZigType *entry = new_type_table_entry(TypeTableEntryIdUndefined);
6208 ZigType *entry = new_type_table_entry(ZigTypeIdUndefined);
62096209 buf_init_from_str(&entry->name, "(undefined)");
62106210 entry->zero_bits = true;
62116211 g->builtin_types.entry_undef = entry;
62126212 }
62136213 {
6214 ZigType *entry = new_type_table_entry(TypeTableEntryIdNull);
6214 ZigType *entry = new_type_table_entry(ZigTypeIdNull);
62156215 buf_init_from_str(&entry->name, "(null)");
62166216 entry->zero_bits = true;
62176217 g->builtin_types.entry_null = entry;
62186218 }
62196219 {
6220 ZigType *entry = new_type_table_entry(TypeTableEntryIdArgTuple);
6220 ZigType *entry = new_type_table_entry(ZigTypeIdArgTuple);
62216221 buf_init_from_str(&entry->name, "(args)");
62226222 entry->zero_bits = true;
62236223 g->builtin_types.entry_arg_tuple = entry;
......@@ -6228,7 +6228,7 @@ static void define_builtin_types(CodeGen *g) {
62286228 uint32_t size_in_bits = target_c_type_size_in_bits(&g->zig_target, info->id);
62296229 bool is_signed = info->is_signed;
62306230
6231 ZigType *entry = new_type_table_entry(TypeTableEntryIdInt);
6231 ZigType *entry = new_type_table_entry(ZigTypeIdInt);
62326232 entry->type_ref = LLVMIntType(size_in_bits);
62336233
62346234 buf_init_from_str(&entry->name, info->name);
......@@ -6245,7 +6245,7 @@ static void define_builtin_types(CodeGen *g) {
62456245 }
62466246
62476247 {
6248 ZigType *entry = new_type_table_entry(TypeTableEntryIdBool);
6248 ZigType *entry = new_type_table_entry(ZigTypeIdBool);
62496249 entry->type_ref = LLVMInt1Type();
62506250 buf_init_from_str(&entry->name, "bool");
62516251 uint64_t debug_size_in_bits = 8*LLVMStoreSizeOfType(g->target_data_ref, entry->type_ref);
......@@ -6259,7 +6259,7 @@ static void define_builtin_types(CodeGen *g) {
62596259 for (size_t sign_i = 0; sign_i < array_length(is_signed_list); sign_i += 1) {
62606260 bool is_signed = is_signed_list[sign_i];
62616261
6262 ZigType *entry = new_type_table_entry(TypeTableEntryIdInt);
6262 ZigType *entry = new_type_table_entry(ZigTypeIdInt);
62636263 entry->type_ref = LLVMIntType(g->pointer_size_bytes * 8);
62646264
62656265 const char u_or_i = is_signed ? 'i' : 'u';
......@@ -6287,7 +6287,7 @@ static void define_builtin_types(CodeGen *g) {
62876287 uint32_t bit_count,
62886288 LLVMTypeRef type_ref,
62896289 ZigType **field) {
6290 ZigType *entry = new_type_table_entry(TypeTableEntryIdFloat);
6290 ZigType *entry = new_type_table_entry(ZigTypeIdFloat);
62916291 entry->type_ref = type_ref;
62926292 buf_init_from_str(&entry->name, name);
62936293 entry->data.floating.bit_count = bit_count;
......@@ -6306,7 +6306,7 @@ static void define_builtin_types(CodeGen *g) {
63066306 add_fp_entry(g, "c_longdouble", 80, LLVMX86FP80Type(), &g->builtin_types.entry_c_longdouble);
63076307
63086308 {
6309 ZigType *entry = new_type_table_entry(TypeTableEntryIdVoid);
6309 ZigType *entry = new_type_table_entry(ZigTypeIdVoid);
63106310 entry->type_ref = LLVMVoidType();
63116311 entry->zero_bits = true;
63126312 buf_init_from_str(&entry->name, "void");
......@@ -6317,7 +6317,7 @@ static void define_builtin_types(CodeGen *g) {
63176317 g->primitive_type_table.put(&entry->name, entry);
63186318 }
63196319 {
6320 ZigType *entry = new_type_table_entry(TypeTableEntryIdUnreachable);
6320 ZigType *entry = new_type_table_entry(ZigTypeIdUnreachable);
63216321 entry->type_ref = LLVMVoidType();
63226322 entry->zero_bits = true;
63236323 buf_init_from_str(&entry->name, "noreturn");
......@@ -6326,7 +6326,7 @@ static void define_builtin_types(CodeGen *g) {
63266326 g->primitive_type_table.put(&entry->name, entry);
63276327 }
63286328 {
6329 ZigType *entry = new_type_table_entry(TypeTableEntryIdMetaType);
6329 ZigType *entry = new_type_table_entry(ZigTypeIdMetaType);
63306330 buf_init_from_str(&entry->name, "type");
63316331 entry->zero_bits = true;
63326332 g->builtin_types.entry_type = entry;
......@@ -6348,7 +6348,7 @@ static void define_builtin_types(CodeGen *g) {
63486348 }
63496349
63506350 {
6351 ZigType *entry = new_type_table_entry(TypeTableEntryIdErrorSet);
6351 ZigType *entry = new_type_table_entry(ZigTypeIdErrorSet);
63526352 buf_init_from_str(&entry->name, "error");
63536353 entry->data.error_set.err_count = UINT32_MAX;
63546354
......@@ -7226,57 +7226,57 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, ZigType *type_e
72267226 type_entry->gen_h_loop_flag = true;
72277227
72287228 switch (type_entry->id) {
7229 case TypeTableEntryIdInvalid:
7230 case TypeTableEntryIdMetaType:
7231 case TypeTableEntryIdComptimeFloat:
7232 case TypeTableEntryIdComptimeInt:
7233 case TypeTableEntryIdUndefined:
7234 case TypeTableEntryIdNull:
7235 case TypeTableEntryIdNamespace:
7236 case TypeTableEntryIdBlock:
7237 case TypeTableEntryIdBoundFn:
7238 case TypeTableEntryIdArgTuple:
7239 case TypeTableEntryIdErrorUnion:
7240 case TypeTableEntryIdErrorSet:
7241 case TypeTableEntryIdPromise:
7229 case ZigTypeIdInvalid:
7230 case ZigTypeIdMetaType:
7231 case ZigTypeIdComptimeFloat:
7232 case ZigTypeIdComptimeInt:
7233 case ZigTypeIdUndefined:
7234 case ZigTypeIdNull:
7235 case ZigTypeIdNamespace:
7236 case ZigTypeIdBlock:
7237 case ZigTypeIdBoundFn:
7238 case ZigTypeIdArgTuple:
7239 case ZigTypeIdErrorUnion:
7240 case ZigTypeIdErrorSet:
7241 case ZigTypeIdPromise:
72427242 zig_unreachable();
7243 case TypeTableEntryIdVoid:
7244 case TypeTableEntryIdUnreachable:
7245 case TypeTableEntryIdBool:
7246 case TypeTableEntryIdInt:
7247 case TypeTableEntryIdFloat:
7243 case ZigTypeIdVoid:
7244 case ZigTypeIdUnreachable:
7245 case ZigTypeIdBool:
7246 case ZigTypeIdInt:
7247 case ZigTypeIdFloat:
72487248 return;
7249 case TypeTableEntryIdOpaque:
7249 case ZigTypeIdOpaque:
72507250 gen_h->types_to_declare.append(type_entry);
72517251 return;
7252 case TypeTableEntryIdStruct:
7252 case ZigTypeIdStruct:
72537253 for (uint32_t i = 0; i < type_entry->data.structure.src_field_count; i += 1) {
72547254 TypeStructField *field = &type_entry->data.structure.fields[i];
72557255 prepend_c_type_to_decl_list(g, gen_h, field->type_entry);
72567256 }
72577257 gen_h->types_to_declare.append(type_entry);
72587258 return;
7259 case TypeTableEntryIdUnion:
7259 case ZigTypeIdUnion:
72607260 for (uint32_t i = 0; i < type_entry->data.unionation.src_field_count; i += 1) {
72617261 TypeUnionField *field = &type_entry->data.unionation.fields[i];
72627262 prepend_c_type_to_decl_list(g, gen_h, field->type_entry);
72637263 }
72647264 gen_h->types_to_declare.append(type_entry);
72657265 return;
7266 case TypeTableEntryIdEnum:
7266 case ZigTypeIdEnum:
72677267 prepend_c_type_to_decl_list(g, gen_h, type_entry->data.enumeration.tag_int_type);
72687268 gen_h->types_to_declare.append(type_entry);
72697269 return;
7270 case TypeTableEntryIdPointer:
7270 case ZigTypeIdPointer:
72717271 prepend_c_type_to_decl_list(g, gen_h, type_entry->data.pointer.child_type);
72727272 return;
7273 case TypeTableEntryIdArray:
7273 case ZigTypeIdArray:
72747274 prepend_c_type_to_decl_list(g, gen_h, type_entry->data.array.child_type);
72757275 return;
7276 case TypeTableEntryIdOptional:
7276 case ZigTypeIdOptional:
72777277 prepend_c_type_to_decl_list(g, gen_h, type_entry->data.maybe.child_type);
72787278 return;
7279 case TypeTableEntryIdFn:
7279 case ZigTypeIdFn:
72807280 for (size_t i = 0; i < type_entry->data.fn.fn_type_id.param_count; i += 1) {
72817281 prepend_c_type_to_decl_list(g, gen_h, type_entry->data.fn.fn_type_id.param_info[i].type);
72827282 }
......@@ -7316,17 +7316,17 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
73167316 prepend_c_type_to_decl_list(g, gen_h, type_entry);
73177317
73187318 switch (type_entry->id) {
7319 case TypeTableEntryIdVoid:
7319 case ZigTypeIdVoid:
73207320 buf_init_from_str(out_buf, "void");
73217321 break;
7322 case TypeTableEntryIdBool:
7322 case ZigTypeIdBool:
73237323 buf_init_from_str(out_buf, "bool");
73247324 g->c_want_stdbool = true;
73257325 break;
7326 case TypeTableEntryIdUnreachable:
7326 case ZigTypeIdUnreachable:
73277327 buf_init_from_str(out_buf, "__attribute__((__noreturn__)) void");
73287328 break;
7329 case TypeTableEntryIdFloat:
7329 case ZigTypeIdFloat:
73307330 switch (type_entry->data.floating.bit_count) {
73317331 case 32:
73327332 buf_init_from_str(out_buf, "float");
......@@ -7344,14 +7344,14 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
73447344 zig_unreachable();
73457345 }
73467346 break;
7347 case TypeTableEntryIdInt:
7347 case ZigTypeIdInt:
73487348 g->c_want_stdint = true;
73497349 buf_resize(out_buf, 0);
73507350 buf_appendf(out_buf, "%sint%" PRIu32 "_t",
73517351 type_entry->data.integral.is_signed ? "" : "u",
73527352 type_entry->data.integral.bit_count);
73537353 break;
7354 case TypeTableEntryIdPointer:
7354 case ZigTypeIdPointer:
73557355 {
73567356 Buf child_buf = BUF_INIT;
73577357 ZigType *child_type = type_entry->data.pointer.child_type;
......@@ -7362,7 +7362,7 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
73627362 buf_appendf(out_buf, "%s%s *", const_str, buf_ptr(&child_buf));
73637363 break;
73647364 }
7365 case TypeTableEntryIdOptional:
7365 case ZigTypeIdOptional:
73667366 {
73677367 ZigType *child_type = type_entry->data.maybe.child_type;
73687368 if (child_type->zero_bits) {
......@@ -7374,28 +7374,28 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
73747374 zig_unreachable();
73757375 }
73767376 }
7377 case TypeTableEntryIdStruct:
7378 case TypeTableEntryIdOpaque:
7377 case ZigTypeIdStruct:
7378 case ZigTypeIdOpaque:
73797379 {
73807380 buf_init_from_str(out_buf, "struct ");
73817381 buf_append_buf(out_buf, &type_entry->name);
73827382 return;
73837383 }
7384 case TypeTableEntryIdUnion:
7384 case ZigTypeIdUnion:
73857385 {
73867386 buf_init_from_str(out_buf, "union ");
73877387 buf_append_buf(out_buf, &type_entry->name);
73887388 return;
73897389 }
7390 case TypeTableEntryIdEnum:
7390 case ZigTypeIdEnum:
73917391 {
73927392 buf_init_from_str(out_buf, "enum ");
73937393 buf_append_buf(out_buf, &type_entry->name);
73947394 return;
73957395 }
7396 case TypeTableEntryIdArray:
7396 case ZigTypeIdArray:
73977397 {
7398 TypeTableEntryArray *array_data = &type_entry->data.array;
7398 ZigTypeArray *array_data = &type_entry->data.array;
73997399
74007400 Buf *child_buf = buf_alloc();
74017401 get_c_type(g, gen_h, array_data->child_type, child_buf);
......@@ -7404,21 +7404,21 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
74047404 buf_appendf(out_buf, "%s", buf_ptr(child_buf));
74057405 return;
74067406 }
7407 case TypeTableEntryIdErrorUnion:
7408 case TypeTableEntryIdErrorSet:
7409 case TypeTableEntryIdFn:
7407 case ZigTypeIdErrorUnion:
7408 case ZigTypeIdErrorSet:
7409 case ZigTypeIdFn:
74107410 zig_panic("TODO implement get_c_type for more types");
7411 case TypeTableEntryIdInvalid:
7412 case TypeTableEntryIdMetaType:
7413 case TypeTableEntryIdBoundFn:
7414 case TypeTableEntryIdNamespace:
7415 case TypeTableEntryIdBlock:
7416 case TypeTableEntryIdComptimeFloat:
7417 case TypeTableEntryIdComptimeInt:
7418 case TypeTableEntryIdUndefined:
7419 case TypeTableEntryIdNull:
7420 case TypeTableEntryIdArgTuple:
7421 case TypeTableEntryIdPromise:
7411 case ZigTypeIdInvalid:
7412 case ZigTypeIdMetaType:
7413 case ZigTypeIdBoundFn:
7414 case ZigTypeIdNamespace:
7415 case ZigTypeIdBlock:
7416 case ZigTypeIdComptimeFloat:
7417 case ZigTypeIdComptimeInt:
7418 case ZigTypeIdUndefined:
7419 case ZigTypeIdNull:
7420 case ZigTypeIdArgTuple:
7421 case ZigTypeIdPromise:
74227422 zig_unreachable();
74237423 }
74247424}
......@@ -7509,7 +7509,7 @@ static void gen_h_file(CodeGen *g) {
75097509 const char *restrict_str = param_info->is_noalias ? "restrict" : "";
75107510 get_c_type(g, gen_h, param_info->type, &param_type_c);
75117511
7512 if (param_info->type->id == TypeTableEntryIdArray) {
7512 if (param_info->type->id == ZigTypeIdArray) {
75137513 // Arrays decay to pointers
75147514 buf_appendf(&h_buf, "%s%s%s %s[]", comma_str, buf_ptr(&param_type_c),
75157515 restrict_str, buf_ptr(param_name));
......@@ -7557,30 +7557,30 @@ static void gen_h_file(CodeGen *g) {
75577557 for (size_t type_i = 0; type_i < gen_h->types_to_declare.length; type_i += 1) {
75587558 ZigType *type_entry = gen_h->types_to_declare.at(type_i);
75597559 switch (type_entry->id) {
7560 case TypeTableEntryIdInvalid:
7561 case TypeTableEntryIdMetaType:
7562 case TypeTableEntryIdVoid:
7563 case TypeTableEntryIdBool:
7564 case TypeTableEntryIdUnreachable:
7565 case TypeTableEntryIdInt:
7566 case TypeTableEntryIdFloat:
7567 case TypeTableEntryIdPointer:
7568 case TypeTableEntryIdComptimeFloat:
7569 case TypeTableEntryIdComptimeInt:
7570 case TypeTableEntryIdArray:
7571 case TypeTableEntryIdUndefined:
7572 case TypeTableEntryIdNull:
7573 case TypeTableEntryIdErrorUnion:
7574 case TypeTableEntryIdErrorSet:
7575 case TypeTableEntryIdNamespace:
7576 case TypeTableEntryIdBlock:
7577 case TypeTableEntryIdBoundFn:
7578 case TypeTableEntryIdArgTuple:
7579 case TypeTableEntryIdOptional:
7580 case TypeTableEntryIdFn:
7581 case TypeTableEntryIdPromise:
7560 case ZigTypeIdInvalid:
7561 case ZigTypeIdMetaType:
7562 case ZigTypeIdVoid:
7563 case ZigTypeIdBool:
7564 case ZigTypeIdUnreachable:
7565 case ZigTypeIdInt:
7566 case ZigTypeIdFloat:
7567 case ZigTypeIdPointer:
7568 case ZigTypeIdComptimeFloat:
7569 case ZigTypeIdComptimeInt:
7570 case ZigTypeIdArray:
7571 case ZigTypeIdUndefined:
7572 case ZigTypeIdNull:
7573 case ZigTypeIdErrorUnion:
7574 case ZigTypeIdErrorSet:
7575 case ZigTypeIdNamespace:
7576 case ZigTypeIdBlock:
7577 case ZigTypeIdBoundFn:
7578 case ZigTypeIdArgTuple:
7579 case ZigTypeIdOptional:
7580 case ZigTypeIdFn:
7581 case ZigTypeIdPromise:
75827582 zig_unreachable();
7583 case TypeTableEntryIdEnum:
7583 case ZigTypeIdEnum:
75847584 if (type_entry->data.enumeration.layout == ContainerLayoutExtern) {
75857585 fprintf(out_h, "enum %s {\n", buf_ptr(&type_entry->name));
75867586 for (uint32_t field_i = 0; field_i < type_entry->data.enumeration.src_field_count; field_i += 1) {
......@@ -7598,7 +7598,7 @@ static void gen_h_file(CodeGen *g) {
75987598 fprintf(out_h, "enum %s;\n", buf_ptr(&type_entry->name));
75997599 }
76007600 break;
7601 case TypeTableEntryIdStruct:
7601 case ZigTypeIdStruct:
76027602 if (type_entry->data.structure.layout == ContainerLayoutExtern) {
76037603 fprintf(out_h, "struct %s {\n", buf_ptr(&type_entry->name));
76047604 for (uint32_t field_i = 0; field_i < type_entry->data.structure.src_field_count; field_i += 1) {
......@@ -7607,7 +7607,7 @@ static void gen_h_file(CodeGen *g) {
76077607 Buf *type_name_buf = buf_alloc();
76087608 get_c_type(g, gen_h, struct_field->type_entry, type_name_buf);
76097609
7610 if (struct_field->type_entry->id == TypeTableEntryIdArray) {
7610 if (struct_field->type_entry->id == ZigTypeIdArray) {
76117611 fprintf(out_h, " %s %s[%" ZIG_PRI_u64 "];\n", buf_ptr(type_name_buf),
76127612 buf_ptr(struct_field->name),
76137613 struct_field->type_entry->data.array.len);
......@@ -7621,7 +7621,7 @@ static void gen_h_file(CodeGen *g) {
76217621 fprintf(out_h, "struct %s;\n", buf_ptr(&type_entry->name));
76227622 }
76237623 break;
7624 case TypeTableEntryIdUnion:
7624 case ZigTypeIdUnion:
76257625 if (type_entry->data.unionation.layout == ContainerLayoutExtern) {
76267626 fprintf(out_h, "union %s {\n", buf_ptr(&type_entry->name));
76277627 for (uint32_t field_i = 0; field_i < type_entry->data.unionation.src_field_count; field_i += 1) {
......@@ -7636,7 +7636,7 @@ static void gen_h_file(CodeGen *g) {
76367636 fprintf(out_h, "union %s;\n", buf_ptr(&type_entry->name));
76377637 }
76387638 break;
7639 case TypeTableEntryIdOpaque:
7639 case ZigTypeIdOpaque:
76407640 fprintf(out_h, "struct %s;\n\n", buf_ptr(&type_entry->name));
76417641 break;
76427642 }
src/ir.cpp+896-896
......@@ -198,7 +198,7 @@ static bool types_have_same_zig_comptime_repr(ZigType *a, ZigType *b) {
198198
199199ConstExprValue *const_ptr_pointee(CodeGen *g, ConstExprValue *const_val) {
200200 ConstExprValue *result = const_ptr_pointee_unchecked(g, const_val);
201 if (const_val->type->id == TypeTableEntryIdPointer) {
201 if (const_val->type->id == ZigTypeIdPointer) {
202202 assert(types_have_same_zig_comptime_repr(const_val->type->data.pointer.child_type, result->type));
203203 }
204204 return result;
......@@ -253,7 +253,7 @@ static bool instr_is_comptime(IrInstruction *instruction) {
253253}
254254
255255static bool instr_is_unreachable(IrInstruction *instruction) {
256 return instruction->value.type && instruction->value.type->id == TypeTableEntryIdUnreachable;
256 return instruction->value.type && instruction->value.type->id == ZigTypeIdUnreachable;
257257}
258258
259259static void ir_link_new_instruction(IrInstruction *new_instruction, IrInstruction *old_instruction) {
......@@ -3072,7 +3072,7 @@ static bool ir_gen_defers_for_block(IrBuilder *irb, Scope *inner_scope, Scope *o
30723072 Scope *defer_expr_scope = defer_node->data.defer.expr_scope;
30733073 IrInstruction *defer_expr_value = ir_gen_node(irb, defer_expr_node, defer_expr_scope);
30743074 if (defer_expr_value != irb->codegen->invalid_instruction) {
3075 if (defer_expr_value->value.type != nullptr && defer_expr_value->value.type->id == TypeTableEntryIdUnreachable) {
3075 if (defer_expr_value->value.type != nullptr && defer_expr_value->value.type->id == ZigTypeIdUnreachable) {
30763076 is_noreturn = true;
30773077 } else {
30783078 ir_mark_gen(ir_build_check_statement_is_void(irb, defer_expr_scope, defer_expr_node, defer_expr_value));
......@@ -6587,10 +6587,10 @@ static IrInstruction *ir_gen_container_decl(IrBuilder *irb, Scope *parent_scope,
65876587
65886588// errors should be populated with set1's values
65896589static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigType *set1, ZigType *set2) {
6590 assert(set1->id == TypeTableEntryIdErrorSet);
6591 assert(set2->id == TypeTableEntryIdErrorSet);
6590 assert(set1->id == ZigTypeIdErrorSet);
6591 assert(set2->id == ZigTypeIdErrorSet);
65926592
6593 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
6593 ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);
65946594 buf_resize(&err_set_type->name, 0);
65956595 buf_appendf(&err_set_type->name, "error{");
65966596
......@@ -6642,7 +6642,7 @@ static ZigType *get_error_set_union(CodeGen *g, ErrorTableEntry **errors, ZigTyp
66426642static ZigType *make_err_set_with_one_item(CodeGen *g, Scope *parent_scope, AstNode *node,
66436643 ErrorTableEntry *err_entry)
66446644{
6645 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
6645 ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);
66466646 buf_resize(&err_set_type->name, 0);
66476647 buf_appendf(&err_set_type->name, "error{%s}", buf_ptr(&err_entry->name));
66486648 err_set_type->is_copyable = true;
......@@ -6664,7 +6664,7 @@ static IrInstruction *ir_gen_err_set_decl(IrBuilder *irb, Scope *parent_scope, A
66646664 uint32_t err_count = node->data.err_set_decl.decls.length;
66656665
66666666 Buf *type_name = get_anon_type_name(irb->codegen, irb->exec, "error set", node);
6667 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
6667 ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);
66686668 buf_init_from_buf(&err_set_type->name, type_name);
66696669 err_set_type->is_copyable = true;
66706670 err_set_type->data.error_set.err_count = err_count;
......@@ -7628,7 +7628,7 @@ static ErrorMsg *ir_add_error(IrAnalyze *ira, IrInstruction *source_instruction,
76287628static ConstExprValue *ir_const_ptr_pointee(IrAnalyze *ira, ConstExprValue *const_val, AstNode *source_node) {
76297629 ConstExprValue *val = const_ptr_pointee_unchecked(ira->codegen, const_val);
76307630 assert(val != nullptr);
7631 assert(const_val->type->id == TypeTableEntryIdPointer);
7631 assert(const_val->type->id == ZigTypeIdPointer);
76327632 ZigType *expected_type = const_val->type->data.pointer.child_type;
76337633 if (!types_have_same_zig_comptime_repr(val->type, expected_type)) {
76347634 ir_add_error_node(ira, source_node,
......@@ -7669,16 +7669,16 @@ static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *so
76697669}
76707670
76717671static bool const_val_fits_in_num_lit(ConstExprValue *const_val, ZigType *num_lit_type) {
7672 return ((num_lit_type->id == TypeTableEntryIdComptimeFloat &&
7673 (const_val->type->id == TypeTableEntryIdFloat || const_val->type->id == TypeTableEntryIdComptimeFloat)) ||
7674 (num_lit_type->id == TypeTableEntryIdComptimeInt &&
7675 (const_val->type->id == TypeTableEntryIdInt || const_val->type->id == TypeTableEntryIdComptimeInt)));
7672 return ((num_lit_type->id == ZigTypeIdComptimeFloat &&
7673 (const_val->type->id == ZigTypeIdFloat || const_val->type->id == ZigTypeIdComptimeFloat)) ||
7674 (num_lit_type->id == ZigTypeIdComptimeInt &&
7675 (const_val->type->id == ZigTypeIdInt || const_val->type->id == ZigTypeIdComptimeInt)));
76767676}
76777677
76787678static bool float_has_fraction(ConstExprValue *const_val) {
7679 if (const_val->type->id == TypeTableEntryIdComptimeFloat) {
7679 if (const_val->type->id == ZigTypeIdComptimeFloat) {
76807680 return bigfloat_has_fraction(&const_val->data.x_bigfloat);
7681 } else if (const_val->type->id == TypeTableEntryIdFloat) {
7681 } else if (const_val->type->id == ZigTypeIdFloat) {
76827682 switch (const_val->type->data.floating.bit_count) {
76837683 case 16:
76847684 {
......@@ -7704,9 +7704,9 @@ static bool float_has_fraction(ConstExprValue *const_val) {
77047704}
77057705
77067706static void float_append_buf(Buf *buf, ConstExprValue *const_val) {
7707 if (const_val->type->id == TypeTableEntryIdComptimeFloat) {
7707 if (const_val->type->id == ZigTypeIdComptimeFloat) {
77087708 bigfloat_append_buf(buf, &const_val->data.x_bigfloat);
7709 } else if (const_val->type->id == TypeTableEntryIdFloat) {
7709 } else if (const_val->type->id == ZigTypeIdFloat) {
77107710 switch (const_val->type->data.floating.bit_count) {
77117711 case 16:
77127712 buf_appendf(buf, "%f", zig_f16_to_double(const_val->data.x_f16));
......@@ -7742,9 +7742,9 @@ static void float_append_buf(Buf *buf, ConstExprValue *const_val) {
77427742}
77437743
77447744static void float_init_bigint(BigInt *bigint, ConstExprValue *const_val) {
7745 if (const_val->type->id == TypeTableEntryIdComptimeFloat) {
7745 if (const_val->type->id == ZigTypeIdComptimeFloat) {
77467746 bigint_init_bigfloat(bigint, &const_val->data.x_bigfloat);
7747 } else if (const_val->type->id == TypeTableEntryIdFloat) {
7747 } else if (const_val->type->id == ZigTypeIdFloat) {
77487748 switch (const_val->type->data.floating.bit_count) {
77497749 case 16:
77507750 {
......@@ -7789,9 +7789,9 @@ static void float_init_bigint(BigInt *bigint, ConstExprValue *const_val) {
77897789}
77907790
77917791static void float_init_bigfloat(ConstExprValue *dest_val, BigFloat *bigfloat) {
7792 if (dest_val->type->id == TypeTableEntryIdComptimeFloat) {
7792 if (dest_val->type->id == ZigTypeIdComptimeFloat) {
77937793 bigfloat_init_bigfloat(&dest_val->data.x_bigfloat, bigfloat);
7794 } else if (dest_val->type->id == TypeTableEntryIdFloat) {
7794 } else if (dest_val->type->id == ZigTypeIdFloat) {
77957795 switch (dest_val->type->data.floating.bit_count) {
77967796 case 16:
77977797 dest_val->data.x_f16 = bigfloat_to_f16(bigfloat);
......@@ -7814,9 +7814,9 @@ static void float_init_bigfloat(ConstExprValue *dest_val, BigFloat *bigfloat) {
78147814}
78157815
78167816static void float_init_f16(ConstExprValue *dest_val, float16_t x) {
7817 if (dest_val->type->id == TypeTableEntryIdComptimeFloat) {
7817 if (dest_val->type->id == ZigTypeIdComptimeFloat) {
78187818 bigfloat_init_16(&dest_val->data.x_bigfloat, x);
7819 } else if (dest_val->type->id == TypeTableEntryIdFloat) {
7819 } else if (dest_val->type->id == ZigTypeIdFloat) {
78207820 switch (dest_val->type->data.floating.bit_count) {
78217821 case 16:
78227822 dest_val->data.x_f16 = x;
......@@ -7839,9 +7839,9 @@ static void float_init_f16(ConstExprValue *dest_val, float16_t x) {
78397839}
78407840
78417841static void float_init_f32(ConstExprValue *dest_val, float x) {
7842 if (dest_val->type->id == TypeTableEntryIdComptimeFloat) {
7842 if (dest_val->type->id == ZigTypeIdComptimeFloat) {
78437843 bigfloat_init_32(&dest_val->data.x_bigfloat, x);
7844 } else if (dest_val->type->id == TypeTableEntryIdFloat) {
7844 } else if (dest_val->type->id == ZigTypeIdFloat) {
78457845 switch (dest_val->type->data.floating.bit_count) {
78467846 case 16:
78477847 dest_val->data.x_f16 = zig_double_to_f16(x);
......@@ -7868,9 +7868,9 @@ static void float_init_f32(ConstExprValue *dest_val, float x) {
78687868}
78697869
78707870static void float_init_f64(ConstExprValue *dest_val, double x) {
7871 if (dest_val->type->id == TypeTableEntryIdComptimeFloat) {
7871 if (dest_val->type->id == ZigTypeIdComptimeFloat) {
78727872 bigfloat_init_64(&dest_val->data.x_bigfloat, x);
7873 } else if (dest_val->type->id == TypeTableEntryIdFloat) {
7873 } else if (dest_val->type->id == ZigTypeIdFloat) {
78747874 switch (dest_val->type->data.floating.bit_count) {
78757875 case 16:
78767876 dest_val->data.x_f16 = zig_double_to_f16(x);
......@@ -7897,9 +7897,9 @@ static void float_init_f64(ConstExprValue *dest_val, double x) {
78977897}
78987898
78997899static void float_init_f128(ConstExprValue *dest_val, float128_t x) {
7900 if (dest_val->type->id == TypeTableEntryIdComptimeFloat) {
7900 if (dest_val->type->id == ZigTypeIdComptimeFloat) {
79017901 bigfloat_init_128(&dest_val->data.x_bigfloat, x);
7902 } else if (dest_val->type->id == TypeTableEntryIdFloat) {
7902 } else if (dest_val->type->id == ZigTypeIdFloat) {
79037903 switch (dest_val->type->data.floating.bit_count) {
79047904 case 16:
79057905 dest_val->data.x_f16 = f128M_to_f16(&x);
......@@ -7930,9 +7930,9 @@ static void float_init_f128(ConstExprValue *dest_val, float128_t x) {
79307930}
79317931
79327932static void float_init_float(ConstExprValue *dest_val, ConstExprValue *src_val) {
7933 if (src_val->type->id == TypeTableEntryIdComptimeFloat) {
7933 if (src_val->type->id == ZigTypeIdComptimeFloat) {
79347934 float_init_bigfloat(dest_val, &src_val->data.x_bigfloat);
7935 } else if (src_val->type->id == TypeTableEntryIdFloat) {
7935 } else if (src_val->type->id == ZigTypeIdFloat) {
79367936 switch (src_val->type->data.floating.bit_count) {
79377937 case 16:
79387938 float_init_f16(dest_val, src_val->data.x_f16);
......@@ -7956,9 +7956,9 @@ static void float_init_float(ConstExprValue *dest_val, ConstExprValue *src_val)
79567956
79577957static Cmp float_cmp(ConstExprValue *op1, ConstExprValue *op2) {
79587958 assert(op1->type == op2->type);
7959 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
7959 if (op1->type->id == ZigTypeIdComptimeFloat) {
79607960 return bigfloat_cmp(&op1->data.x_bigfloat, &op2->data.x_bigfloat);
7961 } else if (op1->type->id == TypeTableEntryIdFloat) {
7961 } else if (op1->type->id == ZigTypeIdFloat) {
79627962 switch (op1->type->data.floating.bit_count) {
79637963 case 16:
79647964 if (f16_lt(op1->data.x_f16, op2->data.x_f16)) {
......@@ -8001,9 +8001,9 @@ static Cmp float_cmp(ConstExprValue *op1, ConstExprValue *op2) {
80018001}
80028002
80038003static Cmp float_cmp_zero(ConstExprValue *op) {
8004 if (op->type->id == TypeTableEntryIdComptimeFloat) {
8004 if (op->type->id == ZigTypeIdComptimeFloat) {
80058005 return bigfloat_cmp_zero(&op->data.x_bigfloat);
8006 } else if (op->type->id == TypeTableEntryIdFloat) {
8006 } else if (op->type->id == ZigTypeIdFloat) {
80078007 switch (op->type->data.floating.bit_count) {
80088008 case 16:
80098009 {
......@@ -8053,9 +8053,9 @@ static Cmp float_cmp_zero(ConstExprValue *op) {
80538053static void float_add(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
80548054 assert(op1->type == op2->type);
80558055 out_val->type = op1->type;
8056 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8056 if (op1->type->id == ZigTypeIdComptimeFloat) {
80578057 bigfloat_add(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8058 } else if (op1->type->id == TypeTableEntryIdFloat) {
8058 } else if (op1->type->id == ZigTypeIdFloat) {
80598059 switch (op1->type->data.floating.bit_count) {
80608060 case 16:
80618061 out_val->data.x_f16 = f16_add(op1->data.x_f16, op2->data.x_f16);
......@@ -8080,9 +8080,9 @@ static void float_add(ConstExprValue *out_val, ConstExprValue *op1, ConstExprVal
80808080static void float_sub(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
80818081 assert(op1->type == op2->type);
80828082 out_val->type = op1->type;
8083 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8083 if (op1->type->id == ZigTypeIdComptimeFloat) {
80848084 bigfloat_sub(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8085 } else if (op1->type->id == TypeTableEntryIdFloat) {
8085 } else if (op1->type->id == ZigTypeIdFloat) {
80868086 switch (op1->type->data.floating.bit_count) {
80878087 case 16:
80888088 out_val->data.x_f16 = f16_sub(op1->data.x_f16, op2->data.x_f16);
......@@ -8107,9 +8107,9 @@ static void float_sub(ConstExprValue *out_val, ConstExprValue *op1, ConstExprVal
81078107static void float_mul(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
81088108 assert(op1->type == op2->type);
81098109 out_val->type = op1->type;
8110 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8110 if (op1->type->id == ZigTypeIdComptimeFloat) {
81118111 bigfloat_mul(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8112 } else if (op1->type->id == TypeTableEntryIdFloat) {
8112 } else if (op1->type->id == ZigTypeIdFloat) {
81138113 switch (op1->type->data.floating.bit_count) {
81148114 case 16:
81158115 out_val->data.x_f16 = f16_mul(op1->data.x_f16, op2->data.x_f16);
......@@ -8134,9 +8134,9 @@ static void float_mul(ConstExprValue *out_val, ConstExprValue *op1, ConstExprVal
81348134static void float_div(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
81358135 assert(op1->type == op2->type);
81368136 out_val->type = op1->type;
8137 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8137 if (op1->type->id == ZigTypeIdComptimeFloat) {
81388138 bigfloat_div(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8139 } else if (op1->type->id == TypeTableEntryIdFloat) {
8139 } else if (op1->type->id == ZigTypeIdFloat) {
81408140 switch (op1->type->data.floating.bit_count) {
81418141 case 16:
81428142 out_val->data.x_f16 = f16_div(op1->data.x_f16, op2->data.x_f16);
......@@ -8161,9 +8161,9 @@ static void float_div(ConstExprValue *out_val, ConstExprValue *op1, ConstExprVal
81618161static void float_div_trunc(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
81628162 assert(op1->type == op2->type);
81638163 out_val->type = op1->type;
8164 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8164 if (op1->type->id == ZigTypeIdComptimeFloat) {
81658165 bigfloat_div_trunc(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8166 } else if (op1->type->id == TypeTableEntryIdFloat) {
8166 } else if (op1->type->id == ZigTypeIdFloat) {
81678167 switch (op1->type->data.floating.bit_count) {
81688168 case 16:
81698169 out_val->data.x_f16 = f16_div(op1->data.x_f16, op2->data.x_f16);
......@@ -8190,9 +8190,9 @@ static void float_div_trunc(ConstExprValue *out_val, ConstExprValue *op1, ConstE
81908190static void float_div_floor(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
81918191 assert(op1->type == op2->type);
81928192 out_val->type = op1->type;
8193 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8193 if (op1->type->id == ZigTypeIdComptimeFloat) {
81948194 bigfloat_div_floor(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8195 } else if (op1->type->id == TypeTableEntryIdFloat) {
8195 } else if (op1->type->id == ZigTypeIdFloat) {
81968196 switch (op1->type->data.floating.bit_count) {
81978197 case 16:
81988198 out_val->data.x_f16 = f16_div(op1->data.x_f16, op2->data.x_f16);
......@@ -8219,9 +8219,9 @@ static void float_div_floor(ConstExprValue *out_val, ConstExprValue *op1, ConstE
82198219static void float_rem(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
82208220 assert(op1->type == op2->type);
82218221 out_val->type = op1->type;
8222 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8222 if (op1->type->id == ZigTypeIdComptimeFloat) {
82238223 bigfloat_rem(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8224 } else if (op1->type->id == TypeTableEntryIdFloat) {
8224 } else if (op1->type->id == ZigTypeIdFloat) {
82258225 switch (op1->type->data.floating.bit_count) {
82268226 case 16:
82278227 out_val->data.x_f16 = f16_rem(op1->data.x_f16, op2->data.x_f16);
......@@ -8264,9 +8264,9 @@ static void zig_f128M_mod(const float128_t* a, const float128_t* b, float128_t*
82648264static void float_mod(ConstExprValue *out_val, ConstExprValue *op1, ConstExprValue *op2) {
82658265 assert(op1->type == op2->type);
82668266 out_val->type = op1->type;
8267 if (op1->type->id == TypeTableEntryIdComptimeFloat) {
8267 if (op1->type->id == ZigTypeIdComptimeFloat) {
82688268 bigfloat_mod(&out_val->data.x_bigfloat, &op1->data.x_bigfloat, &op2->data.x_bigfloat);
8269 } else if (op1->type->id == TypeTableEntryIdFloat) {
8269 } else if (op1->type->id == ZigTypeIdFloat) {
82708270 switch (op1->type->data.floating.bit_count) {
82718271 case 16:
82728272 out_val->data.x_f16 = zig_f16_mod(op1->data.x_f16, op2->data.x_f16);
......@@ -8290,9 +8290,9 @@ static void float_mod(ConstExprValue *out_val, ConstExprValue *op1, ConstExprVal
82908290
82918291static void float_negate(ConstExprValue *out_val, ConstExprValue *op) {
82928292 out_val->type = op->type;
8293 if (op->type->id == TypeTableEntryIdComptimeFloat) {
8293 if (op->type->id == ZigTypeIdComptimeFloat) {
82948294 bigfloat_negate(&out_val->data.x_bigfloat, &op->data.x_bigfloat);
8295 } else if (op->type->id == TypeTableEntryIdFloat) {
8295 } else if (op->type->id == ZigTypeIdFloat) {
82968296 switch (op->type->data.floating.bit_count) {
82978297 case 16:
82988298 {
......@@ -8320,7 +8320,7 @@ static void float_negate(ConstExprValue *out_val, ConstExprValue *op) {
83208320}
83218321
83228322void float_write_ieee597(ConstExprValue *op, uint8_t *buf, bool is_big_endian) {
8323 if (op->type->id == TypeTableEntryIdFloat) {
8323 if (op->type->id == ZigTypeIdFloat) {
83248324 switch (op->type->data.floating.bit_count) {
83258325 case 16:
83268326 memcpy(buf, &op->data.x_f16, 2); // TODO wrong when compiler is big endian
......@@ -8343,7 +8343,7 @@ void float_write_ieee597(ConstExprValue *op, uint8_t *buf, bool is_big_endian) {
83438343}
83448344
83458345void float_read_ieee597(ConstExprValue *val, uint8_t *buf, bool is_big_endian) {
8346 if (val->type->id == TypeTableEntryIdFloat) {
8346 if (val->type->id == ZigTypeIdFloat) {
83478347 switch (val->type->data.floating.bit_count) {
83488348 case 16:
83498349 memcpy(&val->data.x_f16, buf, 2); // TODO wrong when compiler is big endian
......@@ -8375,13 +8375,13 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc
83758375 ConstExprValue *const_val = &instruction->value;
83768376 assert(const_val->special != ConstValSpecialRuntime);
83778377
8378 bool const_val_is_int = (const_val->type->id == TypeTableEntryIdInt ||
8379 const_val->type->id == TypeTableEntryIdComptimeInt);
8380 bool const_val_is_float = (const_val->type->id == TypeTableEntryIdFloat ||
8381 const_val->type->id == TypeTableEntryIdComptimeFloat);
8382 if (other_type->id == TypeTableEntryIdFloat) {
8378 bool const_val_is_int = (const_val->type->id == ZigTypeIdInt ||
8379 const_val->type->id == ZigTypeIdComptimeInt);
8380 bool const_val_is_float = (const_val->type->id == ZigTypeIdFloat ||
8381 const_val->type->id == ZigTypeIdComptimeFloat);
8382 if (other_type->id == ZigTypeIdFloat) {
83838383 return true;
8384 } else if (other_type->id == TypeTableEntryIdInt && const_val_is_int) {
8384 } else if (other_type->id == ZigTypeIdInt && const_val_is_int) {
83858385 if (!other_type->data.integral.is_signed && const_val->data.x_bigint.is_negative) {
83868386 Buf *val_buf = buf_alloc();
83878387 bigint_append_buf(val_buf, &const_val->data.x_bigint, 10);
......@@ -8398,11 +8398,11 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc
83988398 }
83998399 } else if (const_val_fits_in_num_lit(const_val, other_type)) {
84008400 return true;
8401 } else if (other_type->id == TypeTableEntryIdOptional) {
8401 } else if (other_type->id == ZigTypeIdOptional) {
84028402 ZigType *child_type = other_type->data.maybe.child_type;
84038403 if (const_val_fits_in_num_lit(const_val, child_type)) {
84048404 return true;
8405 } else if (child_type->id == TypeTableEntryIdInt && const_val_is_int) {
8405 } else if (child_type->id == ZigTypeIdInt && const_val_is_int) {
84068406 if (!child_type->data.integral.is_signed && const_val->data.x_bigint.is_negative) {
84078407 Buf *val_buf = buf_alloc();
84088408 bigint_append_buf(val_buf, &const_val->data.x_bigint, 10);
......@@ -8418,11 +8418,11 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc
84188418 {
84198419 return true;
84208420 }
8421 } else if (child_type->id == TypeTableEntryIdFloat && const_val_is_float) {
8421 } else if (child_type->id == ZigTypeIdFloat && const_val_is_float) {
84228422 return true;
84238423 }
84248424 }
8425 if (explicit_cast && (other_type->id == TypeTableEntryIdInt || other_type->id == TypeTableEntryIdComptimeInt) &&
8425 if (explicit_cast && (other_type->id == ZigTypeIdInt || other_type->id == ZigTypeIdComptimeInt) &&
84268426 const_val_is_float)
84278427 {
84288428 if (float_has_fraction(const_val)) {
......@@ -8435,7 +8435,7 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc
84358435 buf_ptr(&other_type->name)));
84368436 return false;
84378437 } else {
8438 if (other_type->id == TypeTableEntryIdComptimeInt) {
8438 if (other_type->id == ZigTypeIdComptimeInt) {
84398439 return true;
84408440 } else {
84418441 BigInt bigint;
......@@ -8468,7 +8468,7 @@ static bool ir_num_lit_fits_in_other_type(IrAnalyze *ira, IrInstruction *instruc
84688468}
84698469
84708470static bool is_slice(ZigType *type) {
8471 return type->id == TypeTableEntryIdStruct && type->data.structure.is_slice;
8471 return type->id == ZigTypeIdStruct && type->data.structure.is_slice;
84728472}
84738473
84748474static bool slice_is_const(ZigType *type) {
......@@ -8479,8 +8479,8 @@ static bool slice_is_const(ZigType *type) {
84798479static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigType *set2,
84808480 AstNode *source_node)
84818481{
8482 assert(set1->id == TypeTableEntryIdErrorSet);
8483 assert(set2->id == TypeTableEntryIdErrorSet);
8482 assert(set1->id == ZigTypeIdErrorSet);
8483 assert(set2->id == ZigTypeIdErrorSet);
84848484
84858485 if (!resolve_inferred_error_set(ira->codegen, set1, source_node)) {
84868486 return ira->codegen->builtin_types.entry_invalid;
......@@ -8502,7 +8502,7 @@ static ZigType *get_error_set_intersection(IrAnalyze *ira, ZigType *set1, ZigTyp
85028502 }
85038503 ZigList<ErrorTableEntry *> intersection_list = {};
85048504
8505 ZigType *err_set_type = new_type_table_entry(TypeTableEntryIdErrorSet);
8505 ZigType *err_set_type = new_type_table_entry(ZigTypeIdErrorSet);
85068506 buf_resize(&err_set_type->name, 0);
85078507 buf_appendf(&err_set_type->name, "error{");
85088508
......@@ -8544,9 +8544,9 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
85448544 // *T and [*]T may const-cast-only to ?*U and ?[*]U, respectively
85458545 // but not if we want a mutable pointer
85468546 // and not if the actual pointer has zero bits
8547 if (!wanted_is_mutable && wanted_type->id == TypeTableEntryIdOptional &&
8548 wanted_type->data.maybe.child_type->id == TypeTableEntryIdPointer &&
8549 actual_type->id == TypeTableEntryIdPointer && type_has_bits(actual_type))
8547 if (!wanted_is_mutable && wanted_type->id == ZigTypeIdOptional &&
8548 wanted_type->data.maybe.child_type->id == ZigTypeIdPointer &&
8549 actual_type->id == ZigTypeIdPointer && type_has_bits(actual_type))
85508550 {
85518551 ConstCastOnly child = types_match_const_cast_only(ira,
85528552 wanted_type->data.maybe.child_type, actual_type, source_node, wanted_is_mutable);
......@@ -8559,10 +8559,10 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
85598559 }
85608560
85618561 // *T and [*]T can always cast to *c_void
8562 if (wanted_type->id == TypeTableEntryIdPointer &&
8562 if (wanted_type->id == ZigTypeIdPointer &&
85638563 wanted_type->data.pointer.ptr_len == PtrLenSingle &&
85648564 wanted_type->data.pointer.child_type == g->builtin_types.entry_c_void &&
8565 actual_type->id == TypeTableEntryIdPointer &&
8565 actual_type->id == ZigTypeIdPointer &&
85668566 (!actual_type->data.pointer.is_const || wanted_type->data.pointer.is_const) &&
85678567 (!actual_type->data.pointer.is_volatile || wanted_type->data.pointer.is_volatile))
85688568 {
......@@ -8571,7 +8571,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
85718571 }
85728572
85738573 // pointer const
8574 if (wanted_type->id == TypeTableEntryIdPointer && actual_type->id == TypeTableEntryIdPointer) {
8574 if (wanted_type->id == ZigTypeIdPointer && actual_type->id == ZigTypeIdPointer) {
85758575 ConstCastOnly child = types_match_const_cast_only(ira, wanted_type->data.pointer.child_type,
85768576 actual_type->data.pointer.child_type, source_node, !wanted_type->data.pointer.is_const);
85778577 if (child.id != ConstCastResultIdOk) {
......@@ -8617,7 +8617,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
86178617 }
86188618
86198619 // maybe
8620 if (wanted_type->id == TypeTableEntryIdOptional && actual_type->id == TypeTableEntryIdOptional) {
8620 if (wanted_type->id == ZigTypeIdOptional && actual_type->id == ZigTypeIdOptional) {
86218621 ConstCastOnly child = types_match_const_cast_only(ira, wanted_type->data.maybe.child_type,
86228622 actual_type->data.maybe.child_type, source_node, wanted_is_mutable);
86238623 if (child.id != ConstCastResultIdOk) {
......@@ -8631,7 +8631,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
86318631 }
86328632
86338633 // error union
8634 if (wanted_type->id == TypeTableEntryIdErrorUnion && actual_type->id == TypeTableEntryIdErrorUnion) {
8634 if (wanted_type->id == ZigTypeIdErrorUnion && actual_type->id == ZigTypeIdErrorUnion) {
86358635 ConstCastOnly payload_child = types_match_const_cast_only(ira, wanted_type->data.error_union.payload_type,
86368636 actual_type->data.error_union.payload_type, source_node, wanted_is_mutable);
86378637 if (payload_child.id != ConstCastResultIdOk) {
......@@ -8656,7 +8656,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
86568656 }
86578657
86588658 // error set
8659 if (wanted_type->id == TypeTableEntryIdErrorSet && actual_type->id == TypeTableEntryIdErrorSet) {
8659 if (wanted_type->id == ZigTypeIdErrorSet && actual_type->id == ZigTypeIdErrorSet) {
86608660 ZigType *contained_set = actual_type;
86618661 ZigType *container_set = wanted_type;
86628662
......@@ -8701,14 +8701,14 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
87018701 }
87028702
87038703 if (wanted_type == ira->codegen->builtin_types.entry_promise &&
8704 actual_type->id == TypeTableEntryIdPromise)
8704 actual_type->id == ZigTypeIdPromise)
87058705 {
87068706 return result;
87078707 }
87088708
87098709 // fn
8710 if (wanted_type->id == TypeTableEntryIdFn &&
8711 actual_type->id == TypeTableEntryIdFn)
8710 if (wanted_type->id == ZigTypeIdFn &&
8711 actual_type->id == ZigTypeIdFn)
87128712 {
87138713 if (wanted_type->data.fn.fn_type_id.alignment > actual_type->data.fn.fn_type_id.alignment) {
87148714 result.id = ConstCastResultIdFnAlign;
......@@ -8727,7 +8727,7 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted
87278727 return result;
87288728 }
87298729 if (!wanted_type->data.fn.is_generic &&
8730 actual_type->data.fn.fn_type_id.return_type->id != TypeTableEntryIdUnreachable)
8730 actual_type->data.fn.fn_type_id.return_type->id != ZigTypeIdUnreachable)
87318731 {
87328732 ConstCastOnly child = types_match_const_cast_only(ira, wanted_type->data.fn.fn_type_id.return_type,
87338733 actual_type->data.fn.fn_type_id.return_type, source_node, false);
......@@ -8807,7 +8807,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
88078807 ErrorTableEntry **errors = nullptr;
88088808 size_t errors_count = 0;
88098809 ZigType *err_set_type = nullptr;
8810 if (prev_inst->value.type->id == TypeTableEntryIdErrorSet) {
8810 if (prev_inst->value.type->id == ZigTypeIdErrorSet) {
88118811 if (type_is_global_error_set(prev_inst->value.type)) {
88128812 err_set_type = ira->codegen->builtin_types.entry_global_error_set;
88138813 } else {
......@@ -8825,7 +8825,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
88258825 }
88268826 }
88278827
8828 bool any_are_null = (prev_inst->value.type->id == TypeTableEntryIdNull);
8828 bool any_are_null = (prev_inst->value.type->id == ZigTypeIdNull);
88298829 bool convert_to_const_slice = false;
88308830 for (size_t i = 1; i < instruction_count; i += 1) {
88318831 IrInstruction *cur_inst = instructions[i];
......@@ -8836,18 +8836,18 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
88368836 return cur_type;
88378837 }
88388838
8839 if (prev_type->id == TypeTableEntryIdUnreachable) {
8839 if (prev_type->id == ZigTypeIdUnreachable) {
88408840 prev_inst = cur_inst;
88418841 continue;
88428842 }
88438843
8844 if (cur_type->id == TypeTableEntryIdUnreachable) {
8844 if (cur_type->id == ZigTypeIdUnreachable) {
88458845 continue;
88468846 }
88478847
8848 if (prev_type->id == TypeTableEntryIdErrorSet) {
8848 if (prev_type->id == ZigTypeIdErrorSet) {
88498849 assert(err_set_type != nullptr);
8850 if (cur_type->id == TypeTableEntryIdErrorSet) {
8850 if (cur_type->id == ZigTypeIdErrorSet) {
88518851 if (type_is_global_error_set(err_set_type)) {
88528852 continue;
88538853 }
......@@ -8911,7 +8911,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
89118911 err_set_type = get_error_set_union(ira->codegen, errors, cur_type, err_set_type);
89128912 assert(errors != nullptr);
89138913 continue;
8914 } else if (cur_type->id == TypeTableEntryIdErrorUnion) {
8914 } else if (cur_type->id == ZigTypeIdErrorUnion) {
89158915 if (type_is_global_error_set(err_set_type)) {
89168916 prev_inst = cur_inst;
89178917 continue;
......@@ -8969,8 +8969,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
89698969 }
89708970 }
89718971
8972 if (cur_type->id == TypeTableEntryIdErrorSet) {
8973 if (prev_type->id == TypeTableEntryIdArray) {
8972 if (cur_type->id == ZigTypeIdErrorSet) {
8973 if (prev_type->id == ZigTypeIdArray) {
89748974 convert_to_const_slice = true;
89758975 }
89768976 if (type_is_global_error_set(cur_type)) {
......@@ -8987,7 +8987,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
89878987 update_errors_helper(ira->codegen, &errors, &errors_count);
89888988
89898989 if (err_set_type == nullptr) {
8990 if (prev_type->id == TypeTableEntryIdErrorUnion) {
8990 if (prev_type->id == ZigTypeIdErrorUnion) {
89918991 err_set_type = prev_type->data.error_union.err_set_type;
89928992 } else {
89938993 err_set_type = cur_type;
......@@ -9020,7 +9020,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
90209020 continue;
90219021 }
90229022
9023 if (prev_type->id == TypeTableEntryIdErrorUnion && cur_type->id == TypeTableEntryIdErrorUnion) {
9023 if (prev_type->id == ZigTypeIdErrorUnion && cur_type->id == ZigTypeIdErrorUnion) {
90249024 ZigType *prev_payload_type = prev_type->data.error_union.payload_type;
90259025 ZigType *cur_payload_type = cur_type->data.error_union.payload_type;
90269026
......@@ -9104,12 +9104,12 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
91049104 }
91059105 }
91069106
9107 if (prev_type->id == TypeTableEntryIdNull) {
9107 if (prev_type->id == ZigTypeIdNull) {
91089108 prev_inst = cur_inst;
91099109 continue;
91109110 }
91119111
9112 if (cur_type->id == TypeTableEntryIdNull) {
9112 if (cur_type->id == ZigTypeIdNull) {
91139113 any_are_null = true;
91149114 continue;
91159115 }
......@@ -9123,8 +9123,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
91239123 continue;
91249124 }
91259125
9126 if (prev_type->id == TypeTableEntryIdInt &&
9127 cur_type->id == TypeTableEntryIdInt &&
9126 if (prev_type->id == ZigTypeIdInt &&
9127 cur_type->id == ZigTypeIdInt &&
91289128 prev_type->data.integral.is_signed == cur_type->data.integral.is_signed)
91299129 {
91309130 if (cur_type->data.integral.bit_count > prev_type->data.integral.bit_count) {
......@@ -9133,21 +9133,21 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
91339133 continue;
91349134 }
91359135
9136 if (prev_type->id == TypeTableEntryIdFloat && cur_type->id == TypeTableEntryIdFloat) {
9136 if (prev_type->id == ZigTypeIdFloat && cur_type->id == ZigTypeIdFloat) {
91379137 if (cur_type->data.floating.bit_count > prev_type->data.floating.bit_count) {
91389138 prev_inst = cur_inst;
91399139 }
91409140 continue;
91419141 }
91429142
9143 if (prev_type->id == TypeTableEntryIdErrorUnion &&
9143 if (prev_type->id == ZigTypeIdErrorUnion &&
91449144 types_match_const_cast_only(ira, prev_type->data.error_union.payload_type, cur_type,
91459145 source_node, false).id == ConstCastResultIdOk)
91469146 {
91479147 continue;
91489148 }
91499149
9150 if (cur_type->id == TypeTableEntryIdErrorUnion &&
9150 if (cur_type->id == ZigTypeIdErrorUnion &&
91519151 types_match_const_cast_only(ira, cur_type->data.error_union.payload_type, prev_type,
91529152 source_node, false).id == ConstCastResultIdOk)
91539153 {
......@@ -9170,14 +9170,14 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
91709170 continue;
91719171 }
91729172
9173 if (prev_type->id == TypeTableEntryIdOptional &&
9173 if (prev_type->id == ZigTypeIdOptional &&
91749174 types_match_const_cast_only(ira, prev_type->data.maybe.child_type, cur_type,
91759175 source_node, false).id == ConstCastResultIdOk)
91769176 {
91779177 continue;
91789178 }
91799179
9180 if (cur_type->id == TypeTableEntryIdOptional &&
9180 if (cur_type->id == ZigTypeIdOptional &&
91819181 types_match_const_cast_only(ira, cur_type->data.maybe.child_type, prev_type,
91829182 source_node, false).id == ConstCastResultIdOk)
91839183 {
......@@ -9185,17 +9185,17 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
91859185 continue;
91869186 }
91879187
9188 if (cur_type->id == TypeTableEntryIdUndefined) {
9188 if (cur_type->id == ZigTypeIdUndefined) {
91899189 continue;
91909190 }
91919191
9192 if (prev_type->id == TypeTableEntryIdUndefined) {
9192 if (prev_type->id == ZigTypeIdUndefined) {
91939193 prev_inst = cur_inst;
91949194 continue;
91959195 }
91969196
9197 if (prev_type->id == TypeTableEntryIdComptimeInt ||
9198 prev_type->id == TypeTableEntryIdComptimeFloat)
9197 if (prev_type->id == ZigTypeIdComptimeInt ||
9198 prev_type->id == ZigTypeIdComptimeFloat)
91999199 {
92009200 if (ir_num_lit_fits_in_other_type(ira, prev_inst, cur_type, false)) {
92019201 prev_inst = cur_inst;
......@@ -9205,8 +9205,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92059205 }
92069206 }
92079207
9208 if (cur_type->id == TypeTableEntryIdComptimeInt ||
9209 cur_type->id == TypeTableEntryIdComptimeFloat)
9208 if (cur_type->id == ZigTypeIdComptimeInt ||
9209 cur_type->id == ZigTypeIdComptimeFloat)
92109210 {
92119211 if (ir_num_lit_fits_in_other_type(ira, cur_inst, prev_type, false)) {
92129212 continue;
......@@ -9215,7 +9215,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92159215 }
92169216 }
92179217
9218 if (cur_type->id == TypeTableEntryIdArray && prev_type->id == TypeTableEntryIdArray &&
9218 if (cur_type->id == ZigTypeIdArray && prev_type->id == ZigTypeIdArray &&
92199219 cur_type->data.array.len != prev_type->data.array.len &&
92209220 types_match_const_cast_only(ira, cur_type->data.array.child_type, prev_type->data.array.child_type,
92219221 source_node, false).id == ConstCastResultIdOk)
......@@ -9225,7 +9225,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92259225 continue;
92269226 }
92279227
9228 if (cur_type->id == TypeTableEntryIdArray && prev_type->id == TypeTableEntryIdArray &&
9228 if (cur_type->id == ZigTypeIdArray && prev_type->id == ZigTypeIdArray &&
92299229 cur_type->data.array.len != prev_type->data.array.len &&
92309230 types_match_const_cast_only(ira, prev_type->data.array.child_type, cur_type->data.array.child_type,
92319231 source_node, false).id == ConstCastResultIdOk)
......@@ -9234,7 +9234,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92349234 continue;
92359235 }
92369236
9237 if (cur_type->id == TypeTableEntryIdArray && is_slice(prev_type) &&
9237 if (cur_type->id == ZigTypeIdArray && is_slice(prev_type) &&
92389238 (prev_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const ||
92399239 cur_type->data.array.len == 0) &&
92409240 types_match_const_cast_only(ira,
......@@ -9245,7 +9245,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92459245 continue;
92469246 }
92479247
9248 if (prev_type->id == TypeTableEntryIdArray && is_slice(cur_type) &&
9248 if (prev_type->id == ZigTypeIdArray && is_slice(cur_type) &&
92499249 (cur_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const ||
92509250 prev_type->data.array.len == 0) &&
92519251 types_match_const_cast_only(ira,
......@@ -9257,7 +9257,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92579257 continue;
92589258 }
92599259
9260 if (prev_type->id == TypeTableEntryIdEnum && cur_type->id == TypeTableEntryIdUnion &&
9260 if (prev_type->id == ZigTypeIdEnum && cur_type->id == ZigTypeIdUnion &&
92619261 (cur_type->data.unionation.decl_node->data.container_decl.auto_enum || cur_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr))
92629262 {
92639263 if ((err = type_ensure_zero_bits_known(ira->codegen, cur_type)))
......@@ -9267,7 +9267,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92679267 }
92689268 }
92699269
9270 if (cur_type->id == TypeTableEntryIdEnum && prev_type->id == TypeTableEntryIdUnion &&
9270 if (cur_type->id == ZigTypeIdEnum && prev_type->id == ZigTypeIdUnion &&
92719271 (prev_type->data.unionation.decl_node->data.container_decl.auto_enum || prev_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr))
92729272 {
92739273 if ((err = type_ensure_zero_bits_known(ira->codegen, prev_type)))
......@@ -9292,7 +9292,7 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
92929292 free(errors);
92939293
92949294 if (convert_to_const_slice) {
9295 assert(prev_inst->value.type->id == TypeTableEntryIdArray);
9295 assert(prev_inst->value.type->id == ZigTypeIdArray);
92969296 ZigType *ptr_type = get_pointer_to_type_extra(
92979297 ira->codegen, prev_inst->value.type->data.array.child_type,
92989298 true, false, PtrLenUnknown,
......@@ -9305,20 +9305,20 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
93059305 return slice_type;
93069306 }
93079307 } else if (err_set_type != nullptr) {
9308 if (prev_inst->value.type->id == TypeTableEntryIdErrorSet) {
9308 if (prev_inst->value.type->id == ZigTypeIdErrorSet) {
93099309 return err_set_type;
9310 } else if (prev_inst->value.type->id == TypeTableEntryIdErrorUnion) {
9310 } else if (prev_inst->value.type->id == ZigTypeIdErrorUnion) {
93119311 return get_error_union_type(ira->codegen, err_set_type, prev_inst->value.type->data.error_union.payload_type);
9312 } else if (expected_type != nullptr && expected_type->id == TypeTableEntryIdErrorUnion) {
9312 } else if (expected_type != nullptr && expected_type->id == ZigTypeIdErrorUnion) {
93139313 return get_error_union_type(ira->codegen, err_set_type, expected_type->data.error_union.payload_type);
93149314 } else {
9315 if (prev_inst->value.type->id == TypeTableEntryIdComptimeInt ||
9316 prev_inst->value.type->id == TypeTableEntryIdComptimeFloat)
9315 if (prev_inst->value.type->id == ZigTypeIdComptimeInt ||
9316 prev_inst->value.type->id == ZigTypeIdComptimeFloat)
93179317 {
93189318 ir_add_error_node(ira, source_node,
93199319 buf_sprintf("unable to make error union out of number literal"));
93209320 return ira->codegen->builtin_types.entry_invalid;
9321 } else if (prev_inst->value.type->id == TypeTableEntryIdNull) {
9321 } else if (prev_inst->value.type->id == ZigTypeIdNull) {
93229322 ir_add_error_node(ira, source_node,
93239323 buf_sprintf("unable to make error union out of null literal"));
93249324 return ira->codegen->builtin_types.entry_invalid;
......@@ -9326,14 +9326,14 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT
93269326 return get_error_union_type(ira->codegen, err_set_type, prev_inst->value.type);
93279327 }
93289328 }
9329 } else if (any_are_null && prev_inst->value.type->id != TypeTableEntryIdNull) {
9330 if (prev_inst->value.type->id == TypeTableEntryIdComptimeInt ||
9331 prev_inst->value.type->id == TypeTableEntryIdComptimeFloat)
9329 } else if (any_are_null && prev_inst->value.type->id != ZigTypeIdNull) {
9330 if (prev_inst->value.type->id == ZigTypeIdComptimeInt ||
9331 prev_inst->value.type->id == ZigTypeIdComptimeFloat)
93329332 {
93339333 ir_add_error_node(ira, source_node,
93349334 buf_sprintf("unable to make maybe out of number literal"));
93359335 return ira->codegen->builtin_types.entry_invalid;
9336 } else if (prev_inst->value.type->id == TypeTableEntryIdOptional) {
9336 } else if (prev_inst->value.type->id == ZigTypeIdOptional) {
93379337 return prev_inst->value.type;
93389338 } else {
93399339 return get_optional_type(ira->codegen, prev_inst->value.type);
......@@ -9357,7 +9357,7 @@ static void copy_const_val(ConstExprValue *dest, ConstExprValue *src, bool same_
93579357 *dest = *src;
93589358 if (!same_global_refs) {
93599359 dest->global_refs = global_refs;
9360 if (dest->type->id == TypeTableEntryIdStruct) {
9360 if (dest->type->id == ZigTypeIdStruct) {
93619361 dest->data.x_struct.fields = allocate_nonzero<ConstExprValue>(dest->type->data.structure.src_field_count);
93629362 memcpy(dest->data.x_struct.fields, src->data.x_struct.fields, sizeof(ConstExprValue) * dest->type->data.structure.src_field_count);
93639363 }
......@@ -9387,8 +9387,8 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_
93879387 break;
93889388 }
93899389 case CastOpNumLitToConcrete:
9390 if (other_val->type->id == TypeTableEntryIdComptimeFloat) {
9391 assert(new_type->id == TypeTableEntryIdFloat);
9390 if (other_val->type->id == ZigTypeIdComptimeFloat) {
9391 assert(new_type->id == ZigTypeIdFloat);
93929392 switch (new_type->data.floating.bit_count) {
93939393 case 16:
93949394 const_val->data.x_f16 = bigfloat_to_f16(&other_val->data.x_bigfloat);
......@@ -9405,7 +9405,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_
94059405 default:
94069406 zig_unreachable();
94079407 }
9408 } else if (other_val->type->id == TypeTableEntryIdComptimeInt) {
9408 } else if (other_val->type->id == ZigTypeIdComptimeInt) {
94099409 bigint_init_bigint(&const_val->data.x_bigint, &other_val->data.x_bigint);
94109410 } else {
94119411 zig_unreachable();
......@@ -9418,7 +9418,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_
94189418 zig_unreachable();
94199419 case CastOpIntToFloat:
94209420 {
9421 assert(new_type->id == TypeTableEntryIdFloat);
9421 assert(new_type->id == ZigTypeIdFloat);
94229422
94239423 BigFloat bigfloat;
94249424 bigfloat_init_bigint(&bigfloat, &other_val->data.x_bigint);
......@@ -9443,7 +9443,7 @@ static bool eval_const_expr_implicit_cast(IrAnalyze *ira, IrInstruction *source_
94439443 }
94449444 case CastOpFloatToInt:
94459445 float_init_bigint(&const_val->data.x_bigint, other_val);
9446 if (new_type->id == TypeTableEntryIdInt) {
9446 if (new_type->id == ZigTypeIdInt) {
94479447 if (!bigint_fits_in_bits(&const_val->data.x_bigint, new_type->data.integral.bit_count,
94489448 new_type->data.integral.is_signed))
94499449 {
......@@ -9493,7 +9493,7 @@ static IrInstruction *ir_resolve_cast(IrAnalyze *ira, IrInstruction *source_inst
94939493static IrInstruction *ir_resolve_ptr_of_array_to_unknown_len_ptr(IrAnalyze *ira, IrInstruction *source_instr,
94949494 IrInstruction *value, ZigType *wanted_type)
94959495{
9496 assert(value->value.type->id == TypeTableEntryIdPointer);
9496 assert(value->value.type->id == ZigTypeIdPointer);
94979497 wanted_type = adjust_ptr_align(ira->codegen, wanted_type, value->value.type->data.pointer.alignment);
94989498
94999499 if (instr_is_comptime(value)) {
......@@ -9529,7 +9529,7 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc
95299529 if (pointee == nullptr)
95309530 return ira->codegen->invalid_instruction;
95319531 if (pointee->special != ConstValSpecialRuntime) {
9532 assert(value->value.type->id == TypeTableEntryIdPointer);
9532 assert(value->value.type->id == ZigTypeIdPointer);
95339533 ZigType *array_type = value->value.type->data.pointer.child_type;
95349534 assert(is_slice(wanted_type));
95359535 bool is_const = wanted_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const;
......@@ -9552,9 +9552,9 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc
95529552}
95539553
95549554static bool is_container(ZigType *type) {
9555 return type->id == TypeTableEntryIdStruct ||
9556 type->id == TypeTableEntryIdEnum ||
9557 type->id == TypeTableEntryIdUnion;
9555 return type->id == ZigTypeIdStruct ||
9556 type->id == ZigTypeIdEnum ||
9557 type->id == ZigTypeIdUnion;
95589558}
95599559
95609560static IrBasicBlock *ir_get_new_bb(IrAnalyze *ira, IrBasicBlock *old_bb, IrInstruction *ref_old_instruction) {
......@@ -9665,7 +9665,7 @@ static ZigType *ir_inline_bb(IrAnalyze *ira, IrInstruction *source_instruction,
96659665}
96669666
96679667static ZigType *ir_finish_anal(IrAnalyze *ira, ZigType *result_type) {
9668 if (result_type->id == TypeTableEntryIdUnreachable)
9668 if (result_type->id == ZigTypeIdUnreachable)
96699669 ir_finish_bb(ira);
96709670 return result_type;
96719671}
......@@ -9803,7 +9803,7 @@ static ZigType *ir_resolve_type(IrAnalyze *ira, IrInstruction *type_value) {
98039803 if (type_is_invalid(type_value->value.type))
98049804 return ira->codegen->builtin_types.entry_invalid;
98059805
9806 if (type_value->value.type->id != TypeTableEntryIdMetaType) {
9806 if (type_value->value.type->id != ZigTypeIdMetaType) {
98079807 ir_add_error(ira, type_value,
98089808 buf_sprintf("expected type 'type', found '%s'", buf_ptr(&type_value->value.type->name)));
98099809 return ira->codegen->builtin_types.entry_invalid;
......@@ -9823,7 +9823,7 @@ static ZigFn *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) {
98239823 if (type_is_invalid(fn_value->value.type))
98249824 return nullptr;
98259825
9826 if (fn_value->value.type->id != TypeTableEntryIdFn) {
9826 if (fn_value->value.type->id != ZigTypeIdFn) {
98279827 ir_add_error_node(ira, fn_value->source_node,
98289828 buf_sprintf("expected function type, found '%s'", buf_ptr(&fn_value->value.type->name)));
98299829 return nullptr;
......@@ -9838,7 +9838,7 @@ static ZigFn *ir_resolve_fn(IrAnalyze *ira, IrInstruction *fn_value) {
98389838}
98399839
98409840static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) {
9841 assert(wanted_type->id == TypeTableEntryIdOptional);
9841 assert(wanted_type->id == ZigTypeIdOptional);
98429842
98439843 if (instr_is_comptime(value)) {
98449844 ZigType *payload_type = wanted_type->data.maybe.child_type;
......@@ -9872,7 +9872,7 @@ static IrInstruction *ir_analyze_maybe_wrap(IrAnalyze *ira, IrInstruction *sourc
98729872static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction *source_instr,
98739873 IrInstruction *value, ZigType *wanted_type)
98749874{
9875 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
9875 assert(wanted_type->id == ZigTypeIdErrorUnion);
98769876
98779877 if (instr_is_comptime(value)) {
98789878 ZigType *payload_type = wanted_type->data.error_union.payload_type;
......@@ -9903,8 +9903,8 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction
99039903static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value,
99049904 ZigType *wanted_type)
99059905{
9906 assert(value->value.type->id == TypeTableEntryIdErrorSet);
9907 assert(wanted_type->id == TypeTableEntryIdErrorSet);
9906 assert(value->value.type->id == ZigTypeIdErrorSet);
9907 assert(wanted_type->id == ZigTypeIdErrorSet);
99089908
99099909 if (instr_is_comptime(value)) {
99109910 ConstExprValue *val = ir_resolve_const(ira, value, UndefBad);
......@@ -9944,7 +9944,7 @@ static IrInstruction *ir_analyze_err_set_cast(IrAnalyze *ira, IrInstruction *sou
99449944}
99459945
99469946static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) {
9947 assert(wanted_type->id == TypeTableEntryIdErrorUnion);
9947 assert(wanted_type->id == ZigTypeIdErrorUnion);
99489948
99499949 IrInstruction *casted_value = ir_implicit_cast(ira, value, wanted_type->data.error_union.err_set_type);
99509950
......@@ -10006,7 +10006,7 @@ static IrInstruction *ir_analyze_cast_ref(IrAnalyze *ira, IrInstruction *source_
1000610006}
1000710007
1000810008static IrInstruction *ir_analyze_null_to_maybe(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *value, ZigType *wanted_type) {
10009 assert(wanted_type->id == TypeTableEntryIdOptional);
10009 assert(wanted_type->id == ZigTypeIdOptional);
1001010010 assert(instr_is_comptime(value));
1001110011
1001210012 ConstExprValue *val = ir_resolve_const(ira, value, UndefBad);
......@@ -10062,14 +10062,14 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s
1006210062
1006310063 IrInstruction *array_ptr = nullptr;
1006410064 IrInstruction *array;
10065 if (array_arg->value.type->id == TypeTableEntryIdPointer) {
10065 if (array_arg->value.type->id == ZigTypeIdPointer) {
1006610066 array = ir_get_deref(ira, source_instr, array_arg);
1006710067 array_ptr = array_arg;
1006810068 } else {
1006910069 array = array_arg;
1007010070 }
1007110071 ZigType *array_type = array->value.type;
10072 assert(array_type->id == TypeTableEntryIdArray);
10072 assert(array_type->id == ZigTypeIdArray);
1007310073
1007410074 if (instr_is_comptime(array)) {
1007510075 IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope,
......@@ -10103,7 +10103,7 @@ static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *sour
1010310103 IrInstruction *target, ZigType *wanted_type)
1010410104{
1010510105 Error err;
10106 assert(wanted_type->id == TypeTableEntryIdInt);
10106 assert(wanted_type->id == ZigTypeIdInt);
1010710107
1010810108 ZigType *actual_type = target->value.type;
1010910109 if ((err = ensure_complete_type(ira->codegen, actual_type)))
......@@ -10117,7 +10117,7 @@ static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *sour
1011710117 return ira->codegen->invalid_instruction;
1011810118 }
1011910119
10120 assert(actual_type->id == TypeTableEntryIdEnum);
10120 assert(actual_type->id == ZigTypeIdEnum);
1012110121
1012210122 if (instr_is_comptime(target)) {
1012310123 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
......@@ -10138,8 +10138,8 @@ static IrInstruction *ir_analyze_enum_to_int(IrAnalyze *ira, IrInstruction *sour
1013810138static IrInstruction *ir_analyze_union_to_tag(IrAnalyze *ira, IrInstruction *source_instr,
1013910139 IrInstruction *target, ZigType *wanted_type)
1014010140{
10141 assert(target->value.type->id == TypeTableEntryIdUnion);
10142 assert(wanted_type->id == TypeTableEntryIdEnum);
10141 assert(target->value.type->id == ZigTypeIdUnion);
10142 assert(wanted_type->id == ZigTypeIdEnum);
1014310143 assert(wanted_type == target->value.type->data.unionation.tag_type);
1014410144
1014510145 if (instr_is_comptime(target)) {
......@@ -10173,8 +10173,8 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so
1017310173 IrInstruction *target, ZigType *wanted_type)
1017410174{
1017510175 Error err;
10176 assert(wanted_type->id == TypeTableEntryIdUnion);
10177 assert(target->value.type->id == TypeTableEntryIdEnum);
10176 assert(wanted_type->id == ZigTypeIdUnion);
10177 assert(target->value.type->id == ZigTypeIdEnum);
1017810178
1017910179 if (instr_is_comptime(target)) {
1018010180 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
......@@ -10231,13 +10231,13 @@ static IrInstruction *ir_analyze_enum_to_union(IrAnalyze *ira, IrInstruction *so
1023110231static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction *source_instr,
1023210232 IrInstruction *target, ZigType *wanted_type)
1023310233{
10234 assert(wanted_type->id == TypeTableEntryIdInt || wanted_type->id == TypeTableEntryIdFloat);
10234 assert(wanted_type->id == ZigTypeIdInt || wanted_type->id == ZigTypeIdFloat);
1023510235
1023610236 if (instr_is_comptime(target)) {
1023710237 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
1023810238 if (!val)
1023910239 return ira->codegen->invalid_instruction;
10240 if (wanted_type->id == TypeTableEntryIdInt) {
10240 if (wanted_type->id == ZigTypeIdInt) {
1024110241 if (bigint_cmp_zero(&val->data.x_bigint) == CmpLT && !wanted_type->data.integral.is_signed) {
1024210242 ir_add_error(ira, source_instr,
1024310243 buf_sprintf("attempt to cast negative value to unsigned integer"));
......@@ -10255,7 +10255,7 @@ static IrInstruction *ir_analyze_widen_or_shorten(IrAnalyze *ira, IrInstruction
1025510255 IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope,
1025610256 source_instr->source_node, wanted_type);
1025710257 result->value.type = wanted_type;
10258 if (wanted_type->id == TypeTableEntryIdInt) {
10258 if (wanted_type->id == ZigTypeIdInt) {
1025910259 bigint_init_bigint(&result->value.data.x_bigint, &val->data.x_bigint);
1026010260 } else {
1026110261 float_init_float(&result->value, val);
......@@ -10273,7 +10273,7 @@ static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *sour
1027310273 IrInstruction *target, ZigType *wanted_type)
1027410274{
1027510275 Error err;
10276 assert(wanted_type->id == TypeTableEntryIdEnum);
10276 assert(wanted_type->id == ZigTypeIdEnum);
1027710277
1027810278 ZigType *actual_type = target->value.type;
1027910279
......@@ -10288,7 +10288,7 @@ static IrInstruction *ir_analyze_int_to_enum(IrAnalyze *ira, IrInstruction *sour
1028810288 return ira->codegen->invalid_instruction;
1028910289 }
1029010290
10291 assert(actual_type->id == TypeTableEntryIdInt);
10291 assert(actual_type->id == ZigTypeIdInt);
1029210292
1029310293 if (instr_is_comptime(target)) {
1029410294 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
......@@ -10328,9 +10328,9 @@ static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction
1032810328
1032910329 IrInstruction *result = ir_create_const(&ira->new_irb, source_instr->scope,
1033010330 source_instr->source_node, wanted_type);
10331 if (wanted_type->id == TypeTableEntryIdComptimeFloat) {
10331 if (wanted_type->id == ZigTypeIdComptimeFloat) {
1033210332 float_init_float(&result->value, val);
10333 } else if (wanted_type->id == TypeTableEntryIdComptimeInt) {
10333 } else if (wanted_type->id == ZigTypeIdComptimeInt) {
1033410334 bigint_init_bigint(&result->value.data.x_bigint, &val->data.x_bigint);
1033510335 } else {
1033610336 zig_unreachable();
......@@ -10341,9 +10341,9 @@ static IrInstruction *ir_analyze_number_to_literal(IrAnalyze *ira, IrInstruction
1034110341static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
1034210342 ZigType *wanted_type)
1034310343{
10344 assert(target->value.type->id == TypeTableEntryIdInt);
10344 assert(target->value.type->id == ZigTypeIdInt);
1034510345 assert(!target->value.type->data.integral.is_signed);
10346 assert(wanted_type->id == TypeTableEntryIdErrorSet);
10346 assert(wanted_type->id == ZigTypeIdErrorSet);
1034710347
1034810348 if (instr_is_comptime(target)) {
1034910349 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
......@@ -10406,7 +10406,7 @@ static IrInstruction *ir_analyze_int_to_err(IrAnalyze *ira, IrInstruction *sourc
1040610406static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
1040710407 ZigType *wanted_type)
1040810408{
10409 assert(wanted_type->id == TypeTableEntryIdInt);
10409 assert(wanted_type->id == ZigTypeIdInt);
1041010410
1041110411 ZigType *err_type = target->value.type;
1041210412
......@@ -10419,9 +10419,9 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc
1041910419 source_instr->source_node, wanted_type);
1042010420
1042110421 ErrorTableEntry *err;
10422 if (err_type->id == TypeTableEntryIdErrorUnion) {
10422 if (err_type->id == ZigTypeIdErrorUnion) {
1042310423 err = val->data.x_err_union.err;
10424 } else if (err_type->id == TypeTableEntryIdErrorSet) {
10424 } else if (err_type->id == ZigTypeIdErrorSet) {
1042510425 err = val->data.x_err_set;
1042610426 } else {
1042710427 zig_unreachable();
......@@ -10443,9 +10443,9 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc
1044310443 }
1044410444
1044510445 ZigType *err_set_type;
10446 if (err_type->id == TypeTableEntryIdErrorUnion) {
10446 if (err_type->id == ZigTypeIdErrorUnion) {
1044710447 err_set_type = err_type->data.error_union.err_set_type;
10448 } else if (err_type->id == TypeTableEntryIdErrorSet) {
10448 } else if (err_type->id == ZigTypeIdErrorSet) {
1044910449 err_set_type = err_type;
1045010450 } else {
1045110451 zig_unreachable();
......@@ -10486,10 +10486,10 @@ static IrInstruction *ir_analyze_err_to_int(IrAnalyze *ira, IrInstruction *sourc
1048610486static IrInstruction *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInstruction *source_instr, IrInstruction *target,
1048710487 ZigType *wanted_type)
1048810488{
10489 assert(wanted_type->id == TypeTableEntryIdPointer);
10489 assert(wanted_type->id == ZigTypeIdPointer);
1049010490 wanted_type = adjust_ptr_align(ira->codegen, wanted_type, target->value.type->data.pointer.alignment);
1049110491 ZigType *array_type = wanted_type->data.pointer.child_type;
10492 assert(array_type->id == TypeTableEntryIdArray);
10492 assert(array_type->id == ZigTypeIdArray);
1049310493 assert(array_type->data.array.len == 1);
1049410494
1049510495 if (instr_is_comptime(target)) {
......@@ -10497,7 +10497,7 @@ static IrInstruction *ir_analyze_ptr_to_array(IrAnalyze *ira, IrInstruction *sou
1049710497 if (!val)
1049810498 return ira->codegen->invalid_instruction;
1049910499
10500 assert(val->type->id == TypeTableEntryIdPointer);
10500 assert(val->type->id == ZigTypeIdPointer);
1050110501 ConstExprValue *pointee = ir_const_ptr_pointee(ira, val, source_instr->source_node);
1050210502 if (pointee == nullptr)
1050310503 return ira->codegen->invalid_instruction;
......@@ -10638,8 +10638,8 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1063810638 }
1063910639
1064010640 // widening conversion
10641 if (wanted_type->id == TypeTableEntryIdInt &&
10642 actual_type->id == TypeTableEntryIdInt &&
10641 if (wanted_type->id == ZigTypeIdInt &&
10642 actual_type->id == ZigTypeIdInt &&
1064310643 wanted_type->data.integral.is_signed == actual_type->data.integral.is_signed &&
1064410644 wanted_type->data.integral.bit_count >= actual_type->data.integral.bit_count)
1064510645 {
......@@ -10647,16 +10647,16 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1064710647 }
1064810648
1064910649 // small enough unsigned ints can get casted to large enough signed ints
10650 if (wanted_type->id == TypeTableEntryIdInt && wanted_type->data.integral.is_signed &&
10651 actual_type->id == TypeTableEntryIdInt && !actual_type->data.integral.is_signed &&
10650 if (wanted_type->id == ZigTypeIdInt && wanted_type->data.integral.is_signed &&
10651 actual_type->id == ZigTypeIdInt && !actual_type->data.integral.is_signed &&
1065210652 wanted_type->data.integral.bit_count > actual_type->data.integral.bit_count)
1065310653 {
1065410654 return ir_analyze_widen_or_shorten(ira, source_instr, value, wanted_type);
1065510655 }
1065610656
1065710657 // float widening conversion
10658 if (wanted_type->id == TypeTableEntryIdFloat &&
10659 actual_type->id == TypeTableEntryIdFloat &&
10658 if (wanted_type->id == ZigTypeIdFloat &&
10659 actual_type->id == ZigTypeIdFloat &&
1066010660 wanted_type->data.floating.bit_count >= actual_type->data.floating.bit_count)
1066110661 {
1066210662 return ir_analyze_widen_or_shorten(ira, source_instr, value, wanted_type);
......@@ -10664,9 +10664,9 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1066410664
1066510665
1066610666 // cast from [N]T to []const T
10667 if (is_slice(wanted_type) && actual_type->id == TypeTableEntryIdArray) {
10667 if (is_slice(wanted_type) && actual_type->id == ZigTypeIdArray) {
1066810668 ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
10669 assert(ptr_type->id == TypeTableEntryIdPointer);
10669 assert(ptr_type->id == ZigTypeIdPointer);
1067010670 if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) &&
1067110671 types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type,
1067210672 source_node, false).id == ConstCastResultIdOk)
......@@ -10677,12 +10677,12 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1067710677
1067810678 // cast from *const [N]T to []const T
1067910679 if (is_slice(wanted_type) &&
10680 actual_type->id == TypeTableEntryIdPointer &&
10680 actual_type->id == ZigTypeIdPointer &&
1068110681 actual_type->data.pointer.is_const &&
10682 actual_type->data.pointer.child_type->id == TypeTableEntryIdArray)
10682 actual_type->data.pointer.child_type->id == ZigTypeIdArray)
1068310683 {
1068410684 ZigType *ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
10685 assert(ptr_type->id == TypeTableEntryIdPointer);
10685 assert(ptr_type->id == ZigTypeIdPointer);
1068610686
1068710687 ZigType *array_type = actual_type->data.pointer.child_type;
1068810688
......@@ -10695,14 +10695,14 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1069510695 }
1069610696
1069710697 // cast from [N]T to *const []const T
10698 if (wanted_type->id == TypeTableEntryIdPointer &&
10698 if (wanted_type->id == ZigTypeIdPointer &&
1069910699 wanted_type->data.pointer.is_const &&
1070010700 is_slice(wanted_type->data.pointer.child_type) &&
10701 actual_type->id == TypeTableEntryIdArray)
10701 actual_type->id == ZigTypeIdArray)
1070210702 {
1070310703 ZigType *ptr_type =
1070410704 wanted_type->data.pointer.child_type->data.structure.fields[slice_ptr_index].type_entry;
10705 assert(ptr_type->id == TypeTableEntryIdPointer);
10705 assert(ptr_type->id == ZigTypeIdPointer);
1070610706 if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) &&
1070710707 types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type,
1070810708 source_node, false).id == ConstCastResultIdOk)
......@@ -10720,13 +10720,13 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1072010720 }
1072110721
1072210722 // cast from [N]T to ?[]const T
10723 if (wanted_type->id == TypeTableEntryIdOptional &&
10723 if (wanted_type->id == ZigTypeIdOptional &&
1072410724 is_slice(wanted_type->data.maybe.child_type) &&
10725 actual_type->id == TypeTableEntryIdArray)
10725 actual_type->id == ZigTypeIdArray)
1072610726 {
1072710727 ZigType *ptr_type =
1072810728 wanted_type->data.maybe.child_type->data.structure.fields[slice_ptr_index].type_entry;
10729 assert(ptr_type->id == TypeTableEntryIdPointer);
10729 assert(ptr_type->id == ZigTypeIdPointer);
1073010730 if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) &&
1073110731 types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type,
1073210732 source_node, false).id == ConstCastResultIdOk)
......@@ -10744,11 +10744,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1074410744 }
1074510745
1074610746 // *[N]T to [*]T
10747 if (wanted_type->id == TypeTableEntryIdPointer &&
10747 if (wanted_type->id == ZigTypeIdPointer &&
1074810748 wanted_type->data.pointer.ptr_len == PtrLenUnknown &&
10749 actual_type->id == TypeTableEntryIdPointer &&
10749 actual_type->id == ZigTypeIdPointer &&
1075010750 actual_type->data.pointer.ptr_len == PtrLenSingle &&
10751 actual_type->data.pointer.child_type->id == TypeTableEntryIdArray &&
10751 actual_type->data.pointer.child_type->id == ZigTypeIdArray &&
1075210752 actual_type->data.pointer.alignment >= wanted_type->data.pointer.alignment &&
1075310753 types_match_const_cast_only(ira, wanted_type->data.pointer.child_type,
1075410754 actual_type->data.pointer.child_type->data.array.child_type, source_node,
......@@ -10759,12 +10759,12 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1075910759
1076010760 // *[N]T to []T
1076110761 if (is_slice(wanted_type) &&
10762 actual_type->id == TypeTableEntryIdPointer &&
10762 actual_type->id == ZigTypeIdPointer &&
1076310763 actual_type->data.pointer.ptr_len == PtrLenSingle &&
10764 actual_type->data.pointer.child_type->id == TypeTableEntryIdArray)
10764 actual_type->data.pointer.child_type->id == ZigTypeIdArray)
1076510765 {
1076610766 ZigType *slice_ptr_type = wanted_type->data.structure.fields[slice_ptr_index].type_entry;
10767 assert(slice_ptr_type->id == TypeTableEntryIdPointer);
10767 assert(slice_ptr_type->id == ZigTypeIdPointer);
1076810768 if (types_match_const_cast_only(ira, slice_ptr_type->data.pointer.child_type,
1076910769 actual_type->data.pointer.child_type->data.array.child_type, source_node,
1077010770 !slice_ptr_type->data.pointer.is_const).id == ConstCastResultIdOk)
......@@ -10776,23 +10776,23 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1077610776
1077710777 // cast from T to ?T
1077810778 // note that the *T to ?*T case is handled via the "ConstCastOnly" mechanism
10779 if (wanted_type->id == TypeTableEntryIdOptional) {
10779 if (wanted_type->id == ZigTypeIdOptional) {
1078010780 ZigType *wanted_child_type = wanted_type->data.maybe.child_type;
1078110781 if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node,
1078210782 false).id == ConstCastResultIdOk)
1078310783 {
1078410784 return ir_analyze_maybe_wrap(ira, source_instr, value, wanted_type);
10785 } else if (actual_type->id == TypeTableEntryIdComptimeInt ||
10786 actual_type->id == TypeTableEntryIdComptimeFloat)
10785 } else if (actual_type->id == ZigTypeIdComptimeInt ||
10786 actual_type->id == ZigTypeIdComptimeFloat)
1078710787 {
1078810788 if (ir_num_lit_fits_in_other_type(ira, value, wanted_child_type, true)) {
1078910789 return ir_analyze_maybe_wrap(ira, source_instr, value, wanted_type);
1079010790 } else {
1079110791 return ira->codegen->invalid_instruction;
1079210792 }
10793 } else if (wanted_child_type->id == TypeTableEntryIdPointer &&
10793 } else if (wanted_child_type->id == ZigTypeIdPointer &&
1079410794 wanted_child_type->data.pointer.is_const &&
10795 (actual_type->id == TypeTableEntryIdPointer || is_container(actual_type)))
10795 (actual_type->id == ZigTypeIdPointer || is_container(actual_type)))
1079610796 {
1079710797 IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_child_type, value);
1079810798 if (type_is_invalid(cast1->value.type))
......@@ -10804,11 +10804,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1080410804
1080510805 return cast2;
1080610806 } else if (
10807 wanted_child_type->id == TypeTableEntryIdPointer &&
10807 wanted_child_type->id == ZigTypeIdPointer &&
1080810808 wanted_child_type->data.pointer.ptr_len == PtrLenUnknown &&
10809 actual_type->id == TypeTableEntryIdPointer &&
10809 actual_type->id == ZigTypeIdPointer &&
1081010810 actual_type->data.pointer.ptr_len == PtrLenSingle &&
10811 actual_type->data.pointer.child_type->id == TypeTableEntryIdArray &&
10811 actual_type->data.pointer.child_type->id == ZigTypeIdArray &&
1081210812 actual_type->data.pointer.alignment >= wanted_child_type->data.pointer.alignment &&
1081310813 types_match_const_cast_only(ira, wanted_child_type->data.pointer.child_type,
1081410814 actual_type->data.pointer.child_type->data.array.child_type, source_node,
......@@ -10822,20 +10822,20 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1082210822 }
1082310823
1082410824 // cast from null literal to maybe type
10825 if (wanted_type->id == TypeTableEntryIdOptional &&
10826 actual_type->id == TypeTableEntryIdNull)
10825 if (wanted_type->id == ZigTypeIdOptional &&
10826 actual_type->id == ZigTypeIdNull)
1082710827 {
1082810828 return ir_analyze_null_to_maybe(ira, source_instr, value, wanted_type);
1082910829 }
1083010830
1083110831 // cast from child type of error type to error type
10832 if (wanted_type->id == TypeTableEntryIdErrorUnion) {
10832 if (wanted_type->id == ZigTypeIdErrorUnion) {
1083310833 if (types_match_const_cast_only(ira, wanted_type->data.error_union.payload_type, actual_type,
1083410834 source_node, false).id == ConstCastResultIdOk)
1083510835 {
1083610836 return ir_analyze_err_wrap_payload(ira, source_instr, value, wanted_type);
10837 } else if (actual_type->id == TypeTableEntryIdComptimeInt ||
10838 actual_type->id == TypeTableEntryIdComptimeFloat)
10837 } else if (actual_type->id == ZigTypeIdComptimeInt ||
10838 actual_type->id == ZigTypeIdComptimeFloat)
1083910839 {
1084010840 if (ir_num_lit_fits_in_other_type(ira, value, wanted_type->data.error_union.payload_type, true)) {
1084110841 return ir_analyze_err_wrap_payload(ira, source_instr, value, wanted_type);
......@@ -10846,13 +10846,13 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1084610846 }
1084710847
1084810848 // cast from [N]T to E![]const T
10849 if (wanted_type->id == TypeTableEntryIdErrorUnion &&
10849 if (wanted_type->id == ZigTypeIdErrorUnion &&
1085010850 is_slice(wanted_type->data.error_union.payload_type) &&
10851 actual_type->id == TypeTableEntryIdArray)
10851 actual_type->id == ZigTypeIdArray)
1085210852 {
1085310853 ZigType *ptr_type =
1085410854 wanted_type->data.error_union.payload_type->data.structure.fields[slice_ptr_index].type_entry;
10855 assert(ptr_type->id == TypeTableEntryIdPointer);
10855 assert(ptr_type->id == ZigTypeIdPointer);
1085610856 if ((ptr_type->data.pointer.is_const || actual_type->data.array.len == 0) &&
1085710857 types_match_const_cast_only(ira, ptr_type->data.pointer.child_type, actual_type->data.array.child_type,
1085810858 source_node, false).id == ConstCastResultIdOk)
......@@ -10870,22 +10870,22 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1087010870 }
1087110871
1087210872 // cast from error set to error union type
10873 if (wanted_type->id == TypeTableEntryIdErrorUnion &&
10874 actual_type->id == TypeTableEntryIdErrorSet)
10873 if (wanted_type->id == ZigTypeIdErrorUnion &&
10874 actual_type->id == ZigTypeIdErrorSet)
1087510875 {
1087610876 return ir_analyze_err_wrap_code(ira, source_instr, value, wanted_type);
1087710877 }
1087810878
1087910879 // cast from T to E!?T
10880 if (wanted_type->id == TypeTableEntryIdErrorUnion &&
10881 wanted_type->data.error_union.payload_type->id == TypeTableEntryIdOptional &&
10882 actual_type->id != TypeTableEntryIdOptional)
10880 if (wanted_type->id == ZigTypeIdErrorUnion &&
10881 wanted_type->data.error_union.payload_type->id == ZigTypeIdOptional &&
10882 actual_type->id != ZigTypeIdOptional)
1088310883 {
1088410884 ZigType *wanted_child_type = wanted_type->data.error_union.payload_type->data.maybe.child_type;
1088510885 if (types_match_const_cast_only(ira, wanted_child_type, actual_type, source_node, false).id == ConstCastResultIdOk ||
10886 actual_type->id == TypeTableEntryIdNull ||
10887 actual_type->id == TypeTableEntryIdComptimeInt ||
10888 actual_type->id == TypeTableEntryIdComptimeFloat)
10886 actual_type->id == ZigTypeIdNull ||
10887 actual_type->id == ZigTypeIdComptimeInt ||
10888 actual_type->id == ZigTypeIdComptimeFloat)
1088910889 {
1089010890 IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.error_union.payload_type, value);
1089110891 if (type_is_invalid(cast1->value.type))
......@@ -10901,12 +10901,12 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1090110901
1090210902 // cast from number literal to another type
1090310903 // cast from number literal to *const integer
10904 if (actual_type->id == TypeTableEntryIdComptimeFloat ||
10905 actual_type->id == TypeTableEntryIdComptimeInt)
10904 if (actual_type->id == ZigTypeIdComptimeFloat ||
10905 actual_type->id == ZigTypeIdComptimeInt)
1090610906 {
1090710907 if ((err = ensure_complete_type(ira->codegen, wanted_type)))
1090810908 return ira->codegen->invalid_instruction;
10909 if (wanted_type->id == TypeTableEntryIdEnum) {
10909 if (wanted_type->id == ZigTypeIdEnum) {
1091010910 IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.enumeration.tag_int_type, value);
1091110911 if (type_is_invalid(cast1->value.type))
1091210912 return ira->codegen->invalid_instruction;
......@@ -10916,7 +10916,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1091610916 return ira->codegen->invalid_instruction;
1091710917
1091810918 return cast2;
10919 } else if (wanted_type->id == TypeTableEntryIdPointer &&
10919 } else if (wanted_type->id == ZigTypeIdPointer &&
1092010920 wanted_type->data.pointer.is_const)
1092110921 {
1092210922 IrInstruction *cast1 = ir_analyze_cast(ira, source_instr, wanted_type->data.pointer.child_type, value);
......@@ -10930,15 +10930,15 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1093010930 return cast2;
1093110931 } else if (ir_num_lit_fits_in_other_type(ira, value, wanted_type, true)) {
1093210932 CastOp op;
10933 if ((actual_type->id == TypeTableEntryIdComptimeFloat &&
10934 wanted_type->id == TypeTableEntryIdFloat) ||
10935 (actual_type->id == TypeTableEntryIdComptimeInt &&
10936 wanted_type->id == TypeTableEntryIdInt))
10933 if ((actual_type->id == ZigTypeIdComptimeFloat &&
10934 wanted_type->id == ZigTypeIdFloat) ||
10935 (actual_type->id == ZigTypeIdComptimeInt &&
10936 wanted_type->id == ZigTypeIdInt))
1093710937 {
1093810938 op = CastOpNumLitToConcrete;
10939 } else if (wanted_type->id == TypeTableEntryIdInt) {
10939 } else if (wanted_type->id == ZigTypeIdInt) {
1094010940 op = CastOpFloatToInt;
10941 } else if (wanted_type->id == TypeTableEntryIdFloat) {
10941 } else if (wanted_type->id == ZigTypeIdFloat) {
1094210942 op = CastOpIntToFloat;
1094310943 } else {
1094410944 zig_unreachable();
......@@ -10952,14 +10952,14 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1095210952 // cast from typed number to integer or float literal.
1095310953 // works when the number is known at compile time
1095410954 if (instr_is_comptime(value) &&
10955 ((actual_type->id == TypeTableEntryIdInt && wanted_type->id == TypeTableEntryIdComptimeInt) ||
10956 (actual_type->id == TypeTableEntryIdFloat && wanted_type->id == TypeTableEntryIdComptimeFloat)))
10955 ((actual_type->id == ZigTypeIdInt && wanted_type->id == ZigTypeIdComptimeInt) ||
10956 (actual_type->id == ZigTypeIdFloat && wanted_type->id == ZigTypeIdComptimeFloat)))
1095710957 {
1095810958 return ir_analyze_number_to_literal(ira, source_instr, value, wanted_type);
1095910959 }
1096010960
1096110961 // cast from union to the enum type of the union
10962 if (actual_type->id == TypeTableEntryIdUnion && wanted_type->id == TypeTableEntryIdEnum) {
10962 if (actual_type->id == ZigTypeIdUnion && wanted_type->id == ZigTypeIdEnum) {
1096310963 if ((err = type_ensure_zero_bits_known(ira->codegen, actual_type)))
1096410964 return ira->codegen->invalid_instruction;
1096510965
......@@ -10969,7 +10969,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1096910969 }
1097010970
1097110971 // enum to union which has the enum as the tag type
10972 if (wanted_type->id == TypeTableEntryIdUnion && actual_type->id == TypeTableEntryIdEnum &&
10972 if (wanted_type->id == ZigTypeIdUnion && actual_type->id == ZigTypeIdEnum &&
1097310973 (wanted_type->data.unionation.decl_node->data.container_decl.auto_enum ||
1097410974 wanted_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr))
1097510975 {
......@@ -10982,7 +10982,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1098210982 }
1098310983
1098410984 // enum to &const union which has the enum as the tag type
10985 if (actual_type->id == TypeTableEntryIdEnum && wanted_type->id == TypeTableEntryIdPointer) {
10985 if (actual_type->id == ZigTypeIdEnum && wanted_type->id == ZigTypeIdPointer) {
1098610986 ZigType *union_type = wanted_type->data.pointer.child_type;
1098710987 if (union_type->data.unionation.decl_node->data.container_decl.auto_enum ||
1098810988 union_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr)
......@@ -11005,11 +11005,11 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1100511005 }
1100611006
1100711007 // cast from *T to *[1]T
11008 if (wanted_type->id == TypeTableEntryIdPointer && wanted_type->data.pointer.ptr_len == PtrLenSingle &&
11009 actual_type->id == TypeTableEntryIdPointer && actual_type->data.pointer.ptr_len == PtrLenSingle)
11008 if (wanted_type->id == ZigTypeIdPointer && wanted_type->data.pointer.ptr_len == PtrLenSingle &&
11009 actual_type->id == ZigTypeIdPointer && actual_type->data.pointer.ptr_len == PtrLenSingle)
1101011010 {
1101111011 ZigType *array_type = wanted_type->data.pointer.child_type;
11012 if (array_type->id == TypeTableEntryIdArray && array_type->data.array.len == 1 &&
11012 if (array_type->id == ZigTypeIdArray && array_type->data.array.len == 1 &&
1101311013 types_match_const_cast_only(ira, array_type->data.array.child_type,
1101411014 actual_type->data.pointer.child_type, source_node,
1101511015 !wanted_type->data.pointer.is_const).id == ConstCastResultIdOk)
......@@ -11029,7 +11029,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1102911029 }
1103011030
1103111031 // cast from T to *T where T is zero bits
11032 if (wanted_type->id == TypeTableEntryIdPointer && wanted_type->data.pointer.ptr_len == PtrLenSingle &&
11032 if (wanted_type->id == ZigTypeIdPointer && wanted_type->data.pointer.ptr_len == PtrLenSingle &&
1103311033 types_match_const_cast_only(ira, wanted_type->data.pointer.child_type,
1103411034 actual_type, source_node, !wanted_type->data.pointer.is_const).id == ConstCastResultIdOk)
1103511035 {
......@@ -11043,7 +11043,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst
1104311043
1104411044
1104511045 // cast from undefined to anything
11046 if (actual_type->id == TypeTableEntryIdUndefined) {
11046 if (actual_type->id == ZigTypeIdUndefined) {
1104711047 return ir_analyze_undefined_to_anything(ira, source_instr, value, wanted_type);
1104811048 }
1104911049
......@@ -11073,7 +11073,7 @@ static IrInstruction *ir_implicit_cast(IrAnalyze *ira, IrInstruction *value, Zig
1107311073 return value; // anything will do
1107411074 if (expected_type == value->value.type)
1107511075 return value; // match
11076 if (value->value.type->id == TypeTableEntryIdUnreachable)
11076 if (value->value.type->id == ZigTypeIdUnreachable)
1107711077 return value;
1107811078
1107911079 return ir_analyze_cast(ira, value, expected_type, value);
......@@ -11083,7 +11083,7 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc
1108311083 ZigType *type_entry = ptr->value.type;
1108411084 if (type_is_invalid(type_entry)) {
1108511085 return ira->codegen->invalid_instruction;
11086 } else if (type_entry->id == TypeTableEntryIdPointer) {
11086 } else if (type_entry->id == ZigTypeIdPointer) {
1108711087 ZigType *child_type = type_entry->data.pointer.child_type;
1108811088 if (instr_is_comptime(ptr)) {
1108911089 if (ptr->value.data.x_ptr.mut == ConstPtrMutComptimeConst ||
......@@ -11198,7 +11198,7 @@ static bool ir_resolve_atomic_order(IrAnalyze *ira, IrInstruction *value, Atomic
1119811198 return false;
1119911199
1120011200 ConstExprValue *atomic_order_val = get_builtin_value(ira->codegen, "AtomicOrder");
11201 assert(atomic_order_val->type->id == TypeTableEntryIdMetaType);
11201 assert(atomic_order_val->type->id == ZigTypeIdMetaType);
1120211202 ZigType *atomic_order_type = atomic_order_val->data.x_type;
1120311203
1120411204 IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_order_type);
......@@ -11218,7 +11218,7 @@ static bool ir_resolve_atomic_rmw_op(IrAnalyze *ira, IrInstruction *value, Atomi
1121811218 return false;
1121911219
1122011220 ConstExprValue *atomic_rmw_op_val = get_builtin_value(ira->codegen, "AtomicRmwOp");
11221 assert(atomic_rmw_op_val->type->id == TypeTableEntryIdMetaType);
11221 assert(atomic_rmw_op_val->type->id == ZigTypeIdMetaType);
1122211222 ZigType *atomic_rmw_op_type = atomic_rmw_op_val->data.x_type;
1122311223
1122411224 IrInstruction *casted_value = ir_implicit_cast(ira, value, atomic_rmw_op_type);
......@@ -11238,7 +11238,7 @@ static bool ir_resolve_global_linkage(IrAnalyze *ira, IrInstruction *value, Glob
1123811238 return false;
1123911239
1124011240 ConstExprValue *global_linkage_val = get_builtin_value(ira->codegen, "GlobalLinkage");
11241 assert(global_linkage_val->type->id == TypeTableEntryIdMetaType);
11241 assert(global_linkage_val->type->id == ZigTypeIdMetaType);
1124211242 ZigType *global_linkage_type = global_linkage_val->data.x_type;
1124311243
1124411244 IrInstruction *casted_value = ir_implicit_cast(ira, value, global_linkage_type);
......@@ -11258,7 +11258,7 @@ static bool ir_resolve_float_mode(IrAnalyze *ira, IrInstruction *value, FloatMod
1125811258 return false;
1125911259
1126011260 ConstExprValue *float_mode_val = get_builtin_value(ira->codegen, "FloatMode");
11261 assert(float_mode_val->type->id == TypeTableEntryIdMetaType);
11261 assert(float_mode_val->type->id == ZigTypeIdMetaType);
1126211262 ZigType *float_mode_type = float_mode_val->data.x_type;
1126311263
1126411264 IrInstruction *casted_value = ir_implicit_cast(ira, value, float_mode_type);
......@@ -11340,7 +11340,7 @@ static ZigType *ir_analyze_instruction_return(IrAnalyze *ira,
1134011340 return ir_unreach_error(ira);
1134111341
1134211342 if (casted_value->value.special == ConstValSpecialRuntime &&
11343 casted_value->value.type->id == TypeTableEntryIdPointer &&
11343 casted_value->value.type->id == ZigTypeIdPointer &&
1134411344 casted_value->value.data.rh_ptr == RuntimeHintPtrStack)
1134511345 {
1134611346 ir_add_error(ira, casted_value, buf_sprintf("function returns address of local variable"));
......@@ -11388,8 +11388,8 @@ static ZigType *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp *bin_o
1138811388 if (op2_val == nullptr)
1138911389 return ira->codegen->builtin_types.entry_invalid;
1139011390
11391 assert(casted_op1->value.type->id == TypeTableEntryIdBool);
11392 assert(casted_op2->value.type->id == TypeTableEntryIdBool);
11391 assert(casted_op1->value.type->id == ZigTypeIdBool);
11392 assert(casted_op2->value.type->id == ZigTypeIdBool);
1139311393 if (bin_op_instruction->op_id == IrBinOpBoolOr) {
1139411394 out_val->data.x_bool = op1_val->data.x_bool || op2_val->data.x_bool;
1139511395 } else if (bin_op_instruction->op_id == IrBinOpBoolAnd) {
......@@ -11442,19 +11442,19 @@ static ZigType *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op
1144211442 IrBinOp op_id = bin_op_instruction->op_id;
1144311443 bool is_equality_cmp = (op_id == IrBinOpCmpEq || op_id == IrBinOpCmpNotEq);
1144411444 if (is_equality_cmp &&
11445 ((op1->value.type->id == TypeTableEntryIdNull && op2->value.type->id == TypeTableEntryIdOptional) ||
11446 (op2->value.type->id == TypeTableEntryIdNull && op1->value.type->id == TypeTableEntryIdOptional) ||
11447 (op1->value.type->id == TypeTableEntryIdNull && op2->value.type->id == TypeTableEntryIdNull)))
11445 ((op1->value.type->id == ZigTypeIdNull && op2->value.type->id == ZigTypeIdOptional) ||
11446 (op2->value.type->id == ZigTypeIdNull && op1->value.type->id == ZigTypeIdOptional) ||
11447 (op1->value.type->id == ZigTypeIdNull && op2->value.type->id == ZigTypeIdNull)))
1144811448 {
11449 if (op1->value.type->id == TypeTableEntryIdNull && op2->value.type->id == TypeTableEntryIdNull) {
11449 if (op1->value.type->id == ZigTypeIdNull && op2->value.type->id == ZigTypeIdNull) {
1145011450 ConstExprValue *out_val = ir_build_const_from(ira, &bin_op_instruction->base);
1145111451 out_val->data.x_bool = (op_id == IrBinOpCmpEq);
1145211452 return ira->codegen->builtin_types.entry_bool;
1145311453 }
1145411454 IrInstruction *maybe_op;
11455 if (op1->value.type->id == TypeTableEntryIdNull) {
11455 if (op1->value.type->id == ZigTypeIdNull) {
1145611456 maybe_op = op2;
11457 } else if (op2->value.type->id == TypeTableEntryIdNull) {
11457 } else if (op2->value.type->id == ZigTypeIdNull) {
1145811458 maybe_op = op1;
1145911459 } else {
1146011460 zig_unreachable();
......@@ -11481,7 +11481,7 @@ static ZigType *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op
1148111481 return ira->codegen->builtin_types.entry_bool;
1148211482 }
1148311483
11484 if (op1->value.type->id == TypeTableEntryIdErrorSet && op2->value.type->id == TypeTableEntryIdErrorSet) {
11484 if (op1->value.type->id == ZigTypeIdErrorSet && op2->value.type->id == ZigTypeIdErrorSet) {
1148511485 if (!is_equality_cmp) {
1148611486 ir_add_error_node(ira, source_node, buf_sprintf("operator not allowed for errors"));
1148711487 return ira->codegen->builtin_types.entry_invalid;
......@@ -11575,42 +11575,42 @@ static ZigType *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op
1157511575
1157611576 bool operator_allowed;
1157711577 switch (resolved_type->id) {
11578 case TypeTableEntryIdInvalid:
11578 case ZigTypeIdInvalid:
1157911579 zig_unreachable(); // handled above
1158011580
11581 case TypeTableEntryIdComptimeFloat:
11582 case TypeTableEntryIdComptimeInt:
11583 case TypeTableEntryIdInt:
11584 case TypeTableEntryIdFloat:
11581 case ZigTypeIdComptimeFloat:
11582 case ZigTypeIdComptimeInt:
11583 case ZigTypeIdInt:
11584 case ZigTypeIdFloat:
1158511585 operator_allowed = true;
1158611586 break;
1158711587
11588 case TypeTableEntryIdBool:
11589 case TypeTableEntryIdMetaType:
11590 case TypeTableEntryIdVoid:
11591 case TypeTableEntryIdPointer:
11592 case TypeTableEntryIdErrorSet:
11593 case TypeTableEntryIdFn:
11594 case TypeTableEntryIdOpaque:
11595 case TypeTableEntryIdNamespace:
11596 case TypeTableEntryIdBlock:
11597 case TypeTableEntryIdBoundFn:
11598 case TypeTableEntryIdArgTuple:
11599 case TypeTableEntryIdPromise:
11600 case TypeTableEntryIdEnum:
11588 case ZigTypeIdBool:
11589 case ZigTypeIdMetaType:
11590 case ZigTypeIdVoid:
11591 case ZigTypeIdPointer:
11592 case ZigTypeIdErrorSet:
11593 case ZigTypeIdFn:
11594 case ZigTypeIdOpaque:
11595 case ZigTypeIdNamespace:
11596 case ZigTypeIdBlock:
11597 case ZigTypeIdBoundFn:
11598 case ZigTypeIdArgTuple:
11599 case ZigTypeIdPromise:
11600 case ZigTypeIdEnum:
1160111601 operator_allowed = is_equality_cmp;
1160211602 break;
1160311603
11604 case TypeTableEntryIdUnreachable:
11605 case TypeTableEntryIdArray:
11606 case TypeTableEntryIdStruct:
11607 case TypeTableEntryIdUndefined:
11608 case TypeTableEntryIdNull:
11609 case TypeTableEntryIdErrorUnion:
11610 case TypeTableEntryIdUnion:
11604 case ZigTypeIdUnreachable:
11605 case ZigTypeIdArray:
11606 case ZigTypeIdStruct:
11607 case ZigTypeIdUndefined:
11608 case ZigTypeIdNull:
11609 case ZigTypeIdErrorUnion:
11610 case ZigTypeIdUnion:
1161111611 operator_allowed = false;
1161211612 break;
11613 case TypeTableEntryIdOptional:
11613 case ZigTypeIdOptional:
1161411614 operator_allowed = is_equality_cmp && get_codegen_ptr_type(resolved_type) != nullptr;
1161511615 break;
1161611616 }
......@@ -11638,10 +11638,10 @@ static ZigType *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op
1163811638 return ira->codegen->builtin_types.entry_invalid;
1163911639
1164011640 bool answer;
11641 if (resolved_type->id == TypeTableEntryIdComptimeFloat || resolved_type->id == TypeTableEntryIdFloat) {
11641 if (resolved_type->id == ZigTypeIdComptimeFloat || resolved_type->id == ZigTypeIdFloat) {
1164211642 Cmp cmp_result = float_cmp(op1_val, op2_val);
1164311643 answer = resolve_cmp_op_id(op_id, cmp_result);
11644 } else if (resolved_type->id == TypeTableEntryIdComptimeInt || resolved_type->id == TypeTableEntryIdInt) {
11644 } else if (resolved_type->id == ZigTypeIdComptimeInt || resolved_type->id == ZigTypeIdInt) {
1164511645 Cmp cmp_result = bigint_cmp(&op1_val->data.x_bigint, &op2_val->data.x_bigint);
1164611646 answer = resolve_cmp_op_id(op_id, cmp_result);
1164711647 } else {
......@@ -11661,7 +11661,7 @@ static ZigType *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp *bin_op
1166111661 }
1166211662
1166311663 // some comparisons with unsigned numbers can be evaluated
11664 if (resolved_type->id == TypeTableEntryIdInt && !resolved_type->data.integral.is_signed) {
11664 if (resolved_type->id == ZigTypeIdInt && !resolved_type->data.integral.is_signed) {
1166511665 ConstExprValue *known_left_val;
1166611666 IrBinOp flipped_op_id;
1166711667 if (instr_is_comptime(casted_op1)) {
......@@ -11711,12 +11711,12 @@ static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val,
1171111711 bool is_int;
1171211712 bool is_float;
1171311713 Cmp op2_zcmp;
11714 if (type_entry->id == TypeTableEntryIdInt || type_entry->id == TypeTableEntryIdComptimeInt) {
11714 if (type_entry->id == ZigTypeIdInt || type_entry->id == ZigTypeIdComptimeInt) {
1171511715 is_int = true;
1171611716 is_float = false;
1171711717 op2_zcmp = bigint_cmp_zero(&op2_val->data.x_bigint);
11718 } else if (type_entry->id == TypeTableEntryIdFloat ||
11719 type_entry->id == TypeTableEntryIdComptimeFloat)
11718 } else if (type_entry->id == ZigTypeIdFloat ||
11719 type_entry->id == ZigTypeIdComptimeFloat)
1172011720 {
1172111721 is_int = false;
1172211722 is_float = true;
......@@ -11766,7 +11766,7 @@ static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val,
1176611766 bigint_shl(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint);
1176711767 break;
1176811768 case IrBinOpBitShiftLeftLossy:
11769 assert(type_entry->id == TypeTableEntryIdInt);
11769 assert(type_entry->id == ZigTypeIdInt);
1177011770 bigint_shl_trunc(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint,
1177111771 type_entry->data.integral.bit_count, type_entry->data.integral.is_signed);
1177211772 break;
......@@ -11793,7 +11793,7 @@ static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val,
1179311793 }
1179411794 break;
1179511795 case IrBinOpAddWrap:
11796 assert(type_entry->id == TypeTableEntryIdInt);
11796 assert(type_entry->id == ZigTypeIdInt);
1179711797 bigint_add_wrap(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint,
1179811798 type_entry->data.integral.bit_count, type_entry->data.integral.is_signed);
1179911799 break;
......@@ -11805,7 +11805,7 @@ static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val,
1180511805 }
1180611806 break;
1180711807 case IrBinOpSubWrap:
11808 assert(type_entry->id == TypeTableEntryIdInt);
11808 assert(type_entry->id == ZigTypeIdInt);
1180911809 bigint_sub_wrap(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint,
1181011810 type_entry->data.integral.bit_count, type_entry->data.integral.is_signed);
1181111811 break;
......@@ -11817,7 +11817,7 @@ static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val,
1181711817 }
1181811818 break;
1181911819 case IrBinOpMultWrap:
11820 assert(type_entry->id == TypeTableEntryIdInt);
11820 assert(type_entry->id == ZigTypeIdInt);
1182111821 bigint_mul_wrap(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint,
1182211822 type_entry->data.integral.bit_count, type_entry->data.integral.is_signed);
1182311823 break;
......@@ -11872,7 +11872,7 @@ static int ir_eval_math_op(ZigType *type_entry, ConstExprValue *op1_val,
1187211872 break;
1187311873 }
1187411874
11875 if (type_entry->id == TypeTableEntryIdInt) {
11875 if (type_entry->id == ZigTypeIdInt) {
1187611876 if (!bigint_fits_in_bits(&out_val->data.x_bigint, type_entry->data.integral.bit_count,
1187711877 type_entry->data.integral.is_signed))
1187811878 {
......@@ -11890,7 +11890,7 @@ static ZigType *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_
1189011890 if (type_is_invalid(op1->value.type))
1189111891 return ira->codegen->builtin_types.entry_invalid;
1189211892
11893 if (op1->value.type->id != TypeTableEntryIdInt && op1->value.type->id != TypeTableEntryIdComptimeInt) {
11893 if (op1->value.type->id != ZigTypeIdInt && op1->value.type->id != ZigTypeIdComptimeInt) {
1189411894 ir_add_error(ira, &bin_op_instruction->base,
1189511895 buf_sprintf("bit shifting operation expected integer type, found '%s'",
1189611896 buf_ptr(&op1->value.type->name)));
......@@ -11903,7 +11903,7 @@ static ZigType *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_
1190311903
1190411904 IrInstruction *casted_op2;
1190511905 IrBinOp op_id = bin_op_instruction->op_id;
11906 if (op1->value.type->id == TypeTableEntryIdComptimeInt) {
11906 if (op1->value.type->id == ZigTypeIdComptimeInt) {
1190711907 casted_op2 = op2;
1190811908
1190911909 if (op_id == IrBinOpBitShiftLeftLossy) {
......@@ -11920,7 +11920,7 @@ static ZigType *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_
1192011920 ZigType *shift_amt_type = get_smallest_unsigned_int_type(ira->codegen,
1192111921 op1->value.type->data.integral.bit_count - 1);
1192211922 if (bin_op_instruction->op_id == IrBinOpBitShiftLeftLossy &&
11923 op2->value.type->id == TypeTableEntryIdComptimeInt) {
11923 op2->value.type->id == ZigTypeIdComptimeInt) {
1192411924 if (!bigint_fits_in_bits(&op2->value.data.x_bigint,
1192511925 shift_amt_type->data.integral.bit_count,
1192611926 op2->value.data.x_bigint.is_negative)) {
......@@ -11974,7 +11974,7 @@ static ZigType *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp *bin_op_
1197411974
1197511975 ir_num_lit_fits_in_other_type(ira, result_instruction, op1->value.type, false);
1197611976 return op1->value.type;
11977 } else if (op1->value.type->id == TypeTableEntryIdComptimeInt) {
11977 } else if (op1->value.type->id == ZigTypeIdComptimeInt) {
1197811978 ir_add_error(ira, &bin_op_instruction->base,
1197911979 buf_sprintf("LHS of shift must be an integer type, or RHS must be compile-time known"));
1198011980 return ira->codegen->builtin_types.entry_invalid;
......@@ -11997,7 +11997,7 @@ static ZigType *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp *bin_o
1199711997 IrBinOp op_id = bin_op_instruction->op_id;
1199811998
1199911999 // look for pointer math
12000 if (op1->value.type->id == TypeTableEntryIdPointer && op1->value.type->data.pointer.ptr_len == PtrLenUnknown &&
12000 if (op1->value.type->id == ZigTypeIdPointer && op1->value.type->data.pointer.ptr_len == PtrLenUnknown &&
1200112001 (op_id == IrBinOpAdd || op_id == IrBinOpSub))
1200212002 {
1200312003 IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, ira->codegen->builtin_types.entry_usize);
......@@ -12016,15 +12016,15 @@ static ZigType *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp *bin_o
1201612016 if (type_is_invalid(resolved_type))
1201712017 return resolved_type;
1201812018
12019 bool is_int = resolved_type->id == TypeTableEntryIdInt || resolved_type->id == TypeTableEntryIdComptimeInt;
12020 bool is_float = resolved_type->id == TypeTableEntryIdFloat || resolved_type->id == TypeTableEntryIdComptimeFloat;
12019 bool is_int = resolved_type->id == ZigTypeIdInt || resolved_type->id == ZigTypeIdComptimeInt;
12020 bool is_float = resolved_type->id == ZigTypeIdFloat || resolved_type->id == ZigTypeIdComptimeFloat;
1202112021 bool is_signed_div = (
12022 (resolved_type->id == TypeTableEntryIdInt && resolved_type->data.integral.is_signed) ||
12023 resolved_type->id == TypeTableEntryIdFloat ||
12024 (resolved_type->id == TypeTableEntryIdComptimeFloat &&
12022 (resolved_type->id == ZigTypeIdInt && resolved_type->data.integral.is_signed) ||
12023 resolved_type->id == ZigTypeIdFloat ||
12024 (resolved_type->id == ZigTypeIdComptimeFloat &&
1202512025 ((bigfloat_cmp_zero(&op1->value.data.x_bigfloat) != CmpGT) !=
1202612026 (bigfloat_cmp_zero(&op2->value.data.x_bigfloat) != CmpGT))) ||
12027 (resolved_type->id == TypeTableEntryIdComptimeInt &&
12027 (resolved_type->id == ZigTypeIdComptimeInt &&
1202812028 ((bigint_cmp_zero(&op1->value.data.x_bigint) != CmpGT) !=
1202912029 (bigint_cmp_zero(&op2->value.data.x_bigint) != CmpGT)))
1203012030 );
......@@ -12146,7 +12146,7 @@ static ZigType *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp *bin_o
1214612146 return ira->codegen->builtin_types.entry_invalid;
1214712147 }
1214812148
12149 if (resolved_type->id == TypeTableEntryIdComptimeInt) {
12149 if (resolved_type->id == ZigTypeIdComptimeInt) {
1215012150 if (op_id == IrBinOpAddWrap) {
1215112151 op_id = IrBinOpAdd;
1215212152 } else if (op_id == IrBinOpSubWrap) {
......@@ -12229,12 +12229,12 @@ static ZigType *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruc
1222912229 size_t op1_array_index;
1223012230 size_t op1_array_end;
1223112231 ZigType *child_type;
12232 if (op1_type->id == TypeTableEntryIdArray) {
12232 if (op1_type->id == ZigTypeIdArray) {
1223312233 child_type = op1_type->data.array.child_type;
1223412234 op1_array_val = op1_val;
1223512235 op1_array_index = 0;
1223612236 op1_array_end = op1_type->data.array.len;
12237 } else if (op1_type->id == TypeTableEntryIdPointer &&
12237 } else if (op1_type->id == ZigTypeIdPointer &&
1223812238 op1_type->data.pointer.child_type == ira->codegen->builtin_types.entry_u8 &&
1223912239 op1_val->data.x_ptr.special == ConstPtrSpecialBaseArray &&
1224012240 op1_val->data.x_ptr.data.base_array.is_cstr)
......@@ -12260,7 +12260,7 @@ static ZigType *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruc
1226012260 ConstExprValue *op2_array_val;
1226112261 size_t op2_array_index;
1226212262 size_t op2_array_end;
12263 if (op2_type->id == TypeTableEntryIdArray) {
12263 if (op2_type->id == ZigTypeIdArray) {
1226412264 if (op2_type->data.array.child_type != child_type) {
1226512265 ir_add_error(ira, op2, buf_sprintf("expected array of type '%s', found '%s'",
1226612266 buf_ptr(&child_type->name),
......@@ -12270,7 +12270,7 @@ static ZigType *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruc
1227012270 op2_array_val = op2_val;
1227112271 op2_array_index = 0;
1227212272 op2_array_end = op2_array_val->type->data.array.len;
12273 } else if (op2_type->id == TypeTableEntryIdPointer &&
12273 } else if (op2_type->id == ZigTypeIdPointer &&
1227412274 op2_type->data.pointer.child_type == ira->codegen->builtin_types.entry_u8 &&
1227512275 op2_val->data.x_ptr.special == ConstPtrSpecialBaseArray &&
1227612276 op2_val->data.x_ptr.data.base_array.is_cstr)
......@@ -12308,7 +12308,7 @@ static ZigType *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp *instruc
1230812308 ZigType *result_type;
1230912309 ConstExprValue *out_array_val;
1231012310 size_t new_len = (op1_array_end - op1_array_index) + (op2_array_end - op2_array_index);
12311 if (op1_type->id == TypeTableEntryIdArray || op2_type->id == TypeTableEntryIdArray) {
12311 if (op1_type->id == ZigTypeIdArray || op2_type->id == ZigTypeIdArray) {
1231212312 result_type = get_array_type(ira->codegen, child_type, new_len);
1231312313
1231412314 out_array_val = out_val;
......@@ -12392,7 +12392,7 @@ static ZigType *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp *instru
1239212392 return ira->codegen->builtin_types.entry_invalid;
1239312393
1239412394 ZigType *array_type = op1->value.type;
12395 if (array_type->id != TypeTableEntryIdArray) {
12395 if (array_type->id != ZigTypeIdArray) {
1239612396 ir_add_error(ira, op1, buf_sprintf("expected array type, found '%s'", buf_ptr(&op1->value.type->name)));
1239712397 return ira->codegen->builtin_types.entry_invalid;
1239812398 }
......@@ -12555,8 +12555,8 @@ static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDec
1255512555 }
1255612556
1255712557 if (!type_is_invalid(result_type)) {
12558 if (result_type->id == TypeTableEntryIdUnreachable ||
12559 result_type->id == TypeTableEntryIdOpaque)
12558 if (result_type->id == ZigTypeIdUnreachable ||
12559 result_type->id == ZigTypeIdOpaque)
1256012560 {
1256112561 ir_add_error_node(ira, source_node,
1256212562 buf_sprintf("variable of type '%s' not allowed", buf_ptr(&result_type->name)));
......@@ -12571,7 +12571,7 @@ static ZigType *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstructionDec
1257112571 }
1257212572 } else {
1257312573 if (casted_init_value->value.special == ConstValSpecialStatic &&
12574 casted_init_value->value.type->id == TypeTableEntryIdFn &&
12574 casted_init_value->value.type->id == ZigTypeIdFn &&
1257512575 casted_init_value->value.data.x_ptr.data.fn.fn_entry->fn_inline == FnInlineAlways)
1257612576 {
1257712577 var_class_requires_const = true;
......@@ -12680,10 +12680,10 @@ static ZigType *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExpor
1268012680 }
1268112681
1268212682 switch (target->value.type->id) {
12683 case TypeTableEntryIdInvalid:
12684 case TypeTableEntryIdUnreachable:
12683 case ZigTypeIdInvalid:
12684 case ZigTypeIdUnreachable:
1268512685 zig_unreachable();
12686 case TypeTableEntryIdFn: {
12686 case ZigTypeIdFn: {
1268712687 assert(target->value.data.x_ptr.special == ConstPtrSpecialFunction);
1268812688 ZigFn *fn_entry = target->value.data.x_ptr.data.fn.fn_entry;
1268912689 CallingConvention cc = fn_entry->type_entry->data.fn.fn_type_id.cc;
......@@ -12706,7 +12706,7 @@ static ZigType *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExpor
1270612706 break;
1270712707 }
1270812708 } break;
12709 case TypeTableEntryIdStruct:
12709 case ZigTypeIdStruct:
1271012710 if (is_slice(target->value.type)) {
1271112711 ir_add_error(ira, target,
1271212712 buf_sprintf("unable to export value of type '%s'", buf_ptr(&target->value.type->name)));
......@@ -12716,26 +12716,26 @@ static ZigType *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExpor
1271612716 add_error_note(ira->codegen, msg, target->value.type->data.structure.decl_node, buf_sprintf("declared here"));
1271712717 }
1271812718 break;
12719 case TypeTableEntryIdUnion:
12719 case ZigTypeIdUnion:
1272012720 if (target->value.type->data.unionation.layout != ContainerLayoutExtern) {
1272112721 ErrorMsg *msg = ir_add_error(ira, target,
1272212722 buf_sprintf("exported union value must be declared extern"));
1272312723 add_error_note(ira->codegen, msg, target->value.type->data.unionation.decl_node, buf_sprintf("declared here"));
1272412724 }
1272512725 break;
12726 case TypeTableEntryIdEnum:
12726 case ZigTypeIdEnum:
1272712727 if (target->value.type->data.enumeration.layout != ContainerLayoutExtern) {
1272812728 ErrorMsg *msg = ir_add_error(ira, target,
1272912729 buf_sprintf("exported enum value must be declared extern"));
1273012730 add_error_note(ira->codegen, msg, target->value.type->data.enumeration.decl_node, buf_sprintf("declared here"));
1273112731 }
1273212732 break;
12733 case TypeTableEntryIdMetaType: {
12733 case ZigTypeIdMetaType: {
1273412734 ZigType *type_value = target->value.data.x_type;
1273512735 switch (type_value->id) {
12736 case TypeTableEntryIdInvalid:
12736 case ZigTypeIdInvalid:
1273712737 zig_unreachable();
12738 case TypeTableEntryIdStruct:
12738 case ZigTypeIdStruct:
1273912739 if (is_slice(type_value)) {
1274012740 ir_add_error(ira, target,
1274112741 buf_sprintf("unable to export type '%s'", buf_ptr(&type_value->name)));
......@@ -12745,73 +12745,73 @@ static ZigType *ir_analyze_instruction_export(IrAnalyze *ira, IrInstructionExpor
1274512745 add_error_note(ira->codegen, msg, type_value->data.structure.decl_node, buf_sprintf("declared here"));
1274612746 }
1274712747 break;
12748 case TypeTableEntryIdUnion:
12748 case ZigTypeIdUnion:
1274912749 if (type_value->data.unionation.layout != ContainerLayoutExtern) {
1275012750 ErrorMsg *msg = ir_add_error(ira, target,
1275112751 buf_sprintf("exported union must be declared extern"));
1275212752 add_error_note(ira->codegen, msg, type_value->data.unionation.decl_node, buf_sprintf("declared here"));
1275312753 }
1275412754 break;
12755 case TypeTableEntryIdEnum:
12755 case ZigTypeIdEnum:
1275612756 if (type_value->data.enumeration.layout != ContainerLayoutExtern) {
1275712757 ErrorMsg *msg = ir_add_error(ira, target,
1275812758 buf_sprintf("exported enum must be declared extern"));
1275912759 add_error_note(ira->codegen, msg, type_value->data.enumeration.decl_node, buf_sprintf("declared here"));
1276012760 }
1276112761 break;
12762 case TypeTableEntryIdFn: {
12762 case ZigTypeIdFn: {
1276312763 if (type_value->data.fn.fn_type_id.cc == CallingConventionUnspecified) {
1276412764 ir_add_error(ira, target,
1276512765 buf_sprintf("exported function type must specify calling convention"));
1276612766 }
1276712767 } break;
12768 case TypeTableEntryIdInt:
12769 case TypeTableEntryIdFloat:
12770 case TypeTableEntryIdPointer:
12771 case TypeTableEntryIdArray:
12772 case TypeTableEntryIdBool:
12768 case ZigTypeIdInt:
12769 case ZigTypeIdFloat:
12770 case ZigTypeIdPointer:
12771 case ZigTypeIdArray:
12772 case ZigTypeIdBool:
1277312773 break;
12774 case TypeTableEntryIdMetaType:
12775 case TypeTableEntryIdVoid:
12776 case TypeTableEntryIdUnreachable:
12777 case TypeTableEntryIdComptimeFloat:
12778 case TypeTableEntryIdComptimeInt:
12779 case TypeTableEntryIdUndefined:
12780 case TypeTableEntryIdNull:
12781 case TypeTableEntryIdOptional:
12782 case TypeTableEntryIdErrorUnion:
12783 case TypeTableEntryIdErrorSet:
12784 case TypeTableEntryIdNamespace:
12785 case TypeTableEntryIdBlock:
12786 case TypeTableEntryIdBoundFn:
12787 case TypeTableEntryIdArgTuple:
12788 case TypeTableEntryIdOpaque:
12789 case TypeTableEntryIdPromise:
12774 case ZigTypeIdMetaType:
12775 case ZigTypeIdVoid:
12776 case ZigTypeIdUnreachable:
12777 case ZigTypeIdComptimeFloat:
12778 case ZigTypeIdComptimeInt:
12779 case ZigTypeIdUndefined:
12780 case ZigTypeIdNull:
12781 case ZigTypeIdOptional:
12782 case ZigTypeIdErrorUnion:
12783 case ZigTypeIdErrorSet:
12784 case ZigTypeIdNamespace:
12785 case ZigTypeIdBlock:
12786 case ZigTypeIdBoundFn:
12787 case ZigTypeIdArgTuple:
12788 case ZigTypeIdOpaque:
12789 case ZigTypeIdPromise:
1279012790 ir_add_error(ira, target,
1279112791 buf_sprintf("invalid export target '%s'", buf_ptr(&type_value->name)));
1279212792 break;
1279312793 }
1279412794 } break;
12795 case TypeTableEntryIdVoid:
12796 case TypeTableEntryIdBool:
12797 case TypeTableEntryIdInt:
12798 case TypeTableEntryIdFloat:
12799 case TypeTableEntryIdPointer:
12800 case TypeTableEntryIdArray:
12801 case TypeTableEntryIdComptimeFloat:
12802 case TypeTableEntryIdComptimeInt:
12803 case TypeTableEntryIdUndefined:
12804 case TypeTableEntryIdNull:
12805 case TypeTableEntryIdOptional:
12806 case TypeTableEntryIdErrorUnion:
12807 case TypeTableEntryIdErrorSet:
12795 case ZigTypeIdVoid:
12796 case ZigTypeIdBool:
12797 case ZigTypeIdInt:
12798 case ZigTypeIdFloat:
12799 case ZigTypeIdPointer:
12800 case ZigTypeIdArray:
12801 case ZigTypeIdComptimeFloat:
12802 case ZigTypeIdComptimeInt:
12803 case ZigTypeIdUndefined:
12804 case ZigTypeIdNull:
12805 case ZigTypeIdOptional:
12806 case ZigTypeIdErrorUnion:
12807 case ZigTypeIdErrorSet:
1280812808 zig_panic("TODO export const value of type %s", buf_ptr(&target->value.type->name));
12809 case TypeTableEntryIdNamespace:
12810 case TypeTableEntryIdBlock:
12811 case TypeTableEntryIdBoundFn:
12812 case TypeTableEntryIdArgTuple:
12813 case TypeTableEntryIdOpaque:
12814 case TypeTableEntryIdPromise:
12809 case ZigTypeIdNamespace:
12810 case ZigTypeIdBlock:
12811 case ZigTypeIdBoundFn:
12812 case ZigTypeIdArgTuple:
12813 case ZigTypeIdOpaque:
12814 case ZigTypeIdPromise:
1281512815 ir_add_error(ira, target,
1281612816 buf_sprintf("invalid export target type '%s'", buf_ptr(&target->value.type->name)));
1281712817 break;
......@@ -12863,7 +12863,7 @@ static ZigType *ir_analyze_instruction_error_union(IrAnalyze *ira,
1286312863 if (type_is_invalid(payload_type))
1286412864 return ira->codegen->builtin_types.entry_invalid;
1286512865
12866 if (err_set_type->id != TypeTableEntryIdErrorSet) {
12866 if (err_set_type->id != ZigTypeIdErrorSet) {
1286712867 ir_add_error(ira, instruction->err_set->other,
1286812868 buf_sprintf("expected error set type, found type '%s'",
1286912869 buf_ptr(&err_set_type->name)));
......@@ -12918,7 +12918,7 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCall *c
1291812918{
1291912919 Buf *alloc_field_name = buf_create_from_str(ASYNC_ALLOC_FIELD_NAME);
1292012920 //Buf *free_field_name = buf_create_from_str("freeFn");
12921 assert(async_allocator_inst->value.type->id == TypeTableEntryIdPointer);
12921 assert(async_allocator_inst->value.type->id == ZigTypeIdPointer);
1292212922 ZigType *container_type = async_allocator_inst->value.type->data.pointer.child_type;
1292312923 IrInstruction *field_ptr_inst = ir_analyze_container_field_ptr(ira, alloc_field_name, &call_instruction->base,
1292412924 async_allocator_inst, container_type);
......@@ -12926,17 +12926,17 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCall *c
1292612926 return ira->codegen->invalid_instruction;
1292712927 }
1292812928 ZigType *ptr_to_alloc_fn_type = field_ptr_inst->value.type;
12929 assert(ptr_to_alloc_fn_type->id == TypeTableEntryIdPointer);
12929 assert(ptr_to_alloc_fn_type->id == ZigTypeIdPointer);
1293012930
1293112931 ZigType *alloc_fn_type = ptr_to_alloc_fn_type->data.pointer.child_type;
12932 if (alloc_fn_type->id != TypeTableEntryIdFn) {
12932 if (alloc_fn_type->id != ZigTypeIdFn) {
1293312933 ir_add_error(ira, &call_instruction->base,
1293412934 buf_sprintf("expected allocation function, found '%s'", buf_ptr(&alloc_fn_type->name)));
1293512935 return ira->codegen->invalid_instruction;
1293612936 }
1293712937
1293812938 ZigType *alloc_fn_return_type = alloc_fn_type->data.fn.fn_type_id.return_type;
12939 if (alloc_fn_return_type->id != TypeTableEntryIdErrorUnion) {
12939 if (alloc_fn_return_type->id != ZigTypeIdErrorUnion) {
1294012940 ir_add_error(ira, fn_ref,
1294112941 buf_sprintf("expected allocation function to return error union, but it returns '%s'", buf_ptr(&alloc_fn_return_type->name)));
1294212942 return ira->codegen->invalid_instruction;
......@@ -13015,7 +13015,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
1301513015 }
1301613016
1301713017 bool comptime_arg = param_decl_node->data.param_decl.is_inline ||
13018 casted_arg->value.type->id == TypeTableEntryIdComptimeInt || casted_arg->value.type->id == TypeTableEntryIdComptimeFloat;
13018 casted_arg->value.type->id == ZigTypeIdComptimeInt || casted_arg->value.type->id == ZigTypeIdComptimeFloat;
1301913019
1302013020 ConstExprValue *arg_val;
1302113021
......@@ -13041,8 +13041,8 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
1304113041 var->shadowable = !comptime_arg;
1304213042
1304313043 *next_proto_i += 1;
13044 } else if (casted_arg->value.type->id == TypeTableEntryIdComptimeInt ||
13045 casted_arg->value.type->id == TypeTableEntryIdComptimeFloat)
13044 } else if (casted_arg->value.type->id == ZigTypeIdComptimeInt ||
13045 casted_arg->value.type->id == ZigTypeIdComptimeFloat)
1304613046 {
1304713047 ir_add_error(ira, casted_arg,
1304813048 buf_sprintf("compiler bug: integer and float literals in var args function must be casted. https://github.com/ziglang/zig/issues/557"));
......@@ -13177,7 +13177,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1317713177 size_t call_param_count = call_instruction->arg_count + first_arg_1_or_0;
1317813178 for (size_t i = 0; i < call_instruction->arg_count; i += 1) {
1317913179 ConstExprValue *arg_tuple_value = &call_instruction->args[i]->other->value;
13180 if (arg_tuple_value->type->id == TypeTableEntryIdArgTuple) {
13180 if (arg_tuple_value->type->id == ZigTypeIdArgTuple) {
1318113181 call_param_count -= 1;
1318213182 call_param_count += arg_tuple_value->data.x_arg_tuple.end_index -
1318313183 arg_tuple_value->data.x_arg_tuple.start_index;
......@@ -13245,14 +13245,14 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1324513245
1324613246 size_t next_proto_i = 0;
1324713247 if (first_arg_ptr) {
13248 assert(first_arg_ptr->value.type->id == TypeTableEntryIdPointer);
13248 assert(first_arg_ptr->value.type->id == ZigTypeIdPointer);
1324913249
1325013250 bool first_arg_known_bare = false;
1325113251 if (fn_type_id->next_param_index >= 1) {
1325213252 ZigType *param_type = fn_type_id->param_info[next_proto_i].type;
1325313253 if (type_is_invalid(param_type))
1325413254 return ira->codegen->builtin_types.entry_invalid;
13255 first_arg_known_bare = param_type->id != TypeTableEntryIdPointer;
13255 first_arg_known_bare = param_type->id != ZigTypeIdPointer;
1325613256 }
1325713257
1325813258 IrInstruction *first_arg;
......@@ -13314,7 +13314,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1331413314
1331513315 if (inferred_err_set_type != nullptr) {
1331613316 inferred_err_set_type->data.error_set.infer_fn = nullptr;
13317 if (result->value.type->id == TypeTableEntryIdErrorUnion) {
13317 if (result->value.type->id == ZigTypeIdErrorUnion) {
1331813318 if (result->value.data.x_err_union.err != nullptr) {
1331913319 inferred_err_set_type->data.error_set.err_count = 1;
1332013320 inferred_err_set_type->data.error_set.errors = allocate<ErrorTableEntry *>(1);
......@@ -13323,7 +13323,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1332313323 ZigType *fn_inferred_err_set_type = result->value.type->data.error_union.err_set_type;
1332413324 inferred_err_set_type->data.error_set.err_count = fn_inferred_err_set_type->data.error_set.err_count;
1332513325 inferred_err_set_type->data.error_set.errors = fn_inferred_err_set_type->data.error_set.errors;
13326 } else if (result->value.type->id == TypeTableEntryIdErrorSet) {
13326 } else if (result->value.type->id == ZigTypeIdErrorSet) {
1332713327 inferred_err_set_type->data.error_set.err_count = result->value.type->data.error_set.err_count;
1332813328 inferred_err_set_type->data.error_set.errors = result->value.type->data.error_set.errors;
1332913329 }
......@@ -13371,7 +13371,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1337113371 if (type_is_invalid(arg->value.type))
1337213372 return ira->codegen->builtin_types.entry_invalid;
1337313373
13374 if (arg->value.type->id == TypeTableEntryIdArgTuple) {
13374 if (arg->value.type->id == ZigTypeIdArgTuple) {
1337513375 new_fn_arg_count += arg->value.data.x_arg_tuple.end_index - arg->value.data.x_arg_tuple.start_index;
1337613376 } else {
1337713377 new_fn_arg_count += 1;
......@@ -13401,14 +13401,14 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1340113401 size_t next_proto_i = 0;
1340213402
1340313403 if (first_arg_ptr) {
13404 assert(first_arg_ptr->value.type->id == TypeTableEntryIdPointer);
13404 assert(first_arg_ptr->value.type->id == ZigTypeIdPointer);
1340513405
1340613406 bool first_arg_known_bare = false;
1340713407 if (fn_type_id->next_param_index >= 1) {
1340813408 ZigType *param_type = fn_type_id->param_info[next_proto_i].type;
1340913409 if (type_is_invalid(param_type))
1341013410 return ira->codegen->builtin_types.entry_invalid;
13411 first_arg_known_bare = param_type->id != TypeTableEntryIdPointer;
13411 first_arg_known_bare = param_type->id != ZigTypeIdPointer;
1341213412 }
1341313413
1341413414 IrInstruction *first_arg;
......@@ -13437,7 +13437,7 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1343713437 if (type_is_invalid(arg->value.type))
1343813438 return ira->codegen->builtin_types.entry_invalid;
1343913439
13440 if (arg->value.type->id == TypeTableEntryIdArgTuple) {
13440 if (arg->value.type->id == ZigTypeIdArgTuple) {
1344113441 for (size_t arg_tuple_i = arg->value.data.x_arg_tuple.start_index;
1344213442 arg_tuple_i < arg->value.data.x_arg_tuple.end_index; arg_tuple_i += 1)
1344313443 {
......@@ -13616,14 +13616,14 @@ static ZigType *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCall *call_instr
1361613616 IrInstruction **casted_args = allocate<IrInstruction *>(call_param_count);
1361713617 size_t next_arg_index = 0;
1361813618 if (first_arg_ptr) {
13619 assert(first_arg_ptr->value.type->id == TypeTableEntryIdPointer);
13619 assert(first_arg_ptr->value.type->id == ZigTypeIdPointer);
1362013620
1362113621 ZigType *param_type = fn_type_id->param_info[next_arg_index].type;
1362213622 if (type_is_invalid(param_type))
1362313623 return ira->codegen->builtin_types.entry_invalid;
1362413624
1362513625 IrInstruction *first_arg;
13626 if (param_type->id == TypeTableEntryIdPointer &&
13626 if (param_type->id == ZigTypeIdPointer &&
1362713627 handle_is_ptr(first_arg_ptr->value.type->data.pointer.child_type))
1362813628 {
1362913629 first_arg = first_arg_ptr;
......@@ -13712,7 +13712,7 @@ static ZigType *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *c
1371213712 ir_should_inline(ira->new_irb.exec, call_instruction->base.scope);
1371313713
1371413714 if (is_comptime || instr_is_comptime(fn_ref)) {
13715 if (fn_ref->value.type->id == TypeTableEntryIdMetaType) {
13715 if (fn_ref->value.type->id == ZigTypeIdMetaType) {
1371613716 ZigType *dest_type = ir_resolve_type(ira, fn_ref);
1371713717 if (type_is_invalid(dest_type))
1371813718 return ira->codegen->builtin_types.entry_invalid;
......@@ -13733,13 +13733,13 @@ static ZigType *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *c
1373313733
1373413734 ir_link_new_instruction(cast_instruction, &call_instruction->base);
1373513735 return ir_finish_anal(ira, cast_instruction->value.type);
13736 } else if (fn_ref->value.type->id == TypeTableEntryIdFn) {
13736 } else if (fn_ref->value.type->id == ZigTypeIdFn) {
1373713737 ZigFn *fn_table_entry = ir_resolve_fn(ira, fn_ref);
1373813738 if (fn_table_entry == nullptr)
1373913739 return ira->codegen->builtin_types.entry_invalid;
1374013740 return ir_analyze_fn_call(ira, call_instruction, fn_table_entry, fn_table_entry->type_entry,
1374113741 fn_ref, nullptr, is_comptime, call_instruction->fn_inline);
13742 } else if (fn_ref->value.type->id == TypeTableEntryIdBoundFn) {
13742 } else if (fn_ref->value.type->id == ZigTypeIdBoundFn) {
1374313743 assert(fn_ref->value.special == ConstValSpecialStatic);
1374413744 ZigFn *fn_table_entry = fn_ref->value.data.x_bound_fn.fn;
1374513745 IrInstruction *first_arg_ptr = fn_ref->value.data.x_bound_fn.first_arg;
......@@ -13752,7 +13752,7 @@ static ZigType *ir_analyze_instruction_call(IrAnalyze *ira, IrInstructionCall *c
1375213752 }
1375313753 }
1375413754
13755 if (fn_ref->value.type->id == TypeTableEntryIdFn) {
13755 if (fn_ref->value.type->id == ZigTypeIdFn) {
1375613756 return ir_analyze_fn_call(ira, call_instruction, nullptr, fn_ref->value.type,
1375713757 fn_ref, nullptr, false, FnInlineAuto);
1375813758 } else {
......@@ -13801,7 +13801,7 @@ static ZigType *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp *un_op_
1380113801 ZigType *child_type;
1380213802 if (type_is_invalid(ptr_type)) {
1380313803 return ira->codegen->builtin_types.entry_invalid;
13804 } else if (ptr_type->id == TypeTableEntryIdPointer) {
13804 } else if (ptr_type->id == ZigTypeIdPointer) {
1380513805 if (ptr_type->data.pointer.ptr_len == PtrLenUnknown) {
1380613806 ir_add_error_node(ira, un_op_instruction->base.source_node,
1380713807 buf_sprintf("index syntax required for unknown-length pointer type '%s'",
......@@ -13845,38 +13845,38 @@ static ZigType *ir_analyze_maybe(IrAnalyze *ira, IrInstructionUnOp *un_op_instru
1384513845 return ira->codegen->builtin_types.entry_invalid;
1384613846
1384713847 switch (type_entry->id) {
13848 case TypeTableEntryIdInvalid:
13848 case ZigTypeIdInvalid:
1384913849 zig_unreachable();
13850 case TypeTableEntryIdMetaType:
13851 case TypeTableEntryIdVoid:
13852 case TypeTableEntryIdBool:
13853 case TypeTableEntryIdInt:
13854 case TypeTableEntryIdFloat:
13855 case TypeTableEntryIdPointer:
13856 case TypeTableEntryIdArray:
13857 case TypeTableEntryIdStruct:
13858 case TypeTableEntryIdComptimeFloat:
13859 case TypeTableEntryIdComptimeInt:
13860 case TypeTableEntryIdUndefined:
13861 case TypeTableEntryIdNull:
13862 case TypeTableEntryIdOptional:
13863 case TypeTableEntryIdErrorUnion:
13864 case TypeTableEntryIdErrorSet:
13865 case TypeTableEntryIdEnum:
13866 case TypeTableEntryIdUnion:
13867 case TypeTableEntryIdFn:
13868 case TypeTableEntryIdNamespace:
13869 case TypeTableEntryIdBlock:
13870 case TypeTableEntryIdBoundFn:
13871 case TypeTableEntryIdArgTuple:
13872 case TypeTableEntryIdPromise:
13850 case ZigTypeIdMetaType:
13851 case ZigTypeIdVoid:
13852 case ZigTypeIdBool:
13853 case ZigTypeIdInt:
13854 case ZigTypeIdFloat:
13855 case ZigTypeIdPointer:
13856 case ZigTypeIdArray:
13857 case ZigTypeIdStruct:
13858 case ZigTypeIdComptimeFloat:
13859 case ZigTypeIdComptimeInt:
13860 case ZigTypeIdUndefined:
13861 case ZigTypeIdNull:
13862 case ZigTypeIdOptional:
13863 case ZigTypeIdErrorUnion:
13864 case ZigTypeIdErrorSet:
13865 case ZigTypeIdEnum:
13866 case ZigTypeIdUnion:
13867 case ZigTypeIdFn:
13868 case ZigTypeIdNamespace:
13869 case ZigTypeIdBlock:
13870 case ZigTypeIdBoundFn:
13871 case ZigTypeIdArgTuple:
13872 case ZigTypeIdPromise:
1387313873 {
1387413874 ConstExprValue *out_val = ir_build_const_from(ira, &un_op_instruction->base);
1387513875 out_val->data.x_type = get_optional_type(ira->codegen, type_entry);
1387613876 return ira->codegen->builtin_types.entry_type;
1387713877 }
13878 case TypeTableEntryIdUnreachable:
13879 case TypeTableEntryIdOpaque:
13878 case ZigTypeIdUnreachable:
13879 case ZigTypeIdOpaque:
1388013880 ir_add_error_node(ira, un_op_instruction->base.source_node,
1388113881 buf_sprintf("type '%s' not optional", buf_ptr(&type_entry->name)));
1388213882 return ira->codegen->builtin_types.entry_invalid;
......@@ -13892,10 +13892,10 @@ static ZigType *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_ins
1389213892
1389313893 bool is_wrap_op = (un_op_instruction->op_id == IrUnOpNegationWrap);
1389413894
13895 bool is_float = (expr_type->id == TypeTableEntryIdFloat || expr_type->id == TypeTableEntryIdComptimeFloat);
13895 bool is_float = (expr_type->id == ZigTypeIdFloat || expr_type->id == ZigTypeIdComptimeFloat);
1389613896
13897 if ((expr_type->id == TypeTableEntryIdInt && expr_type->data.integral.is_signed) ||
13898 expr_type->id == TypeTableEntryIdComptimeInt || (is_float && !is_wrap_op))
13897 if ((expr_type->id == ZigTypeIdInt && expr_type->data.integral.is_signed) ||
13898 expr_type->id == ZigTypeIdComptimeInt || (is_float && !is_wrap_op))
1389913899 {
1390013900 if (instr_is_comptime(value)) {
1390113901 ConstExprValue *target_const_val = ir_resolve_const(ira, value, UndefBad);
......@@ -13911,7 +13911,7 @@ static ZigType *ir_analyze_negation(IrAnalyze *ira, IrInstructionUnOp *un_op_ins
1391113911 } else {
1391213912 bigint_negate(&out_val->data.x_bigint, &target_const_val->data.x_bigint);
1391313913 }
13914 if (is_wrap_op || is_float || expr_type->id == TypeTableEntryIdComptimeInt) {
13914 if (is_wrap_op || is_float || expr_type->id == ZigTypeIdComptimeInt) {
1391513915 return expr_type;
1391613916 }
1391713917
......@@ -13937,7 +13937,7 @@ static ZigType *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *instructio
1393713937 if (type_is_invalid(expr_type))
1393813938 return ira->codegen->builtin_types.entry_invalid;
1393913939
13940 if (expr_type->id == TypeTableEntryIdInt) {
13940 if (expr_type->id == ZigTypeIdInt) {
1394113941 if (instr_is_comptime(value)) {
1394213942 ConstExprValue *target_const_val = ir_resolve_const(ira, value, UndefBad);
1394313943 if (target_const_val == nullptr)
......@@ -14082,7 +14082,7 @@ static ZigType *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi
1408214082 IrInstruction *old_value = phi_instruction->incoming_values[i];
1408314083 assert(old_value);
1408414084 IrInstruction *new_value = old_value->other;
14085 if (!new_value || new_value->value.type->id == TypeTableEntryIdUnreachable || predecessor->other == nullptr)
14085 if (!new_value || new_value->value.type->id == ZigTypeIdUnreachable || predecessor->other == nullptr)
1408614086 continue;
1408714087
1408814088 if (type_is_invalid(new_value->value.type))
......@@ -14110,17 +14110,17 @@ static ZigType *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPhi *phi
1411014110 if (type_is_invalid(resolved_type))
1411114111 return resolved_type;
1411214112
14113 if (resolved_type->id == TypeTableEntryIdComptimeFloat ||
14114 resolved_type->id == TypeTableEntryIdComptimeInt ||
14115 resolved_type->id == TypeTableEntryIdNull ||
14116 resolved_type->id == TypeTableEntryIdUndefined)
14113 if (resolved_type->id == ZigTypeIdComptimeFloat ||
14114 resolved_type->id == ZigTypeIdComptimeInt ||
14115 resolved_type->id == ZigTypeIdNull ||
14116 resolved_type->id == ZigTypeIdUndefined)
1411714117 {
1411814118 ir_add_error_node(ira, phi_instruction->base.source_node,
1411914119 buf_sprintf("unable to infer expression type"));
1412014120 return ira->codegen->builtin_types.entry_invalid;
1412114121 }
1412214122
14123 bool all_stack_ptrs = (resolved_type->id == TypeTableEntryIdPointer);
14123 bool all_stack_ptrs = (resolved_type->id == ZigTypeIdPointer);
1412414124
1412514125 // cast all values to the resolved type. however we can't put cast instructions in front of the phi instruction.
1412614126 // so we go back and insert the casts as the last instruction in the corresponding predecessor blocks, and
......@@ -14171,7 +14171,7 @@ static ZigType *ir_analyze_instruction_var_ptr(IrAnalyze *ira, IrInstructionVarP
1417114171}
1417214172
1417314173static ZigType *adjust_ptr_align(CodeGen *g, ZigType *ptr_type, uint32_t new_align) {
14174 assert(ptr_type->id == TypeTableEntryIdPointer);
14174 assert(ptr_type->id == ZigTypeIdPointer);
1417514175 return get_pointer_to_type_extra(g,
1417614176 ptr_type->data.pointer.child_type,
1417714177 ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile,
......@@ -14188,7 +14188,7 @@ static ZigType *adjust_slice_align(CodeGen *g, ZigType *slice_type, uint32_t new
1418814188}
1418914189
1419014190static ZigType *adjust_ptr_len(CodeGen *g, ZigType *ptr_type, PtrLen ptr_len) {
14191 assert(ptr_type->id == TypeTableEntryIdPointer);
14191 assert(ptr_type->id == ZigTypeIdPointer);
1419214192 return get_pointer_to_type_extra(g,
1419314193 ptr_type->data.pointer.child_type,
1419414194 ptr_type->data.pointer.is_const, ptr_type->data.pointer.is_volatile,
......@@ -14210,7 +14210,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1421014210 return ira->codegen->builtin_types.entry_invalid;
1421114211
1421214212 ZigType *ptr_type = orig_array_ptr_val->type;
14213 assert(ptr_type->id == TypeTableEntryIdPointer);
14213 assert(ptr_type->id == ZigTypeIdPointer);
1421414214
1421514215 ZigType *array_type = ptr_type->data.pointer.child_type;
1421614216
......@@ -14220,12 +14220,12 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1422014220
1422114221 if (type_is_invalid(array_type)) {
1422214222 return array_type;
14223 } else if (array_type->id == TypeTableEntryIdArray ||
14224 (array_type->id == TypeTableEntryIdPointer &&
14223 } else if (array_type->id == ZigTypeIdArray ||
14224 (array_type->id == ZigTypeIdPointer &&
1422514225 array_type->data.pointer.ptr_len == PtrLenSingle &&
14226 array_type->data.pointer.child_type->id == TypeTableEntryIdArray))
14226 array_type->data.pointer.child_type->id == ZigTypeIdArray))
1422714227 {
14228 if (array_type->id == TypeTableEntryIdPointer) {
14228 if (array_type->id == ZigTypeIdPointer) {
1422914229 array_type = array_type->data.pointer.child_type;
1423014230 ptr_type = ptr_type->data.pointer.child_type;
1423114231 if (orig_array_ptr_val->special != ConstValSpecialRuntime) {
......@@ -14259,7 +14259,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1425914259 elem_ptr_instruction->ptr_len,
1426014260 1, (uint32_t)bit_offset, (uint32_t)bit_width);
1426114261 }
14262 } else if (array_type->id == TypeTableEntryIdPointer) {
14262 } else if (array_type->id == ZigTypeIdPointer) {
1426314263 if (array_type->data.pointer.ptr_len == PtrLenSingle) {
1426414264 ir_add_error_node(ira, elem_ptr_instruction->base.source_node,
1426514265 buf_sprintf("index of single-item pointer"));
......@@ -14269,7 +14269,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1426914269 } else if (is_slice(array_type)) {
1427014270 return_type = adjust_ptr_len(ira->codegen, array_type->data.structure.fields[slice_ptr_index].type_entry,
1427114271 elem_ptr_instruction->ptr_len);
14272 } else if (array_type->id == TypeTableEntryIdArgTuple) {
14272 } else if (array_type->id == ZigTypeIdArgTuple) {
1427314273 ConstExprValue *ptr_val = ir_resolve_const(ira, array_ptr, UndefBad);
1427414274 if (!ptr_val)
1427514275 return ira->codegen->builtin_types.entry_invalid;
......@@ -14320,7 +14320,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1432014320 uint64_t ptr_align = return_type->data.pointer.alignment;
1432114321 if (instr_is_comptime(casted_elem_index)) {
1432214322 uint64_t index = bigint_as_unsigned(&casted_elem_index->value.data.x_bigint);
14323 if (array_type->id == TypeTableEntryIdArray) {
14323 if (array_type->id == ZigTypeIdArray) {
1432414324 uint64_t array_len = array_type->data.array.len;
1432514325 if (index >= array_len) {
1432614326 ir_add_error_node(ira, elem_ptr_instruction->base.source_node,
......@@ -14353,7 +14353,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1435314353
1435414354 if (orig_array_ptr_val->special != ConstValSpecialRuntime &&
1435514355 (orig_array_ptr_val->data.x_ptr.mut != ConstPtrMutRuntimeVar ||
14356 array_type->id == TypeTableEntryIdArray))
14356 array_type->id == ZigTypeIdArray))
1435714357 {
1435814358 ConstExprValue *array_ptr_val = ir_const_ptr_pointee(ira, orig_array_ptr_val,
1435914359 elem_ptr_instruction->base.source_node);
......@@ -14361,10 +14361,10 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1436114361 return ira->codegen->builtin_types.entry_invalid;
1436214362
1436314363 if (array_ptr_val->special != ConstValSpecialRuntime &&
14364 (array_type->id != TypeTableEntryIdPointer ||
14364 (array_type->id != ZigTypeIdPointer ||
1436514365 array_ptr_val->data.x_ptr.special != ConstPtrSpecialHardCodedAddr))
1436614366 {
14367 if (array_type->id == TypeTableEntryIdPointer) {
14367 if (array_type->id == ZigTypeIdPointer) {
1436814368 ConstExprValue *out_val = ir_build_const_from(ira, &elem_ptr_instruction->base);
1436914369 out_val->data.x_ptr.mut = array_ptr_val->data.x_ptr.mut;
1437014370 size_t new_index;
......@@ -14461,7 +14461,7 @@ static ZigType *ir_analyze_instruction_elem_ptr(IrAnalyze *ira, IrInstructionEle
1446114461 zig_panic("TODO elem ptr on a slice that was ptrcast from a function");
1446214462 }
1446314463 return return_type;
14464 } else if (array_type->id == TypeTableEntryIdArray) {
14464 } else if (array_type->id == ZigTypeIdArray) {
1446514465 ConstExprValue *out_val = ir_build_const_from(ira, &elem_ptr_instruction->base);
1446614466 out_val->data.x_ptr.special = ConstPtrSpecialBaseArray;
1446714467 out_val->data.x_ptr.mut = orig_array_ptr_val->data.x_ptr.mut;
......@@ -14521,11 +14521,11 @@ static IrInstruction *ir_analyze_container_member_access_inner(IrAnalyze *ira,
1452114521 const char *prefix_name;
1452214522 if (is_slice(bare_struct_type)) {
1452314523 prefix_name = "";
14524 } else if (bare_struct_type->id == TypeTableEntryIdStruct) {
14524 } else if (bare_struct_type->id == ZigTypeIdStruct) {
1452514525 prefix_name = "struct ";
14526 } else if (bare_struct_type->id == TypeTableEntryIdEnum) {
14526 } else if (bare_struct_type->id == ZigTypeIdEnum) {
1452714527 prefix_name = "enum ";
14528 } else if (bare_struct_type->id == TypeTableEntryIdUnion) {
14528 } else if (bare_struct_type->id == ZigTypeIdUnion) {
1452914529 prefix_name = "union ";
1453014530 } else {
1453114531 prefix_name = "";
......@@ -14544,10 +14544,10 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
1454414544 if ((err = ensure_complete_type(ira->codegen, bare_type)))
1454514545 return ira->codegen->invalid_instruction;
1454614546
14547 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
14547 assert(container_ptr->value.type->id == ZigTypeIdPointer);
1454814548 bool is_const = container_ptr->value.type->data.pointer.is_const;
1454914549 bool is_volatile = container_ptr->value.type->data.pointer.is_volatile;
14550 if (bare_type->id == TypeTableEntryIdStruct) {
14550 if (bare_type->id == ZigTypeIdStruct) {
1455114551 TypeStructField *field = find_struct_type_field(bare_type, field_name);
1455214552 if (field) {
1455314553 bool is_packed = (bare_type->data.structure.layout == ContainerLayoutPacked);
......@@ -14594,10 +14594,10 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
1459414594 return ir_analyze_container_member_access_inner(ira, bare_type, field_name,
1459514595 source_instr, container_ptr, container_type);
1459614596 }
14597 } else if (bare_type->id == TypeTableEntryIdEnum) {
14597 } else if (bare_type->id == ZigTypeIdEnum) {
1459814598 return ir_analyze_container_member_access_inner(ira, bare_type, field_name,
1459914599 source_instr, container_ptr, container_type);
14600 } else if (bare_type->id == TypeTableEntryIdUnion) {
14600 } else if (bare_type->id == ZigTypeIdUnion) {
1460114601 TypeUnionField *field = find_union_type_field(bare_type, field_name);
1460214602 if (field) {
1460314603 if (instr_is_comptime(container_ptr)) {
......@@ -14626,7 +14626,7 @@ static IrInstruction *ir_analyze_container_field_ptr(IrAnalyze *ira, Buf *field_
1462614626 ConstExprValue *payload_val = union_val->data.x_union.payload;
1462714627
1462814628 ZigType *field_type = field->type_entry;
14629 if (field_type->id == TypeTableEntryIdVoid) {
14629 if (field_type->id == ZigTypeIdVoid) {
1463014630 assert(payload_val == nullptr);
1463114631 payload_val = create_const_vals(1);
1463214632 payload_val->special = ConstValSpecialStatic;
......@@ -14732,7 +14732,7 @@ static ZigType *ir_analyze_decl_ref(IrAnalyze *ira, IrInstruction *source_instru
1473214732}
1473314733
1473414734static ErrorTableEntry *find_err_table_entry(ZigType *err_set_type, Buf *field_name) {
14735 assert(err_set_type->id == TypeTableEntryIdErrorSet);
14735 assert(err_set_type->id == ZigTypeIdErrorSet);
1473614736 for (uint32_t i = 0; i < err_set_type->data.error_set.err_count; i += 1) {
1473714737 ErrorTableEntry *err_table_entry = err_set_type->data.error_set.errors[i];
1473814738 if (buf_eql_buf(&err_table_entry->name, field_name)) {
......@@ -14749,7 +14749,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1474914749 return ira->codegen->builtin_types.entry_invalid;
1475014750
1475114751 ZigType *container_type = container_ptr->value.type->data.pointer.child_type;
14752 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
14752 assert(container_ptr->value.type->id == ZigTypeIdPointer);
1475314753
1475414754 Buf *field_name = field_ptr_instruction->field_name_buffer;
1475514755 if (!field_name) {
......@@ -14765,8 +14765,8 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1476514765 if (type_is_invalid(container_type)) {
1476614766 return container_type;
1476714767 } else if (is_container_ref(container_type)) {
14768 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
14769 if (container_type->id == TypeTableEntryIdPointer) {
14768 assert(container_ptr->value.type->id == ZigTypeIdPointer);
14769 if (container_type->id == ZigTypeIdPointer) {
1477014770 ZigType *bare_type = container_ref_type(container_type);
1477114771 IrInstruction *container_child = ir_get_deref(ira, &field_ptr_instruction->base, container_ptr);
1477214772 IrInstruction *result = ir_analyze_container_field_ptr(ira, field_name, &field_ptr_instruction->base, container_child, bare_type);
......@@ -14780,7 +14780,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1478014780 } else if (is_array_ref(container_type)) {
1478114781 if (buf_eql_str(field_name, "len")) {
1478214782 ConstExprValue *len_val = create_const_vals(1);
14783 if (container_type->id == TypeTableEntryIdPointer) {
14783 if (container_type->id == ZigTypeIdPointer) {
1478414784 init_const_usize(ira->codegen, len_val, container_type->data.pointer.child_type->data.array.len);
1478514785 } else {
1478614786 init_const_usize(ira->codegen, len_val, container_type->data.array.len);
......@@ -14797,12 +14797,12 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1479714797 buf_ptr(&container_type->name)));
1479814798 return ira->codegen->builtin_types.entry_invalid;
1479914799 }
14800 } else if (container_type->id == TypeTableEntryIdArgTuple) {
14800 } else if (container_type->id == ZigTypeIdArgTuple) {
1480114801 ConstExprValue *container_ptr_val = ir_resolve_const(ira, container_ptr, UndefBad);
1480214802 if (!container_ptr_val)
1480314803 return ira->codegen->builtin_types.entry_invalid;
1480414804
14805 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
14805 assert(container_ptr->value.type->id == ZigTypeIdPointer);
1480614806 ConstExprValue *child_val = ir_const_ptr_pointee(ira, container_ptr_val, source_node);
1480714807 if (child_val == nullptr)
1480814808 return ira->codegen->builtin_types.entry_invalid;
......@@ -14823,12 +14823,12 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1482314823 buf_ptr(&container_type->name)));
1482414824 return ira->codegen->builtin_types.entry_invalid;
1482514825 }
14826 } else if (container_type->id == TypeTableEntryIdMetaType) {
14826 } else if (container_type->id == ZigTypeIdMetaType) {
1482714827 ConstExprValue *container_ptr_val = ir_resolve_const(ira, container_ptr, UndefBad);
1482814828 if (!container_ptr_val)
1482914829 return ira->codegen->builtin_types.entry_invalid;
1483014830
14831 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
14831 assert(container_ptr->value.type->id == ZigTypeIdPointer);
1483214832 ConstExprValue *child_val = ir_const_ptr_pointee(ira, container_ptr_val, source_node);
1483314833 if (child_val == nullptr)
1483414834 return ira->codegen->builtin_types.entry_invalid;
......@@ -14841,14 +14841,14 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1484114841 bool ptr_is_const = true;
1484214842 bool ptr_is_volatile = false;
1484314843 TypeStructField *ptr_field = &child_type->data.structure.fields[slice_ptr_index];
14844 assert(ptr_field->type_entry->id == TypeTableEntryIdPointer);
14844 assert(ptr_field->type_entry->id == ZigTypeIdPointer);
1484514845 ZigType *child_type = ptr_field->type_entry->data.pointer.child_type;
1484614846 return ir_analyze_const_ptr(ira, &field_ptr_instruction->base,
1484714847 create_const_type(ira->codegen, child_type),
1484814848 ira->codegen->builtin_types.entry_type,
1484914849 ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile);
1485014850 }
14851 if (child_type->id == TypeTableEntryIdEnum) {
14851 if (child_type->id == ZigTypeIdEnum) {
1485214852 if ((err = ensure_complete_type(ira->codegen, child_type)))
1485314853 return ira->codegen->builtin_types.entry_invalid;
1485414854
......@@ -14869,7 +14869,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1486914869 return ir_analyze_decl_ref(ira, &field_ptr_instruction->base, tld);
1487014870 }
1487114871 }
14872 if (child_type->id == TypeTableEntryIdUnion &&
14872 if (child_type->id == ZigTypeIdUnion &&
1487314873 (child_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr ||
1487414874 child_type->data.unionation.decl_node->data.container_decl.auto_enum))
1487514875 {
......@@ -14889,7 +14889,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1488914889 buf_sprintf("container '%s' has no member called '%s'",
1489014890 buf_ptr(&child_type->name), buf_ptr(field_name)));
1489114891 return ira->codegen->builtin_types.entry_invalid;
14892 } else if (child_type->id == TypeTableEntryIdErrorSet) {
14892 } else if (child_type->id == ZigTypeIdErrorSet) {
1489314893 ErrorTableEntry *err_entry;
1489414894 ZigType *err_set_type;
1489514895 if (type_is_global_error_set(child_type)) {
......@@ -14935,7 +14935,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1493514935 bool ptr_is_volatile = false;
1493614936 return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, const_val,
1493714937 err_set_type, ConstPtrMutComptimeConst, ptr_is_const, ptr_is_volatile);
14938 } else if (child_type->id == TypeTableEntryIdInt) {
14938 } else if (child_type->id == ZigTypeIdInt) {
1493914939 if (buf_eql_str(field_name, "bit_count")) {
1494014940 bool ptr_is_const = true;
1494114941 bool ptr_is_volatile = false;
......@@ -14957,7 +14957,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1495714957 buf_ptr(&child_type->name), buf_ptr(field_name)));
1495814958 return ira->codegen->builtin_types.entry_invalid;
1495914959 }
14960 } else if (child_type->id == TypeTableEntryIdFloat) {
14960 } else if (child_type->id == ZigTypeIdFloat) {
1496114961 if (buf_eql_str(field_name, "bit_count")) {
1496214962 bool ptr_is_const = true;
1496314963 bool ptr_is_volatile = false;
......@@ -14972,7 +14972,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1497214972 buf_ptr(&child_type->name), buf_ptr(field_name)));
1497314973 return ira->codegen->builtin_types.entry_invalid;
1497414974 }
14975 } else if (child_type->id == TypeTableEntryIdPointer) {
14975 } else if (child_type->id == ZigTypeIdPointer) {
1497614976 if (buf_eql_str(field_name, "Child")) {
1497714977 bool ptr_is_const = true;
1497814978 bool ptr_is_volatile = false;
......@@ -14994,7 +14994,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1499414994 buf_ptr(&child_type->name), buf_ptr(field_name)));
1499514995 return ira->codegen->builtin_types.entry_invalid;
1499614996 }
14997 } else if (child_type->id == TypeTableEntryIdArray) {
14997 } else if (child_type->id == ZigTypeIdArray) {
1499814998 if (buf_eql_str(field_name, "Child")) {
1499914999 bool ptr_is_const = true;
1500015000 bool ptr_is_volatile = false;
......@@ -15016,7 +15016,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1501615016 buf_ptr(&child_type->name), buf_ptr(field_name)));
1501715017 return ira->codegen->builtin_types.entry_invalid;
1501815018 }
15019 } else if (child_type->id == TypeTableEntryIdErrorUnion) {
15019 } else if (child_type->id == ZigTypeIdErrorUnion) {
1502015020 if (buf_eql_str(field_name, "Payload")) {
1502115021 bool ptr_is_const = true;
1502215022 bool ptr_is_volatile = false;
......@@ -15037,7 +15037,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1503715037 buf_ptr(&child_type->name), buf_ptr(field_name)));
1503815038 return ira->codegen->builtin_types.entry_invalid;
1503915039 }
15040 } else if (child_type->id == TypeTableEntryIdOptional) {
15040 } else if (child_type->id == ZigTypeIdOptional) {
1504115041 if (buf_eql_str(field_name, "Child")) {
1504215042 bool ptr_is_const = true;
1504315043 bool ptr_is_volatile = false;
......@@ -15051,7 +15051,7 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1505115051 buf_ptr(&child_type->name), buf_ptr(field_name)));
1505215052 return ira->codegen->builtin_types.entry_invalid;
1505315053 }
15054 } else if (child_type->id == TypeTableEntryIdFn) {
15054 } else if (child_type->id == ZigTypeIdFn) {
1505515055 if (buf_eql_str(field_name, "ReturnType")) {
1505615056 if (child_type->data.fn.fn_type_id.return_type == nullptr) {
1505715057 // Return type can only ever be null, if the function is generic
......@@ -15093,8 +15093,8 @@ static ZigType *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstructionFi
1509315093 buf_sprintf("type '%s' does not support field access", buf_ptr(&child_type->name)));
1509415094 return ira->codegen->builtin_types.entry_invalid;
1509515095 }
15096 } else if (container_type->id == TypeTableEntryIdNamespace) {
15097 assert(container_ptr->value.type->id == TypeTableEntryIdPointer);
15096 } else if (container_type->id == ZigTypeIdNamespace) {
15097 assert(container_ptr->value.type->id == ZigTypeIdPointer);
1509815098 ConstExprValue *container_ptr_val = ir_resolve_const(ira, container_ptr, UndefBad);
1509915099 if (!container_ptr_val)
1510015100 return ira->codegen->builtin_types.entry_invalid;
......@@ -15151,7 +15151,7 @@ static ZigType *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstructionSt
1515115151 if (type_is_invalid(value->value.type))
1515215152 return value->value.type;
1515315153
15154 if (ptr->value.type->id != TypeTableEntryIdPointer) {
15154 if (ptr->value.type->id != ZigTypeIdPointer) {
1515515155 ir_add_error(ira, ptr,
1515615156 buf_sprintf("attempt to dereference non pointer type '%s'", buf_ptr(&ptr->value.type->name)));
1515715157 return ira->codegen->builtin_types.entry_invalid;
......@@ -15208,33 +15208,33 @@ static ZigType *ir_analyze_instruction_typeof(IrAnalyze *ira, IrInstructionTypeO
1520815208 if (type_is_invalid(type_entry))
1520915209 return ira->codegen->builtin_types.entry_invalid;
1521015210 switch (type_entry->id) {
15211 case TypeTableEntryIdInvalid:
15211 case ZigTypeIdInvalid:
1521215212 zig_unreachable(); // handled above
15213 case TypeTableEntryIdComptimeFloat:
15214 case TypeTableEntryIdComptimeInt:
15215 case TypeTableEntryIdUndefined:
15216 case TypeTableEntryIdNull:
15217 case TypeTableEntryIdNamespace:
15218 case TypeTableEntryIdBlock:
15219 case TypeTableEntryIdBoundFn:
15220 case TypeTableEntryIdMetaType:
15221 case TypeTableEntryIdVoid:
15222 case TypeTableEntryIdBool:
15223 case TypeTableEntryIdUnreachable:
15224 case TypeTableEntryIdInt:
15225 case TypeTableEntryIdFloat:
15226 case TypeTableEntryIdPointer:
15227 case TypeTableEntryIdArray:
15228 case TypeTableEntryIdStruct:
15229 case TypeTableEntryIdOptional:
15230 case TypeTableEntryIdErrorUnion:
15231 case TypeTableEntryIdErrorSet:
15232 case TypeTableEntryIdEnum:
15233 case TypeTableEntryIdUnion:
15234 case TypeTableEntryIdFn:
15235 case TypeTableEntryIdArgTuple:
15236 case TypeTableEntryIdOpaque:
15237 case TypeTableEntryIdPromise:
15213 case ZigTypeIdComptimeFloat:
15214 case ZigTypeIdComptimeInt:
15215 case ZigTypeIdUndefined:
15216 case ZigTypeIdNull:
15217 case ZigTypeIdNamespace:
15218 case ZigTypeIdBlock:
15219 case ZigTypeIdBoundFn:
15220 case ZigTypeIdMetaType:
15221 case ZigTypeIdVoid:
15222 case ZigTypeIdBool:
15223 case ZigTypeIdUnreachable:
15224 case ZigTypeIdInt:
15225 case ZigTypeIdFloat:
15226 case ZigTypeIdPointer:
15227 case ZigTypeIdArray:
15228 case ZigTypeIdStruct:
15229 case ZigTypeIdOptional:
15230 case ZigTypeIdErrorUnion:
15231 case ZigTypeIdErrorSet:
15232 case ZigTypeIdEnum:
15233 case ZigTypeIdUnion:
15234 case ZigTypeIdFn:
15235 case ZigTypeIdArgTuple:
15236 case ZigTypeIdOpaque:
15237 case ZigTypeIdPromise:
1523815238 {
1523915239 ConstExprValue *out_val = ir_build_const_from(ira, &typeof_instruction->base);
1524015240 out_val->data.x_type = type_entry;
......@@ -15255,11 +15255,11 @@ static ZigType *ir_analyze_instruction_to_ptr_type(IrAnalyze *ira,
1525515255 return type_entry;
1525615256
1525715257 ZigType *ptr_type;
15258 if (type_entry->id == TypeTableEntryIdArray) {
15258 if (type_entry->id == ZigTypeIdArray) {
1525915259 ptr_type = get_pointer_to_type(ira->codegen, type_entry->data.array.child_type, false);
1526015260 } else if (is_slice(type_entry)) {
1526115261 ptr_type = adjust_ptr_len(ira->codegen, type_entry->data.structure.fields[0].type_entry, PtrLenSingle);
15262 } else if (type_entry->id == TypeTableEntryIdArgTuple) {
15262 } else if (type_entry->id == ZigTypeIdArgTuple) {
1526315263 ConstExprValue *arg_tuple_val = ir_resolve_const(ira, value, UndefBad);
1526415264 if (!arg_tuple_val)
1526515265 return ira->codegen->builtin_types.entry_invalid;
......@@ -15283,7 +15283,7 @@ static ZigType *ir_analyze_instruction_ptr_type_child(IrAnalyze *ira,
1528315283 if (type_is_invalid(type_entry))
1528415284 return type_entry;
1528515285
15286 if (type_entry->id != TypeTableEntryIdPointer) {
15286 if (type_entry->id != ZigTypeIdPointer) {
1528715287 ir_add_error_node(ira, ptr_type_child_instruction->base.source_node,
1528815288 buf_sprintf("expected pointer type, found '%s'", buf_ptr(&type_entry->name)));
1528915289 return ira->codegen->builtin_types.entry_invalid;
......@@ -15400,24 +15400,24 @@ static ZigType *ir_analyze_instruction_set_float_mode(IrAnalyze *ira,
1540015400
1540115401 bool *fast_math_on_ptr;
1540215402 AstNode **fast_math_set_node_ptr;
15403 if (target_type->id == TypeTableEntryIdBlock) {
15403 if (target_type->id == ZigTypeIdBlock) {
1540415404 ScopeBlock *block_scope = (ScopeBlock *)target_val->data.x_block;
1540515405 fast_math_on_ptr = &block_scope->fast_math_on;
1540615406 fast_math_set_node_ptr = &block_scope->fast_math_set_node;
15407 } else if (target_type->id == TypeTableEntryIdFn) {
15407 } else if (target_type->id == ZigTypeIdFn) {
1540815408 assert(target_val->data.x_ptr.special == ConstPtrSpecialFunction);
1540915409 ZigFn *target_fn = target_val->data.x_ptr.data.fn.fn_entry;
1541015410 assert(target_fn->def_scope);
1541115411 fast_math_on_ptr = &target_fn->def_scope->fast_math_on;
1541215412 fast_math_set_node_ptr = &target_fn->def_scope->fast_math_set_node;
15413 } else if (target_type->id == TypeTableEntryIdMetaType) {
15413 } else if (target_type->id == ZigTypeIdMetaType) {
1541415414 ScopeDecls *decls_scope;
1541515415 ZigType *type_arg = target_val->data.x_type;
15416 if (type_arg->id == TypeTableEntryIdStruct) {
15416 if (type_arg->id == ZigTypeIdStruct) {
1541715417 decls_scope = type_arg->data.structure.decls_scope;
15418 } else if (type_arg->id == TypeTableEntryIdEnum) {
15418 } else if (type_arg->id == ZigTypeIdEnum) {
1541915419 decls_scope = type_arg->data.enumeration.decls_scope;
15420 } else if (type_arg->id == TypeTableEntryIdUnion) {
15420 } else if (type_arg->id == ZigTypeIdUnion) {
1542115421 decls_scope = type_arg->data.unionation.decls_scope;
1542215422 } else {
1542315423 ir_add_error_node(ira, target_instruction->source_node,
......@@ -15476,36 +15476,36 @@ static ZigType *ir_analyze_instruction_slice_type(IrAnalyze *ira,
1547615476 bool is_volatile = slice_type_instruction->is_volatile;
1547715477
1547815478 switch (child_type->id) {
15479 case TypeTableEntryIdInvalid: // handled above
15479 case ZigTypeIdInvalid: // handled above
1548015480 zig_unreachable();
15481 case TypeTableEntryIdUnreachable:
15482 case TypeTableEntryIdUndefined:
15483 case TypeTableEntryIdNull:
15484 case TypeTableEntryIdBlock:
15485 case TypeTableEntryIdArgTuple:
15486 case TypeTableEntryIdOpaque:
15481 case ZigTypeIdUnreachable:
15482 case ZigTypeIdUndefined:
15483 case ZigTypeIdNull:
15484 case ZigTypeIdBlock:
15485 case ZigTypeIdArgTuple:
15486 case ZigTypeIdOpaque:
1548715487 ir_add_error_node(ira, slice_type_instruction->base.source_node,
1548815488 buf_sprintf("slice of type '%s' not allowed", buf_ptr(&child_type->name)));
1548915489 return ira->codegen->builtin_types.entry_invalid;
15490 case TypeTableEntryIdMetaType:
15491 case TypeTableEntryIdVoid:
15492 case TypeTableEntryIdBool:
15493 case TypeTableEntryIdInt:
15494 case TypeTableEntryIdFloat:
15495 case TypeTableEntryIdPointer:
15496 case TypeTableEntryIdArray:
15497 case TypeTableEntryIdStruct:
15498 case TypeTableEntryIdComptimeFloat:
15499 case TypeTableEntryIdComptimeInt:
15500 case TypeTableEntryIdOptional:
15501 case TypeTableEntryIdErrorUnion:
15502 case TypeTableEntryIdErrorSet:
15503 case TypeTableEntryIdEnum:
15504 case TypeTableEntryIdUnion:
15505 case TypeTableEntryIdFn:
15506 case TypeTableEntryIdNamespace:
15507 case TypeTableEntryIdBoundFn:
15508 case TypeTableEntryIdPromise:
15490 case ZigTypeIdMetaType:
15491 case ZigTypeIdVoid:
15492 case ZigTypeIdBool:
15493 case ZigTypeIdInt:
15494 case ZigTypeIdFloat:
15495 case ZigTypeIdPointer:
15496 case ZigTypeIdArray:
15497 case ZigTypeIdStruct:
15498 case ZigTypeIdComptimeFloat:
15499 case ZigTypeIdComptimeInt:
15500 case ZigTypeIdOptional:
15501 case ZigTypeIdErrorUnion:
15502 case ZigTypeIdErrorSet:
15503 case ZigTypeIdEnum:
15504 case ZigTypeIdUnion:
15505 case ZigTypeIdFn:
15506 case ZigTypeIdNamespace:
15507 case ZigTypeIdBoundFn:
15508 case ZigTypeIdPromise:
1550915509 {
1551015510 if ((err = type_ensure_zero_bits_known(ira->codegen, child_type)))
1551115511 return ira->codegen->builtin_types.entry_invalid;
......@@ -15587,36 +15587,36 @@ static ZigType *ir_analyze_instruction_array_type(IrAnalyze *ira,
1558715587 if (type_is_invalid(child_type))
1558815588 return ira->codegen->builtin_types.entry_invalid;
1558915589 switch (child_type->id) {
15590 case TypeTableEntryIdInvalid: // handled above
15590 case ZigTypeIdInvalid: // handled above
1559115591 zig_unreachable();
15592 case TypeTableEntryIdUnreachable:
15593 case TypeTableEntryIdUndefined:
15594 case TypeTableEntryIdNull:
15595 case TypeTableEntryIdBlock:
15596 case TypeTableEntryIdArgTuple:
15597 case TypeTableEntryIdOpaque:
15592 case ZigTypeIdUnreachable:
15593 case ZigTypeIdUndefined:
15594 case ZigTypeIdNull:
15595 case ZigTypeIdBlock:
15596 case ZigTypeIdArgTuple:
15597 case ZigTypeIdOpaque:
1559815598 ir_add_error_node(ira, array_type_instruction->base.source_node,
1559915599 buf_sprintf("array of type '%s' not allowed", buf_ptr(&child_type->name)));
1560015600 return ira->codegen->builtin_types.entry_invalid;
15601 case TypeTableEntryIdMetaType:
15602 case TypeTableEntryIdVoid:
15603 case TypeTableEntryIdBool:
15604 case TypeTableEntryIdInt:
15605 case TypeTableEntryIdFloat:
15606 case TypeTableEntryIdPointer:
15607 case TypeTableEntryIdArray:
15608 case TypeTableEntryIdStruct:
15609 case TypeTableEntryIdComptimeFloat:
15610 case TypeTableEntryIdComptimeInt:
15611 case TypeTableEntryIdOptional:
15612 case TypeTableEntryIdErrorUnion:
15613 case TypeTableEntryIdErrorSet:
15614 case TypeTableEntryIdEnum:
15615 case TypeTableEntryIdUnion:
15616 case TypeTableEntryIdFn:
15617 case TypeTableEntryIdNamespace:
15618 case TypeTableEntryIdBoundFn:
15619 case TypeTableEntryIdPromise:
15601 case ZigTypeIdMetaType:
15602 case ZigTypeIdVoid:
15603 case ZigTypeIdBool:
15604 case ZigTypeIdInt:
15605 case ZigTypeIdFloat:
15606 case ZigTypeIdPointer:
15607 case ZigTypeIdArray:
15608 case ZigTypeIdStruct:
15609 case ZigTypeIdComptimeFloat:
15610 case ZigTypeIdComptimeInt:
15611 case ZigTypeIdOptional:
15612 case ZigTypeIdErrorUnion:
15613 case ZigTypeIdErrorSet:
15614 case ZigTypeIdEnum:
15615 case ZigTypeIdUnion:
15616 case ZigTypeIdFn:
15617 case ZigTypeIdNamespace:
15618 case ZigTypeIdBoundFn:
15619 case ZigTypeIdPromise:
1562015620 {
1562115621 if ((err = ensure_complete_type(ira->codegen, child_type)))
1562215622 return ira->codegen->builtin_types.entry_invalid;
......@@ -15658,36 +15658,36 @@ static ZigType *ir_analyze_instruction_size_of(IrAnalyze *ira,
1565815658 return ira->codegen->builtin_types.entry_invalid;
1565915659
1566015660 switch (type_entry->id) {
15661 case TypeTableEntryIdInvalid: // handled above
15661 case ZigTypeIdInvalid: // handled above
1566215662 zig_unreachable();
15663 case TypeTableEntryIdUnreachable:
15664 case TypeTableEntryIdUndefined:
15665 case TypeTableEntryIdNull:
15666 case TypeTableEntryIdBlock:
15667 case TypeTableEntryIdComptimeFloat:
15668 case TypeTableEntryIdComptimeInt:
15669 case TypeTableEntryIdBoundFn:
15670 case TypeTableEntryIdMetaType:
15671 case TypeTableEntryIdNamespace:
15672 case TypeTableEntryIdArgTuple:
15673 case TypeTableEntryIdOpaque:
15663 case ZigTypeIdUnreachable:
15664 case ZigTypeIdUndefined:
15665 case ZigTypeIdNull:
15666 case ZigTypeIdBlock:
15667 case ZigTypeIdComptimeFloat:
15668 case ZigTypeIdComptimeInt:
15669 case ZigTypeIdBoundFn:
15670 case ZigTypeIdMetaType:
15671 case ZigTypeIdNamespace:
15672 case ZigTypeIdArgTuple:
15673 case ZigTypeIdOpaque:
1567415674 ir_add_error_node(ira, size_of_instruction->base.source_node,
1567515675 buf_sprintf("no size available for type '%s'", buf_ptr(&type_entry->name)));
1567615676 return ira->codegen->builtin_types.entry_invalid;
15677 case TypeTableEntryIdVoid:
15678 case TypeTableEntryIdBool:
15679 case TypeTableEntryIdInt:
15680 case TypeTableEntryIdFloat:
15681 case TypeTableEntryIdPointer:
15682 case TypeTableEntryIdArray:
15683 case TypeTableEntryIdStruct:
15684 case TypeTableEntryIdOptional:
15685 case TypeTableEntryIdErrorUnion:
15686 case TypeTableEntryIdErrorSet:
15687 case TypeTableEntryIdEnum:
15688 case TypeTableEntryIdUnion:
15689 case TypeTableEntryIdFn:
15690 case TypeTableEntryIdPromise:
15677 case ZigTypeIdVoid:
15678 case ZigTypeIdBool:
15679 case ZigTypeIdInt:
15680 case ZigTypeIdFloat:
15681 case ZigTypeIdPointer:
15682 case ZigTypeIdArray:
15683 case ZigTypeIdStruct:
15684 case ZigTypeIdOptional:
15685 case ZigTypeIdErrorUnion:
15686 case ZigTypeIdErrorSet:
15687 case ZigTypeIdEnum:
15688 case ZigTypeIdUnion:
15689 case ZigTypeIdFn:
15690 case ZigTypeIdPromise:
1569115691 {
1569215692 uint64_t size_in_bytes = type_size(ira->codegen, type_entry);
1569315693 ConstExprValue *out_val = ir_build_const_from(ira, &size_of_instruction->base);
......@@ -15705,7 +15705,7 @@ static ZigType *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructi
1570515705
1570615706 ZigType *type_entry = value->value.type;
1570715707
15708 if (type_entry->id == TypeTableEntryIdOptional) {
15708 if (type_entry->id == ZigTypeIdOptional) {
1570915709 if (instr_is_comptime(value)) {
1571015710 ConstExprValue *maybe_val = ir_resolve_const(ira, value, UndefBad);
1571115711 if (!maybe_val)
......@@ -15718,7 +15718,7 @@ static ZigType *ir_analyze_instruction_test_non_null(IrAnalyze *ira, IrInstructi
1571815718
1571915719 ir_build_test_nonnull_from(&ira->new_irb, &instruction->base, value);
1572015720 return ira->codegen->builtin_types.entry_bool;
15721 } else if (type_entry->id == TypeTableEntryIdNull) {
15721 } else if (type_entry->id == ZigTypeIdNull) {
1572215722 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1572315723 out_val->data.x_bool = false;
1572415724 return ira->codegen->builtin_types.entry_bool;
......@@ -15737,12 +15737,12 @@ static ZigType *ir_analyze_instruction_unwrap_maybe(IrAnalyze *ira,
1573715737 return ira->codegen->builtin_types.entry_invalid;
1573815738
1573915739 ZigType *ptr_type = value->value.type;
15740 assert(ptr_type->id == TypeTableEntryIdPointer);
15740 assert(ptr_type->id == ZigTypeIdPointer);
1574115741
1574215742 ZigType *type_entry = ptr_type->data.pointer.child_type;
1574315743 if (type_is_invalid(type_entry)) {
1574415744 return ira->codegen->builtin_types.entry_invalid;
15745 } else if (type_entry->id != TypeTableEntryIdOptional) {
15745 } else if (type_entry->id != ZigTypeIdOptional) {
1574615746 ir_add_error_node(ira, unwrap_maybe_instruction->value->source_node,
1574715747 buf_sprintf("expected optional type, found '%s'", buf_ptr(&type_entry->name)));
1574815748 return ira->codegen->builtin_types.entry_invalid;
......@@ -15787,7 +15787,7 @@ static ZigType *ir_analyze_instruction_ctz(IrAnalyze *ira, IrInstructionCtz *ctz
1578715787 IrInstruction *value = ctz_instruction->value->other;
1578815788 if (type_is_invalid(value->value.type)) {
1578915789 return ira->codegen->builtin_types.entry_invalid;
15790 } else if (value->value.type->id == TypeTableEntryIdInt) {
15790 } else if (value->value.type->id == ZigTypeIdInt) {
1579115791 ZigType *return_type = get_smallest_unsigned_int_type(ira->codegen,
1579215792 value->value.type->data.integral.bit_count);
1579315793 if (value->value.special != ConstValSpecialRuntime) {
......@@ -15811,7 +15811,7 @@ static ZigType *ir_analyze_instruction_clz(IrAnalyze *ira, IrInstructionClz *clz
1581115811 IrInstruction *value = clz_instruction->value->other;
1581215812 if (type_is_invalid(value->value.type)) {
1581315813 return ira->codegen->builtin_types.entry_invalid;
15814 } else if (value->value.type->id == TypeTableEntryIdInt) {
15814 } else if (value->value.type->id == ZigTypeIdInt) {
1581515815 ZigType *return_type = get_smallest_unsigned_int_type(ira->codegen,
1581615816 value->value.type->data.integral.bit_count);
1581715817 if (value->value.special != ConstValSpecialRuntime) {
......@@ -15836,7 +15836,7 @@ static ZigType *ir_analyze_instruction_pop_count(IrAnalyze *ira, IrInstructionPo
1583615836 if (type_is_invalid(value->value.type))
1583715837 return ira->codegen->builtin_types.entry_invalid;
1583815838
15839 if (value->value.type->id != TypeTableEntryIdInt && value->value.type->id != TypeTableEntryIdComptimeInt) {
15839 if (value->value.type->id != ZigTypeIdInt && value->value.type->id != ZigTypeIdComptimeInt) {
1584015840 ir_add_error(ira, value,
1584115841 buf_sprintf("expected integer type, found '%s'", buf_ptr(&value->value.type->name)));
1584215842 return ira->codegen->builtin_types.entry_invalid;
......@@ -15852,7 +15852,7 @@ static ZigType *ir_analyze_instruction_pop_count(IrAnalyze *ira, IrInstructionPo
1585215852 bigint_init_unsigned(&out_val->data.x_bigint, result);
1585315853 return ira->codegen->builtin_types.entry_num_lit_int;
1585415854 }
15855 if (value->value.type->id == TypeTableEntryIdComptimeInt) {
15855 if (value->value.type->id == ZigTypeIdComptimeInt) {
1585615856 Buf *val_buf = buf_alloc();
1585715857 bigint_append_buf(val_buf, &val->data.x_bigint, 10);
1585815858 ir_add_error(ira, &instruction->base,
......@@ -15877,11 +15877,11 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source
1587715877 if (type_is_invalid(value->value.type))
1587815878 return ira->codegen->invalid_instruction;
1587915879
15880 if (value->value.type->id == TypeTableEntryIdEnum) {
15880 if (value->value.type->id == ZigTypeIdEnum) {
1588115881 return value;
1588215882 }
1588315883
15884 if (value->value.type->id != TypeTableEntryIdUnion) {
15884 if (value->value.type->id != ZigTypeIdUnion) {
1588515885 ir_add_error(ira, value,
1588615886 buf_sprintf("expected enum or union type, found '%s'", buf_ptr(&value->value.type->name)));
1588715887 return ira->codegen->invalid_instruction;
......@@ -15896,7 +15896,7 @@ static IrInstruction *ir_analyze_union_tag(IrAnalyze *ira, IrInstruction *source
1589615896 }
1589715897
1589815898 ZigType *tag_type = value->value.type->data.unionation.tag_type;
15899 assert(tag_type->id == TypeTableEntryIdEnum);
15899 assert(tag_type->id == ZigTypeIdEnum);
1590015900
1590115901 if (instr_is_comptime(value)) {
1590215902 ConstExprValue *val = ir_resolve_const(ira, value, UndefBad);
......@@ -15948,7 +15948,7 @@ static ZigType *ir_analyze_instruction_switch_br(IrAnalyze *ira,
1594815948 if (type_is_invalid(case_value->value.type))
1594915949 return ir_unreach_error(ira);
1595015950
15951 if (case_value->value.type->id == TypeTableEntryIdEnum) {
15951 if (case_value->value.type->id == ZigTypeIdEnum) {
1595215952 case_value = ir_analyze_union_tag(ira, &switch_br_instruction->base, case_value);
1595315953 if (type_is_invalid(case_value->value.type))
1595415954 return ir_unreach_error(ira);
......@@ -15995,7 +15995,7 @@ static ZigType *ir_analyze_instruction_switch_br(IrAnalyze *ira,
1599515995 if (type_is_invalid(new_value->value.type))
1599615996 continue;
1599715997
15998 if (new_value->value.type->id == TypeTableEntryIdEnum) {
15998 if (new_value->value.type->id == ZigTypeIdEnum) {
1599915999 new_value = ir_analyze_union_tag(ira, &switch_br_instruction->base, new_value);
1600016000 if (type_is_invalid(new_value->value.type))
1600116001 continue;
......@@ -16032,17 +16032,17 @@ static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1603216032 if (type_is_invalid(target_value_ptr->value.type))
1603316033 return ira->codegen->builtin_types.entry_invalid;
1603416034
16035 if (target_value_ptr->value.type->id == TypeTableEntryIdMetaType) {
16035 if (target_value_ptr->value.type->id == ZigTypeIdMetaType) {
1603616036 assert(instr_is_comptime(target_value_ptr));
1603716037 ZigType *ptr_type = target_value_ptr->value.data.x_type;
16038 assert(ptr_type->id == TypeTableEntryIdPointer);
16038 assert(ptr_type->id == ZigTypeIdPointer);
1603916039 ConstExprValue *out_val = ir_build_const_from(ira, &switch_target_instruction->base);
1604016040 out_val->type = ira->codegen->builtin_types.entry_type;
1604116041 out_val->data.x_type = ptr_type->data.pointer.child_type;
1604216042 return out_val->type;
1604316043 }
1604416044
16045 if (target_value_ptr->value.type->id != TypeTableEntryIdPointer) {
16045 if (target_value_ptr->value.type->id != ZigTypeIdPointer) {
1604616046 ir_add_error(ira, target_value_ptr, buf_sprintf("invalid deref on switch target"));
1604716047 return ira->codegen->builtin_types.entry_invalid;
1604816048 }
......@@ -16061,20 +16061,20 @@ static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1606116061 return ira->codegen->builtin_types.entry_invalid;
1606216062
1606316063 switch (target_type->id) {
16064 case TypeTableEntryIdInvalid:
16064 case ZigTypeIdInvalid:
1606516065 zig_unreachable();
16066 case TypeTableEntryIdMetaType:
16067 case TypeTableEntryIdVoid:
16068 case TypeTableEntryIdBool:
16069 case TypeTableEntryIdInt:
16070 case TypeTableEntryIdFloat:
16071 case TypeTableEntryIdComptimeFloat:
16072 case TypeTableEntryIdComptimeInt:
16073 case TypeTableEntryIdPointer:
16074 case TypeTableEntryIdPromise:
16075 case TypeTableEntryIdFn:
16076 case TypeTableEntryIdNamespace:
16077 case TypeTableEntryIdErrorSet:
16066 case ZigTypeIdMetaType:
16067 case ZigTypeIdVoid:
16068 case ZigTypeIdBool:
16069 case ZigTypeIdInt:
16070 case ZigTypeIdFloat:
16071 case ZigTypeIdComptimeFloat:
16072 case ZigTypeIdComptimeInt:
16073 case ZigTypeIdPointer:
16074 case ZigTypeIdPromise:
16075 case ZigTypeIdFn:
16076 case ZigTypeIdNamespace:
16077 case ZigTypeIdErrorSet:
1607816078 if (pointee_val) {
1607916079 ConstExprValue *out_val = ir_build_const_from(ira, &switch_target_instruction->base);
1608016080 copy_const_val(out_val, pointee_val, true);
......@@ -16084,7 +16084,7 @@ static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1608416084
1608516085 ir_build_load_ptr_from(&ira->new_irb, &switch_target_instruction->base, target_value_ptr);
1608616086 return target_type;
16087 case TypeTableEntryIdUnion: {
16087 case ZigTypeIdUnion: {
1608816088 AstNode *decl_node = target_type->data.unionation.decl_node;
1608916089 if (!decl_node->data.container_decl.auto_enum &&
1609016090 decl_node->data.container_decl.init_arg_expr == nullptr)
......@@ -16097,7 +16097,7 @@ static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1609716097 }
1609816098 ZigType *tag_type = target_type->data.unionation.tag_type;
1609916099 assert(tag_type != nullptr);
16100 assert(tag_type->id == TypeTableEntryIdEnum);
16100 assert(tag_type->id == ZigTypeIdEnum);
1610116101 if (pointee_val) {
1610216102 ConstExprValue *out_val = ir_build_const_from(ira, &switch_target_instruction->base);
1610316103 bigint_init_bigint(&out_val->data.x_enum_tag, &pointee_val->data.x_union.tag);
......@@ -16120,7 +16120,7 @@ static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1612016120 ir_link_new_instruction(union_tag_inst, &switch_target_instruction->base);
1612116121 return tag_type;
1612216122 }
16123 case TypeTableEntryIdEnum: {
16123 case ZigTypeIdEnum: {
1612416124 if ((err = type_ensure_zero_bits_known(ira->codegen, target_type)))
1612516125 return ira->codegen->builtin_types.entry_invalid;
1612616126 if (target_type->data.enumeration.src_field_count < 2) {
......@@ -16142,17 +16142,17 @@ static ZigType *ir_analyze_instruction_switch_target(IrAnalyze *ira,
1614216142 ir_link_new_instruction(enum_value, &switch_target_instruction->base);
1614316143 return target_type;
1614416144 }
16145 case TypeTableEntryIdErrorUnion:
16146 case TypeTableEntryIdUnreachable:
16147 case TypeTableEntryIdArray:
16148 case TypeTableEntryIdStruct:
16149 case TypeTableEntryIdUndefined:
16150 case TypeTableEntryIdNull:
16151 case TypeTableEntryIdOptional:
16152 case TypeTableEntryIdBlock:
16153 case TypeTableEntryIdBoundFn:
16154 case TypeTableEntryIdArgTuple:
16155 case TypeTableEntryIdOpaque:
16145 case ZigTypeIdErrorUnion:
16146 case ZigTypeIdUnreachable:
16147 case ZigTypeIdArray:
16148 case ZigTypeIdStruct:
16149 case ZigTypeIdUndefined:
16150 case ZigTypeIdNull:
16151 case ZigTypeIdOptional:
16152 case ZigTypeIdBlock:
16153 case ZigTypeIdBoundFn:
16154 case ZigTypeIdArgTuple:
16155 case ZigTypeIdOpaque:
1615616156 ir_add_error(ira, &switch_target_instruction->base,
1615716157 buf_sprintf("invalid switch target type '%s'", buf_ptr(&target_type->name)));
1615816158 return ira->codegen->builtin_types.entry_invalid;
......@@ -16169,14 +16169,14 @@ static ZigType *ir_analyze_instruction_switch_var(IrAnalyze *ira, IrInstructionS
1616916169 if (type_is_invalid(prong_value->value.type))
1617016170 return ira->codegen->builtin_types.entry_invalid;
1617116171
16172 assert(target_value_ptr->value.type->id == TypeTableEntryIdPointer);
16172 assert(target_value_ptr->value.type->id == ZigTypeIdPointer);
1617316173 ZigType *target_type = target_value_ptr->value.type->data.pointer.child_type;
16174 if (target_type->id == TypeTableEntryIdUnion) {
16174 if (target_type->id == ZigTypeIdUnion) {
1617516175 ConstExprValue *prong_val = ir_resolve_const(ira, prong_value, UndefBad);
1617616176 if (!prong_val)
1617716177 return ira->codegen->builtin_types.entry_invalid;
1617816178
16179 assert(prong_value->value.type->id == TypeTableEntryIdEnum);
16179 assert(prong_value->value.type->id == ZigTypeIdEnum);
1618016180 TypeUnionField *field = find_union_field_by_tag(target_type, &prong_val->data.x_enum_tag);
1618116181
1618216182 if (instr_is_comptime(target_value_ptr)) {
......@@ -16285,7 +16285,7 @@ static ZigType *ir_analyze_instruction_array_len(IrAnalyze *ira,
1628516285 ZigType *type_entry = array_value->value.type;
1628616286 if (type_is_invalid(type_entry)) {
1628716287 return ira->codegen->builtin_types.entry_invalid;
16288 } else if (type_entry->id == TypeTableEntryIdArray) {
16288 } else if (type_entry->id == ZigTypeIdArray) {
1628916289 return ir_analyze_const_usize(ira, &array_len_instruction->base,
1629016290 type_entry->data.array.len);
1629116291 } else if (is_slice(type_entry)) {
......@@ -16318,7 +16318,7 @@ static ZigType *ir_analyze_container_init_fields_union(IrAnalyze *ira, IrInstruc
1631816318 ZigType *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields)
1631916319{
1632016320 Error err;
16321 assert(container_type->id == TypeTableEntryIdUnion);
16321 assert(container_type->id == ZigTypeIdUnion);
1632216322
1632316323 if ((err = ensure_complete_type(ira->codegen, container_type)))
1632416324 return ira->codegen->builtin_types.entry_invalid;
......@@ -16384,10 +16384,10 @@ static ZigType *ir_analyze_container_init_fields(IrAnalyze *ira, IrInstruction *
1638416384 ZigType *container_type, size_t instr_field_count, IrInstructionContainerInitFieldsField *fields)
1638516385{
1638616386 Error err;
16387 if (container_type->id == TypeTableEntryIdUnion) {
16387 if (container_type->id == ZigTypeIdUnion) {
1638816388 return ir_analyze_container_init_fields_union(ira, instruction, container_type, instr_field_count, fields);
1638916389 }
16390 if (container_type->id != TypeTableEntryIdStruct || is_slice(container_type)) {
16390 if (container_type->id != ZigTypeIdStruct || is_slice(container_type)) {
1639116391 ir_add_error(ira, instruction,
1639216392 buf_sprintf("type '%s' does not support struct initialization syntax",
1639316393 buf_ptr(&container_type->name)));
......@@ -16508,18 +16508,18 @@ static ZigType *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
1650816508 return ira->codegen->builtin_types.entry_invalid;
1650916509
1651016510 size_t elem_count = instruction->item_count;
16511 if (container_type_value->value.type->id == TypeTableEntryIdMetaType) {
16511 if (container_type_value->value.type->id == ZigTypeIdMetaType) {
1651216512 ZigType *container_type = ir_resolve_type(ira, container_type_value);
1651316513 if (type_is_invalid(container_type))
1651416514 return ira->codegen->builtin_types.entry_invalid;
1651516515
16516 if (container_type->id == TypeTableEntryIdStruct && !is_slice(container_type) && elem_count == 0) {
16516 if (container_type->id == ZigTypeIdStruct && !is_slice(container_type) && elem_count == 0) {
1651716517 return ir_analyze_container_init_fields(ira, &instruction->base, container_type,
1651816518 0, nullptr);
16519 } else if (is_slice(container_type) || container_type->id == TypeTableEntryIdArray) {
16519 } else if (is_slice(container_type) || container_type->id == ZigTypeIdArray) {
1652016520 // array is same as slice init but we make a compile error if the length is wrong
1652116521 ZigType *child_type;
16522 if (container_type->id == TypeTableEntryIdArray) {
16522 if (container_type->id == ZigTypeIdArray) {
1652316523 child_type = container_type->data.array.child_type;
1652416524 if (container_type->data.array.len != elem_count) {
1652516525 ZigType *literal_type = get_array_type(ira->codegen, child_type, elem_count);
......@@ -16531,7 +16531,7 @@ static ZigType *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
1653116531 }
1653216532 } else {
1653316533 ZigType *pointer_type = container_type->data.structure.fields[slice_ptr_index].type_entry;
16534 assert(pointer_type->id == TypeTableEntryIdPointer);
16534 assert(pointer_type->id == ZigTypeIdPointer);
1653516535 child_type = pointer_type->data.pointer.child_type;
1653616536 }
1653716537
......@@ -16598,7 +16598,7 @@ static ZigType *ir_analyze_instruction_container_init_list(IrAnalyze *ira,
1659816598 container_type_value, elem_count, new_items);
1659916599 ir_add_alloca(ira, new_instruction, fixed_size_array_type);
1660016600 return fixed_size_array_type;
16601 } else if (container_type->id == TypeTableEntryIdVoid) {
16601 } else if (container_type->id == ZigTypeIdVoid) {
1660216602 if (elem_count != 0) {
1660316603 ir_add_error_node(ira, instruction->base.source_node,
1660416604 buf_sprintf("void expression expects no arguments"));
......@@ -16635,43 +16635,43 @@ static ZigType *ir_analyze_min_max(IrAnalyze *ira, IrInstruction *source_instruc
1663516635 if (type_is_invalid(target_type))
1663616636 return ira->codegen->builtin_types.entry_invalid;
1663716637 switch (target_type->id) {
16638 case TypeTableEntryIdInvalid:
16638 case ZigTypeIdInvalid:
1663916639 zig_unreachable();
16640 case TypeTableEntryIdInt:
16640 case ZigTypeIdInt:
1664116641 {
1664216642 ConstExprValue *out_val = ir_build_const_from(ira, source_instruction);
1664316643 eval_min_max_value(ira->codegen, target_type, out_val, is_max);
1664416644 return ira->codegen->builtin_types.entry_num_lit_int;
1664516645 }
16646 case TypeTableEntryIdBool:
16647 case TypeTableEntryIdVoid:
16646 case ZigTypeIdBool:
16647 case ZigTypeIdVoid:
1664816648 {
1664916649 ConstExprValue *out_val = ir_build_const_from(ira, source_instruction);
1665016650 eval_min_max_value(ira->codegen, target_type, out_val, is_max);
1665116651 return target_type;
1665216652 }
16653 case TypeTableEntryIdEnum:
16654 case TypeTableEntryIdFloat:
16655 case TypeTableEntryIdMetaType:
16656 case TypeTableEntryIdUnreachable:
16657 case TypeTableEntryIdPointer:
16658 case TypeTableEntryIdPromise:
16659 case TypeTableEntryIdArray:
16660 case TypeTableEntryIdStruct:
16661 case TypeTableEntryIdComptimeFloat:
16662 case TypeTableEntryIdComptimeInt:
16663 case TypeTableEntryIdUndefined:
16664 case TypeTableEntryIdNull:
16665 case TypeTableEntryIdOptional:
16666 case TypeTableEntryIdErrorUnion:
16667 case TypeTableEntryIdErrorSet:
16668 case TypeTableEntryIdUnion:
16669 case TypeTableEntryIdFn:
16670 case TypeTableEntryIdNamespace:
16671 case TypeTableEntryIdBlock:
16672 case TypeTableEntryIdBoundFn:
16673 case TypeTableEntryIdArgTuple:
16674 case TypeTableEntryIdOpaque:
16653 case ZigTypeIdEnum:
16654 case ZigTypeIdFloat:
16655 case ZigTypeIdMetaType:
16656 case ZigTypeIdUnreachable:
16657 case ZigTypeIdPointer:
16658 case ZigTypeIdPromise:
16659 case ZigTypeIdArray:
16660 case ZigTypeIdStruct:
16661 case ZigTypeIdComptimeFloat:
16662 case ZigTypeIdComptimeInt:
16663 case ZigTypeIdUndefined:
16664 case ZigTypeIdNull:
16665 case ZigTypeIdOptional:
16666 case ZigTypeIdErrorUnion:
16667 case ZigTypeIdErrorSet:
16668 case ZigTypeIdUnion:
16669 case ZigTypeIdFn:
16670 case ZigTypeIdNamespace:
16671 case ZigTypeIdBlock:
16672 case ZigTypeIdBoundFn:
16673 case ZigTypeIdArgTuple:
16674 case ZigTypeIdOpaque:
1667516675 {
1667616676 const char *err_format = is_max ?
1667716677 "no max value available for type '%s'" :
......@@ -16774,7 +16774,7 @@ static ZigType *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrInstructi
1677416774 if (type_is_invalid(target->value.type))
1677516775 return ira->codegen->builtin_types.entry_invalid;
1677616776
16777 assert(target->value.type->id == TypeTableEntryIdEnum);
16777 assert(target->value.type->id == ZigTypeIdEnum);
1677816778
1677916779 if (instr_is_comptime(target)) {
1678016780 if ((err = type_ensure_zero_bits_known(ira->codegen, target->value.type)))
......@@ -16816,7 +16816,7 @@ static ZigType *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
1681616816 if (type_is_invalid(field_ptr->value.type))
1681716817 return ira->codegen->builtin_types.entry_invalid;
1681816818
16819 if (container_type->id != TypeTableEntryIdStruct) {
16819 if (container_type->id != ZigTypeIdStruct) {
1682016820 ir_add_error(ira, type_value,
1682116821 buf_sprintf("expected struct type, found '%s'", buf_ptr(&container_type->name)));
1682216822 return ira->codegen->builtin_types.entry_invalid;
......@@ -16833,7 +16833,7 @@ static ZigType *ir_analyze_instruction_field_parent_ptr(IrAnalyze *ira,
1683316833 return ira->codegen->builtin_types.entry_invalid;
1683416834 }
1683516835
16836 if (field_ptr->value.type->id != TypeTableEntryIdPointer) {
16836 if (field_ptr->value.type->id != ZigTypeIdPointer) {
1683716837 ir_add_error(ira, field_ptr,
1683816838 buf_sprintf("expected pointer, found '%s'", buf_ptr(&field_ptr->value.type->name)));
1683916839 return ira->codegen->builtin_types.entry_invalid;
......@@ -16908,7 +16908,7 @@ static ZigType *ir_analyze_instruction_offset_of(IrAnalyze *ira,
1690816908 if (!field_name)
1690916909 return ira->codegen->builtin_types.entry_invalid;
1691016910
16911 if (container_type->id != TypeTableEntryIdStruct) {
16911 if (container_type->id != ZigTypeIdStruct) {
1691216912 ir_add_error(ira, type_value,
1691316913 buf_sprintf("expected struct type, found '%s'", buf_ptr(&container_type->name)));
1691416914 return ira->codegen->builtin_types.entry_invalid;
......@@ -16951,11 +16951,11 @@ static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, Zig
1695116951 static ZigType *type_info_type = nullptr;
1695216952 if (type_info_var == nullptr) {
1695316953 type_info_var = get_builtin_value(ira->codegen, "TypeInfo");
16954 assert(type_info_var->type->id == TypeTableEntryIdMetaType);
16954 assert(type_info_var->type->id == ZigTypeIdMetaType);
1695516955
1695616956 assertNoError(ensure_complete_type(ira->codegen, type_info_var->data.x_type));
1695716957 type_info_type = type_info_var->data.x_type;
16958 assert(type_info_type->id == TypeTableEntryIdUnion);
16958 assert(type_info_type->id == ZigTypeIdUnion);
1695916959 }
1696016960
1696116961 if (type_name == nullptr && root == nullptr)
......@@ -16980,7 +16980,7 @@ static ZigType *ir_type_info_get_type(IrAnalyze *ira, const char *type_name, Zig
1698016980
1698116981 if ((err = ensure_complete_type(ira->codegen, var->value->type)))
1698216982 return ira->codegen->builtin_types.entry_invalid;
16983 assert(var->value->type->id == TypeTableEntryIdMetaType);
16983 assert(var->value->type->id == ZigTypeIdMetaType);
1698416984 return var->value->data.x_type;
1698516985}
1698616986
......@@ -17078,7 +17078,7 @@ static Error ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Sco
1707817078 if ((err = ensure_complete_type(ira->codegen, var->value->type)))
1707917079 return ErrorSemanticAnalyzeFail;
1708017080
17081 if (var->value->type->id == TypeTableEntryIdMetaType)
17081 if (var->value->type->id == ZigTypeIdMetaType)
1708217082 {
1708317083 // We have a variable of type 'type', so it's actually a type definition.
1708417084 // 0: Data.Type: type
......@@ -17238,7 +17238,7 @@ static ConstExprValue *create_ptr_like_type_info(IrAnalyze *ira, ZigType *ptr_ty
1723817238 if (is_slice(ptr_type_entry)) {
1723917239 attrs_type = ptr_type_entry->data.structure.fields[slice_ptr_index].type_entry;
1724017240 size_enum_index = 2;
17241 } else if (ptr_type_entry->id == TypeTableEntryIdPointer) {
17241 } else if (ptr_type_entry->id == ZigTypeIdPointer) {
1724217242 attrs_type = ptr_type_entry;
1724317243 size_enum_index = (ptr_type_entry->data.pointer.ptr_len == PtrLenSingle) ? 0 : 1;
1724417244 } else {
......@@ -17320,20 +17320,20 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1732017320 ConstExprValue *result = nullptr;
1732117321 switch (type_entry->id)
1732217322 {
17323 case TypeTableEntryIdInvalid:
17323 case ZigTypeIdInvalid:
1732417324 zig_unreachable();
17325 case TypeTableEntryIdMetaType:
17326 case TypeTableEntryIdVoid:
17327 case TypeTableEntryIdBool:
17328 case TypeTableEntryIdUnreachable:
17329 case TypeTableEntryIdComptimeFloat:
17330 case TypeTableEntryIdComptimeInt:
17331 case TypeTableEntryIdUndefined:
17332 case TypeTableEntryIdNull:
17333 case TypeTableEntryIdNamespace:
17334 case TypeTableEntryIdBlock:
17335 case TypeTableEntryIdArgTuple:
17336 case TypeTableEntryIdOpaque:
17325 case ZigTypeIdMetaType:
17326 case ZigTypeIdVoid:
17327 case ZigTypeIdBool:
17328 case ZigTypeIdUnreachable:
17329 case ZigTypeIdComptimeFloat:
17330 case ZigTypeIdComptimeInt:
17331 case ZigTypeIdUndefined:
17332 case ZigTypeIdNull:
17333 case ZigTypeIdNamespace:
17334 case ZigTypeIdBlock:
17335 case ZigTypeIdArgTuple:
17336 case ZigTypeIdOpaque:
1733717337 *out = nullptr;
1733817338 return ErrorNone;
1733917339 default:
......@@ -17347,7 +17347,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1734717347
1734817348 // Fallthrough if we don't find one.
1734917349 }
17350 case TypeTableEntryIdInt:
17350 case ZigTypeIdInt:
1735117351 {
1735217352 result = create_const_vals(1);
1735317353 result->special = ConstValSpecialStatic;
......@@ -17369,7 +17369,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1736917369
1737017370 break;
1737117371 }
17372 case TypeTableEntryIdFloat:
17372 case ZigTypeIdFloat:
1737317373 {
1737417374 result = create_const_vals(1);
1737517375 result->special = ConstValSpecialStatic;
......@@ -17386,12 +17386,12 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1738617386
1738717387 break;
1738817388 }
17389 case TypeTableEntryIdPointer:
17389 case ZigTypeIdPointer:
1739017390 {
1739117391 result = create_ptr_like_type_info(ira, type_entry);
1739217392 break;
1739317393 }
17394 case TypeTableEntryIdArray:
17394 case ZigTypeIdArray:
1739517395 {
1739617396 result = create_const_vals(1);
1739717397 result->special = ConstValSpecialStatic;
......@@ -17413,7 +17413,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1741317413
1741417414 break;
1741517415 }
17416 case TypeTableEntryIdOptional:
17416 case ZigTypeIdOptional:
1741717417 {
1741817418 result = create_const_vals(1);
1741917419 result->special = ConstValSpecialStatic;
......@@ -17430,7 +17430,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1743017430
1743117431 break;
1743217432 }
17433 case TypeTableEntryIdPromise:
17433 case ZigTypeIdPromise:
1743417434 {
1743517435 result = create_const_vals(1);
1743617436 result->special = ConstValSpecialStatic;
......@@ -17456,7 +17456,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1745617456
1745717457 break;
1745817458 }
17459 case TypeTableEntryIdEnum:
17459 case ZigTypeIdEnum:
1746017460 {
1746117461 result = create_const_vals(1);
1746217462 result->special = ConstValSpecialStatic;
......@@ -17506,7 +17506,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1750617506
1750717507 break;
1750817508 }
17509 case TypeTableEntryIdErrorSet:
17509 case ZigTypeIdErrorSet:
1751017510 {
1751117511 result = create_const_vals(1);
1751217512 result->special = ConstValSpecialStatic;
......@@ -17555,7 +17555,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1755517555
1755617556 break;
1755717557 }
17558 case TypeTableEntryIdErrorUnion:
17558 case ZigTypeIdErrorUnion:
1755917559 {
1756017560 result = create_const_vals(1);
1756117561 result->special = ConstValSpecialStatic;
......@@ -17578,7 +17578,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1757817578
1757917579 break;
1758017580 }
17581 case TypeTableEntryIdUnion:
17581 case ZigTypeIdUnion:
1758217582 {
1758317583 result = create_const_vals(1);
1758417584 result->special = ConstValSpecialStatic;
......@@ -17663,7 +17663,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1766317663
1766417664 break;
1766517665 }
17666 case TypeTableEntryIdStruct:
17666 case ZigTypeIdStruct:
1766717667 {
1766817668 if (type_entry->data.structure.is_slice) {
1766917669 result = create_ptr_like_type_info(ira, type_entry);
......@@ -17737,7 +17737,7 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1773717737
1773817738 break;
1773917739 }
17740 case TypeTableEntryIdFn:
17740 case ZigTypeIdFn:
1774117741 {
1774217742 result = create_const_vals(1);
1774317743 result->special = ConstValSpecialStatic;
......@@ -17842,10 +17842,10 @@ static Error ir_make_type_info_value(IrAnalyze *ira, ZigType *type_entry, ConstE
1784217842
1784317843 break;
1784417844 }
17845 case TypeTableEntryIdBoundFn:
17845 case ZigTypeIdBoundFn:
1784617846 {
1784717847 ZigType *fn_type = type_entry->data.bound_fn.fn_type;
17848 assert(fn_type->id == TypeTableEntryIdFn);
17848 assert(fn_type->id == ZigTypeIdFn);
1784917849 if ((err = ir_make_type_info_value(ira, fn_type, &result)))
1785017850 return err;
1785117851
......@@ -17880,7 +17880,7 @@ static ZigType *ir_analyze_instruction_type_info(IrAnalyze *ira,
1788017880 out_val->data.x_union.payload = payload;
1788117881
1788217882 if (payload != nullptr) {
17883 assert(payload->type->id == TypeTableEntryIdStruct);
17883 assert(payload->type->id == ZigTypeIdStruct);
1788417884 payload->data.x_struct.parent.id = ConstParentIdUnion;
1788517885 payload->data.x_struct.parent.data.p_union.union_val = out_val;
1788617886 }
......@@ -17897,7 +17897,7 @@ static ZigType *ir_analyze_instruction_type_id(IrAnalyze *ira,
1789717897 return ira->codegen->builtin_types.entry_invalid;
1789817898
1789917899 ConstExprValue *var_value = get_builtin_value(ira->codegen, "TypeId");
17900 assert(var_value->type->id == TypeTableEntryIdMetaType);
17900 assert(var_value->type->id == ZigTypeIdMetaType);
1790117901 ZigType *result_type = var_value->data.x_type;
1790217902
1790317903 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
......@@ -18206,8 +18206,8 @@ static ZigType *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstructionTru
1820618206 if (type_is_invalid(dest_type))
1820718207 return ira->codegen->builtin_types.entry_invalid;
1820818208
18209 if (dest_type->id != TypeTableEntryIdInt &&
18210 dest_type->id != TypeTableEntryIdComptimeInt)
18209 if (dest_type->id != ZigTypeIdInt &&
18210 dest_type->id != ZigTypeIdComptimeInt)
1821118211 {
1821218212 ir_add_error(ira, dest_type_value, buf_sprintf("expected integer type, found '%s'", buf_ptr(&dest_type->name)));
1821318213 return ira->codegen->builtin_types.entry_invalid;
......@@ -18218,8 +18218,8 @@ static ZigType *ir_analyze_instruction_truncate(IrAnalyze *ira, IrInstructionTru
1821818218 if (type_is_invalid(src_type))
1821918219 return ira->codegen->builtin_types.entry_invalid;
1822018220
18221 if (src_type->id != TypeTableEntryIdInt &&
18222 src_type->id != TypeTableEntryIdComptimeInt)
18221 if (src_type->id != ZigTypeIdInt &&
18222 src_type->id != ZigTypeIdComptimeInt)
1822318223 {
1822418224 ir_add_error(ira, target, buf_sprintf("expected integer type, found '%s'", buf_ptr(&src_type->name)));
1822518225 return ira->codegen->builtin_types.entry_invalid;
......@@ -18253,7 +18253,7 @@ static ZigType *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionInt
1825318253 if (type_is_invalid(dest_type))
1825418254 return ira->codegen->builtin_types.entry_invalid;
1825518255
18256 if (dest_type->id != TypeTableEntryIdInt) {
18256 if (dest_type->id != ZigTypeIdInt) {
1825718257 ir_add_error(ira, instruction->dest_type, buf_sprintf("expected integer type, found '%s'", buf_ptr(&dest_type->name)));
1825818258 return ira->codegen->builtin_types.entry_invalid;
1825918259 }
......@@ -18262,7 +18262,7 @@ static ZigType *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionInt
1826218262 if (type_is_invalid(target->value.type))
1826318263 return ira->codegen->builtin_types.entry_invalid;
1826418264
18265 if (target->value.type->id == TypeTableEntryIdComptimeInt) {
18265 if (target->value.type->id == ZigTypeIdComptimeInt) {
1826618266 if (ir_num_lit_fits_in_other_type(ira, target, dest_type, true)) {
1826718267 IrInstruction *result = ir_resolve_cast(ira, &instruction->base, target, dest_type,
1826818268 CastOpNumLitToConcrete, false);
......@@ -18275,7 +18275,7 @@ static ZigType *ir_analyze_instruction_int_cast(IrAnalyze *ira, IrInstructionInt
1827518275 }
1827618276 }
1827718277
18278 if (target->value.type->id != TypeTableEntryIdInt) {
18278 if (target->value.type->id != ZigTypeIdInt) {
1827918279 ir_add_error(ira, instruction->target, buf_sprintf("expected integer type, found '%s'",
1828018280 buf_ptr(&target->value.type->name)));
1828118281 return ira->codegen->builtin_types.entry_invalid;
......@@ -18294,7 +18294,7 @@ static ZigType *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionF
1829418294 if (type_is_invalid(dest_type))
1829518295 return ira->codegen->builtin_types.entry_invalid;
1829618296
18297 if (dest_type->id != TypeTableEntryIdFloat) {
18297 if (dest_type->id != ZigTypeIdFloat) {
1829818298 ir_add_error(ira, instruction->dest_type,
1829918299 buf_sprintf("expected float type, found '%s'", buf_ptr(&dest_type->name)));
1830018300 return ira->codegen->builtin_types.entry_invalid;
......@@ -18304,12 +18304,12 @@ static ZigType *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionF
1830418304 if (type_is_invalid(target->value.type))
1830518305 return ira->codegen->builtin_types.entry_invalid;
1830618306
18307 if (target->value.type->id == TypeTableEntryIdComptimeInt ||
18308 target->value.type->id == TypeTableEntryIdComptimeFloat)
18307 if (target->value.type->id == ZigTypeIdComptimeInt ||
18308 target->value.type->id == ZigTypeIdComptimeFloat)
1830918309 {
1831018310 if (ir_num_lit_fits_in_other_type(ira, target, dest_type, true)) {
1831118311 CastOp op;
18312 if (target->value.type->id == TypeTableEntryIdComptimeInt) {
18312 if (target->value.type->id == ZigTypeIdComptimeInt) {
1831318313 op = CastOpIntToFloat;
1831418314 } else {
1831518315 op = CastOpNumLitToConcrete;
......@@ -18324,7 +18324,7 @@ static ZigType *ir_analyze_instruction_float_cast(IrAnalyze *ira, IrInstructionF
1832418324 }
1832518325 }
1832618326
18327 if (target->value.type->id != TypeTableEntryIdFloat) {
18327 if (target->value.type->id != ZigTypeIdFloat) {
1832818328 ir_add_error(ira, instruction->target, buf_sprintf("expected float type, found '%s'",
1832918329 buf_ptr(&target->value.type->name)));
1833018330 return ira->codegen->builtin_types.entry_invalid;
......@@ -18342,7 +18342,7 @@ static ZigType *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstructio
1834218342 if (type_is_invalid(dest_type))
1834318343 return ira->codegen->builtin_types.entry_invalid;
1834418344
18345 if (dest_type->id != TypeTableEntryIdErrorSet) {
18345 if (dest_type->id != ZigTypeIdErrorSet) {
1834618346 ir_add_error(ira, instruction->dest_type,
1834718347 buf_sprintf("expected error set type, found '%s'", buf_ptr(&dest_type->name)));
1834818348 return ira->codegen->builtin_types.entry_invalid;
......@@ -18352,7 +18352,7 @@ static ZigType *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstructio
1835218352 if (type_is_invalid(target->value.type))
1835318353 return ira->codegen->builtin_types.entry_invalid;
1835418354
18355 if (target->value.type->id != TypeTableEntryIdErrorSet) {
18355 if (target->value.type->id != ZigTypeIdErrorSet) {
1835618356 ir_add_error(ira, instruction->target,
1835718357 buf_sprintf("expected error set type, found '%s'", buf_ptr(&target->value.type->name)));
1835818358 return ira->codegen->builtin_types.entry_invalid;
......@@ -18377,7 +18377,7 @@ static ZigType *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstructionF
1837718377 bool src_ptr_const;
1837818378 bool src_ptr_volatile;
1837918379 uint32_t src_ptr_align;
18380 if (target->value.type->id == TypeTableEntryIdPointer) {
18380 if (target->value.type->id == ZigTypeIdPointer) {
1838118381 src_ptr_const = target->value.type->data.pointer.is_const;
1838218382 src_ptr_volatile = target->value.type->data.pointer.is_volatile;
1838318383 src_ptr_align = target->value.type->data.pointer.alignment;
......@@ -18477,7 +18477,7 @@ static ZigType *ir_analyze_instruction_int_to_float(IrAnalyze *ira, IrInstructio
1847718477 if (type_is_invalid(target->value.type))
1847818478 return ira->codegen->builtin_types.entry_invalid;
1847918479
18480 if (target->value.type->id != TypeTableEntryIdInt && target->value.type->id != TypeTableEntryIdComptimeInt) {
18480 if (target->value.type->id != ZigTypeIdInt && target->value.type->id != ZigTypeIdComptimeInt) {
1848118481 ir_add_error(ira, instruction->target, buf_sprintf("expected int type, found '%s'",
1848218482 buf_ptr(&target->value.type->name)));
1848318483 return ira->codegen->builtin_types.entry_invalid;
......@@ -18497,7 +18497,7 @@ static ZigType *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInstructio
1849718497 if (type_is_invalid(target->value.type))
1849818498 return ira->codegen->builtin_types.entry_invalid;
1849918499
18500 if (target->value.type->id == TypeTableEntryIdComptimeInt) {
18500 if (target->value.type->id == ZigTypeIdComptimeInt) {
1850118501 IrInstruction *casted_value = ir_implicit_cast(ira, target, dest_type);
1850218502 if (type_is_invalid(casted_value->value.type))
1850318503 return ira->codegen->builtin_types.entry_invalid;
......@@ -18505,7 +18505,7 @@ static ZigType *ir_analyze_instruction_float_to_int(IrAnalyze *ira, IrInstructio
1850518505 return casted_value->value.type;
1850618506 }
1850718507
18508 if (target->value.type->id != TypeTableEntryIdFloat && target->value.type->id != TypeTableEntryIdComptimeFloat) {
18508 if (target->value.type->id != ZigTypeIdFloat && target->value.type->id != ZigTypeIdComptimeFloat) {
1850918509 ir_add_error(ira, instruction->target, buf_sprintf("expected float type, found '%s'",
1851018510 buf_ptr(&target->value.type->name)));
1851118511 return ira->codegen->builtin_types.entry_invalid;
......@@ -18522,7 +18522,7 @@ static ZigType *ir_analyze_instruction_err_to_int(IrAnalyze *ira, IrInstructionE
1852218522 return ira->codegen->builtin_types.entry_invalid;
1852318523
1852418524 IrInstruction *casted_target;
18525 if (target->value.type->id == TypeTableEntryIdErrorSet) {
18525 if (target->value.type->id == ZigTypeIdErrorSet) {
1852618526 casted_target = target;
1852718527 } else {
1852818528 casted_target = ir_implicit_cast(ira, target, ira->codegen->builtin_types.entry_global_error_set);
......@@ -18554,7 +18554,7 @@ static ZigType *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstruction
1855418554 if (type_is_invalid(target->value.type))
1855518555 return ira->codegen->builtin_types.entry_invalid;
1855618556
18557 if (target->value.type->id != TypeTableEntryIdBool) {
18557 if (target->value.type->id != ZigTypeIdBool) {
1855818558 ir_add_error(ira, instruction->target, buf_sprintf("expected bool, found '%s'",
1855918559 buf_ptr(&target->value.type->name)));
1856018560 return ira->codegen->builtin_types.entry_invalid;
......@@ -18631,12 +18631,12 @@ static ZigType *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructionMemse
1863118631 return ira->codegen->builtin_types.entry_invalid;
1863218632
1863318633 ZigType *dest_uncasted_type = dest_ptr->value.type;
18634 bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) &&
18634 bool dest_is_volatile = (dest_uncasted_type->id == ZigTypeIdPointer) &&
1863518635 dest_uncasted_type->data.pointer.is_volatile;
1863618636
1863718637 ZigType *usize = ira->codegen->builtin_types.entry_usize;
1863818638 ZigType *u8 = ira->codegen->builtin_types.entry_u8;
18639 uint32_t dest_align = (dest_uncasted_type->id == TypeTableEntryIdPointer) ?
18639 uint32_t dest_align = (dest_uncasted_type->id == ZigTypeIdPointer) ?
1864018640 dest_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8);
1864118641 ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, u8, false, dest_is_volatile,
1864218642 PtrLenUnknown, dest_align, 0, 0);
......@@ -18725,13 +18725,13 @@ static ZigType *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructionMemcp
1872518725 ZigType *u8 = ira->codegen->builtin_types.entry_u8;
1872618726 ZigType *dest_uncasted_type = dest_ptr->value.type;
1872718727 ZigType *src_uncasted_type = src_ptr->value.type;
18728 bool dest_is_volatile = (dest_uncasted_type->id == TypeTableEntryIdPointer) &&
18728 bool dest_is_volatile = (dest_uncasted_type->id == ZigTypeIdPointer) &&
1872918729 dest_uncasted_type->data.pointer.is_volatile;
18730 bool src_is_volatile = (src_uncasted_type->id == TypeTableEntryIdPointer) &&
18730 bool src_is_volatile = (src_uncasted_type->id == ZigTypeIdPointer) &&
1873118731 src_uncasted_type->data.pointer.is_volatile;
18732 uint32_t dest_align = (dest_uncasted_type->id == TypeTableEntryIdPointer) ?
18732 uint32_t dest_align = (dest_uncasted_type->id == ZigTypeIdPointer) ?
1873318733 dest_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8);
18734 uint32_t src_align = (src_uncasted_type->id == TypeTableEntryIdPointer) ?
18734 uint32_t src_align = (src_uncasted_type->id == ZigTypeIdPointer) ?
1873518735 src_uncasted_type->data.pointer.alignment : get_abi_alignment(ira->codegen, u8);
1873618736
1873718737 ZigType *usize = ira->codegen->builtin_types.entry_usize;
......@@ -18850,7 +18850,7 @@ static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice
1885018850 return ira->codegen->builtin_types.entry_invalid;
1885118851
1885218852 ZigType *ptr_type = ptr_ptr->value.type;
18853 assert(ptr_type->id == TypeTableEntryIdPointer);
18853 assert(ptr_type->id == ZigTypeIdPointer);
1885418854 ZigType *array_type = ptr_type->data.pointer.child_type;
1885518855
1885618856 IrInstruction *start = instruction->start->other;
......@@ -18876,7 +18876,7 @@ static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice
1887618876
1887718877 ZigType *return_type;
1887818878
18879 if (array_type->id == TypeTableEntryIdArray) {
18879 if (array_type->id == ZigTypeIdArray) {
1888018880 uint32_t byte_alignment = ptr_type->data.pointer.alignment;
1888118881 if (array_type->data.array.len == 0 && byte_alignment == 0) {
1888218882 byte_alignment = get_abi_alignment(ira->codegen, array_type->data.array.child_type);
......@@ -18889,10 +18889,10 @@ static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice
1888918889 PtrLenUnknown,
1889018890 byte_alignment, 0, 0);
1889118891 return_type = get_slice_type(ira->codegen, slice_ptr_type);
18892 } else if (array_type->id == TypeTableEntryIdPointer) {
18892 } else if (array_type->id == ZigTypeIdPointer) {
1889318893 if (array_type->data.pointer.ptr_len == PtrLenSingle) {
1889418894 ZigType *main_type = array_type->data.pointer.child_type;
18895 if (main_type->id == TypeTableEntryIdArray) {
18895 if (main_type->id == ZigTypeIdArray) {
1889618896 ZigType *slice_ptr_type = get_pointer_to_type_extra(ira->codegen,
1889718897 main_type->data.pointer.child_type,
1889818898 array_type->data.pointer.is_const, array_type->data.pointer.is_volatile,
......@@ -18932,12 +18932,12 @@ static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice
1893218932 size_t abs_offset;
1893318933 size_t rel_end;
1893418934 bool ptr_is_undef = false;
18935 if (array_type->id == TypeTableEntryIdArray ||
18936 (array_type->id == TypeTableEntryIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle))
18935 if (array_type->id == ZigTypeIdArray ||
18936 (array_type->id == ZigTypeIdPointer && array_type->data.pointer.ptr_len == PtrLenSingle))
1893718937 {
18938 if (array_type->id == TypeTableEntryIdPointer) {
18938 if (array_type->id == ZigTypeIdPointer) {
1893918939 ZigType *child_array_type = array_type->data.pointer.child_type;
18940 assert(child_array_type->id == TypeTableEntryIdArray);
18940 assert(child_array_type->id == ZigTypeIdArray);
1894118941 parent_ptr = ir_const_ptr_pointee(ira, &ptr_ptr->value, instruction->base.source_node);
1894218942 if (parent_ptr == nullptr)
1894318943 return ira->codegen->builtin_types.entry_invalid;
......@@ -18956,7 +18956,7 @@ static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice
1895618956 parent_ptr = nullptr;
1895718957 abs_offset = 0;
1895818958 }
18959 } else if (array_type->id == TypeTableEntryIdPointer) {
18959 } else if (array_type->id == ZigTypeIdPointer) {
1896018960 assert(array_type->data.pointer.ptr_len == PtrLenUnknown);
1896118961 parent_ptr = ir_const_ptr_pointee(ira, &ptr_ptr->value, instruction->base.source_node);
1896218962 if (parent_ptr == nullptr)
......@@ -19063,11 +19063,11 @@ static ZigType *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstructionSlice
1906319063 size_t index = abs_offset + start_scalar;
1906419064 bool is_const = slice_is_const(return_type);
1906519065 init_const_ptr_array(ira->codegen, ptr_val, array_val, index, is_const, PtrLenUnknown);
19066 if (array_type->id == TypeTableEntryIdArray) {
19066 if (array_type->id == ZigTypeIdArray) {
1906719067 ptr_val->data.x_ptr.mut = ptr_ptr->value.data.x_ptr.mut;
1906819068 } else if (is_slice(array_type)) {
1906919069 ptr_val->data.x_ptr.mut = parent_ptr->data.x_ptr.mut;
19070 } else if (array_type->id == TypeTableEntryIdPointer) {
19070 } else if (array_type->id == ZigTypeIdPointer) {
1907119071 ptr_val->data.x_ptr.mut = parent_ptr->data.x_ptr.mut;
1907219072 }
1907319073 } else if (ptr_is_undef) {
......@@ -19122,13 +19122,13 @@ static ZigType *ir_analyze_instruction_member_count(IrAnalyze *ira, IrInstructio
1912219122 uint64_t result;
1912319123 if (type_is_invalid(container_type)) {
1912419124 return ira->codegen->builtin_types.entry_invalid;
19125 } else if (container_type->id == TypeTableEntryIdEnum) {
19125 } else if (container_type->id == ZigTypeIdEnum) {
1912619126 result = container_type->data.enumeration.src_field_count;
19127 } else if (container_type->id == TypeTableEntryIdStruct) {
19127 } else if (container_type->id == ZigTypeIdStruct) {
1912819128 result = container_type->data.structure.src_field_count;
19129 } else if (container_type->id == TypeTableEntryIdUnion) {
19129 } else if (container_type->id == ZigTypeIdUnion) {
1913019130 result = container_type->data.unionation.src_field_count;
19131 } else if (container_type->id == TypeTableEntryIdErrorSet) {
19131 } else if (container_type->id == ZigTypeIdErrorSet) {
1913219132 if (!resolve_inferred_error_set(ira->codegen, container_type, instruction->base.source_node)) {
1913319133 return ira->codegen->builtin_types.entry_invalid;
1913419134 }
......@@ -19163,7 +19163,7 @@ static ZigType *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstruction
1916319163 if (!ir_resolve_usize(ira, index_value, &member_index))
1916419164 return ira->codegen->builtin_types.entry_invalid;
1916519165
19166 if (container_type->id == TypeTableEntryIdStruct) {
19166 if (container_type->id == ZigTypeIdStruct) {
1916719167 if (member_index >= container_type->data.structure.src_field_count) {
1916819168 ir_add_error(ira, index_value,
1916919169 buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
......@@ -19175,7 +19175,7 @@ static ZigType *ir_analyze_instruction_member_type(IrAnalyze *ira, IrInstruction
1917519175 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1917619176 out_val->data.x_type = field->type_entry;
1917719177 return ira->codegen->builtin_types.entry_type;
19178 } else if (container_type->id == TypeTableEntryIdUnion) {
19178 } else if (container_type->id == ZigTypeIdUnion) {
1917919179 if (member_index >= container_type->data.unionation.src_field_count) {
1918019180 ir_add_error(ira, index_value,
1918119181 buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
......@@ -19209,7 +19209,7 @@ static ZigType *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstruction
1920919209 if (!ir_resolve_usize(ira, index_value, &member_index))
1921019210 return ira->codegen->builtin_types.entry_invalid;
1921119211
19212 if (container_type->id == TypeTableEntryIdStruct) {
19212 if (container_type->id == ZigTypeIdStruct) {
1921319213 if (member_index >= container_type->data.structure.src_field_count) {
1921419214 ir_add_error(ira, index_value,
1921519215 buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
......@@ -19221,7 +19221,7 @@ static ZigType *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstruction
1922119221 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1922219222 init_const_str_lit(ira->codegen, out_val, field->name);
1922319223 return out_val->type;
19224 } else if (container_type->id == TypeTableEntryIdEnum) {
19224 } else if (container_type->id == ZigTypeIdEnum) {
1922519225 if (member_index >= container_type->data.enumeration.src_field_count) {
1922619226 ir_add_error(ira, index_value,
1922719227 buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
......@@ -19233,7 +19233,7 @@ static ZigType *ir_analyze_instruction_member_name(IrAnalyze *ira, IrInstruction
1923319233 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1923419234 init_const_str_lit(ira->codegen, out_val, field->name);
1923519235 return out_val->type;
19236 } else if (container_type->id == TypeTableEntryIdUnion) {
19236 } else if (container_type->id == ZigTypeIdUnion) {
1923719237 if (member_index >= container_type->data.unionation.src_field_count) {
1923819238 ir_add_error(ira, index_value,
1923919239 buf_sprintf("member index %" ZIG_PRI_u64 " out of bounds; '%s' has %" PRIu32 " members",
......@@ -19292,36 +19292,36 @@ static ZigType *ir_analyze_instruction_align_of(IrAnalyze *ira, IrInstructionAli
1929219292 return ira->codegen->builtin_types.entry_invalid;
1929319293
1929419294 switch (type_entry->id) {
19295 case TypeTableEntryIdInvalid:
19295 case ZigTypeIdInvalid:
1929619296 zig_unreachable();
19297 case TypeTableEntryIdMetaType:
19298 case TypeTableEntryIdUnreachable:
19299 case TypeTableEntryIdComptimeFloat:
19300 case TypeTableEntryIdComptimeInt:
19301 case TypeTableEntryIdUndefined:
19302 case TypeTableEntryIdNull:
19303 case TypeTableEntryIdNamespace:
19304 case TypeTableEntryIdBlock:
19305 case TypeTableEntryIdBoundFn:
19306 case TypeTableEntryIdArgTuple:
19307 case TypeTableEntryIdVoid:
19308 case TypeTableEntryIdOpaque:
19297 case ZigTypeIdMetaType:
19298 case ZigTypeIdUnreachable:
19299 case ZigTypeIdComptimeFloat:
19300 case ZigTypeIdComptimeInt:
19301 case ZigTypeIdUndefined:
19302 case ZigTypeIdNull:
19303 case ZigTypeIdNamespace:
19304 case ZigTypeIdBlock:
19305 case ZigTypeIdBoundFn:
19306 case ZigTypeIdArgTuple:
19307 case ZigTypeIdVoid:
19308 case ZigTypeIdOpaque:
1930919309 ir_add_error(ira, instruction->type_value,
1931019310 buf_sprintf("no align available for type '%s'", buf_ptr(&type_entry->name)));
1931119311 return ira->codegen->builtin_types.entry_invalid;
19312 case TypeTableEntryIdBool:
19313 case TypeTableEntryIdInt:
19314 case TypeTableEntryIdFloat:
19315 case TypeTableEntryIdPointer:
19316 case TypeTableEntryIdPromise:
19317 case TypeTableEntryIdArray:
19318 case TypeTableEntryIdStruct:
19319 case TypeTableEntryIdOptional:
19320 case TypeTableEntryIdErrorUnion:
19321 case TypeTableEntryIdErrorSet:
19322 case TypeTableEntryIdEnum:
19323 case TypeTableEntryIdUnion:
19324 case TypeTableEntryIdFn:
19312 case ZigTypeIdBool:
19313 case ZigTypeIdInt:
19314 case ZigTypeIdFloat:
19315 case ZigTypeIdPointer:
19316 case ZigTypeIdPromise:
19317 case ZigTypeIdArray:
19318 case ZigTypeIdStruct:
19319 case ZigTypeIdOptional:
19320 case ZigTypeIdErrorUnion:
19321 case ZigTypeIdErrorSet:
19322 case ZigTypeIdEnum:
19323 case ZigTypeIdUnion:
19324 case ZigTypeIdFn:
1932519325 {
1932619326 uint64_t align_in_bytes = get_abi_alignment(ira->codegen, type_entry);
1932719327 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
......@@ -19341,7 +19341,7 @@ static ZigType *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstruction
1934119341 if (type_is_invalid(dest_type))
1934219342 return ira->codegen->builtin_types.entry_invalid;
1934319343
19344 if (dest_type->id != TypeTableEntryIdInt) {
19344 if (dest_type->id != ZigTypeIdInt) {
1934519345 ir_add_error(ira, type_value,
1934619346 buf_sprintf("expected integer type, found '%s'", buf_ptr(&dest_type->name)));
1934719347 return ira->codegen->builtin_types.entry_invalid;
......@@ -19375,7 +19375,7 @@ static ZigType *ir_analyze_instruction_overflow_op(IrAnalyze *ira, IrInstruction
1937519375 return ira->codegen->builtin_types.entry_invalid;
1937619376
1937719377 ZigType *expected_ptr_type;
19378 if (result_ptr->value.type->id == TypeTableEntryIdPointer) {
19378 if (result_ptr->value.type->id == ZigTypeIdPointer) {
1937919379 expected_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_type,
1938019380 false, result_ptr->value.type->data.pointer.is_volatile,
1938119381 PtrLenSingle,
......@@ -19439,7 +19439,7 @@ static ZigType *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTes
1943919439 ZigType *type_entry = value->value.type;
1944019440 if (type_is_invalid(type_entry)) {
1944119441 return ira->codegen->builtin_types.entry_invalid;
19442 } else if (type_entry->id == TypeTableEntryIdErrorUnion) {
19442 } else if (type_entry->id == ZigTypeIdErrorUnion) {
1944319443 if (instr_is_comptime(value)) {
1944419444 ConstExprValue *err_union_val = ir_resolve_const(ira, value, UndefBad);
1944519445 if (!err_union_val)
......@@ -19467,7 +19467,7 @@ static ZigType *ir_analyze_instruction_test_err(IrAnalyze *ira, IrInstructionTes
1946719467
1946819468 ir_build_test_err_from(&ira->new_irb, &instruction->base, value);
1946919469 return ira->codegen->builtin_types.entry_bool;
19470 } else if (type_entry->id == TypeTableEntryIdErrorSet) {
19470 } else if (type_entry->id == ZigTypeIdErrorSet) {
1947119471 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
1947219472 out_val->data.x_bool = true;
1947319473 return ira->codegen->builtin_types.entry_bool;
......@@ -19487,12 +19487,12 @@ static ZigType *ir_analyze_instruction_unwrap_err_code(IrAnalyze *ira,
1948719487 ZigType *ptr_type = value->value.type;
1948819488
1948919489 // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing.
19490 assert(ptr_type->id == TypeTableEntryIdPointer);
19490 assert(ptr_type->id == ZigTypeIdPointer);
1949119491
1949219492 ZigType *type_entry = ptr_type->data.pointer.child_type;
1949319493 if (type_is_invalid(type_entry)) {
1949419494 return ira->codegen->builtin_types.entry_invalid;
19495 } else if (type_entry->id == TypeTableEntryIdErrorUnion) {
19495 } else if (type_entry->id == ZigTypeIdErrorUnion) {
1949619496 if (instr_is_comptime(value)) {
1949719497 ConstExprValue *ptr_val = ir_resolve_const(ira, value, UndefBad);
1949819498 if (!ptr_val)
......@@ -19529,12 +19529,12 @@ static ZigType *ir_analyze_instruction_unwrap_err_payload(IrAnalyze *ira,
1952919529 ZigType *ptr_type = value->value.type;
1953019530
1953119531 // This will be a pointer type because unwrap err payload IR instruction operates on a pointer to a thing.
19532 assert(ptr_type->id == TypeTableEntryIdPointer);
19532 assert(ptr_type->id == ZigTypeIdPointer);
1953319533
1953419534 ZigType *type_entry = ptr_type->data.pointer.child_type;
1953519535 if (type_is_invalid(type_entry)) {
1953619536 return ira->codegen->builtin_types.entry_invalid;
19537 } else if (type_entry->id == TypeTableEntryIdErrorUnion) {
19537 } else if (type_entry->id == ZigTypeIdErrorUnion) {
1953819538 ZigType *payload_type = type_entry->data.error_union.payload_type;
1953919539 if (type_is_invalid(payload_type)) {
1954019540 return ira->codegen->builtin_types.entry_invalid;
......@@ -19633,7 +19633,7 @@ static ZigType *ir_analyze_instruction_fn_proto(IrAnalyze *ira, IrInstructionFnP
1963319633 fn_type_id.return_type = ir_resolve_type(ira, return_type_value);
1963419634 if (type_is_invalid(fn_type_id.return_type))
1963519635 return ira->codegen->builtin_types.entry_invalid;
19636 if (fn_type_id.return_type->id == TypeTableEntryIdOpaque) {
19636 if (fn_type_id.return_type->id == ZigTypeIdOpaque) {
1963719637 ir_add_error(ira, instruction->return_type,
1963819638 buf_sprintf("return type cannot be opaque"));
1963919639 return ira->codegen->builtin_types.entry_invalid;
......@@ -19674,7 +19674,7 @@ static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1967419674 if (type_is_invalid(switch_type))
1967519675 return ira->codegen->builtin_types.entry_invalid;
1967619676
19677 if (switch_type->id == TypeTableEntryIdEnum) {
19677 if (switch_type->id == ZigTypeIdEnum) {
1967819678 HashMap<BigInt, AstNode *, bigint_hash, bigint_eql> field_prev_uses = {};
1967919679 field_prev_uses.init(switch_type->data.enumeration.src_field_count);
1968019680
......@@ -19689,7 +19689,7 @@ static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1968919689 if (type_is_invalid(end_value->value.type))
1969019690 return ira->codegen->builtin_types.entry_invalid;
1969119691
19692 if (start_value->value.type->id != TypeTableEntryIdEnum) {
19692 if (start_value->value.type->id != ZigTypeIdEnum) {
1969319693 ir_add_error(ira, range->start, buf_sprintf("not an enum type"));
1969419694 return ira->codegen->builtin_types.entry_invalid;
1969519695 }
......@@ -19697,7 +19697,7 @@ static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1969719697 BigInt start_index;
1969819698 bigint_init_bigint(&start_index, &start_value->value.data.x_enum_tag);
1969919699
19700 assert(end_value->value.type->id == TypeTableEntryIdEnum);
19700 assert(end_value->value.type->id == ZigTypeIdEnum);
1970119701 BigInt end_index;
1970219702 bigint_init_bigint(&end_index, &end_value->value.data.x_enum_tag);
1970319703
......@@ -19733,7 +19733,7 @@ static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1973319733 }
1973419734 }
1973519735 }
19736 } else if (switch_type->id == TypeTableEntryIdErrorSet) {
19736 } else if (switch_type->id == ZigTypeIdErrorSet) {
1973719737 if (!resolve_inferred_error_set(ira->codegen, switch_type, target_value->source_node)) {
1973819738 return ira->codegen->builtin_types.entry_invalid;
1973919739 }
......@@ -19751,10 +19751,10 @@ static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1975119751 if (type_is_invalid(end_value->value.type))
1975219752 return ira->codegen->builtin_types.entry_invalid;
1975319753
19754 assert(start_value->value.type->id == TypeTableEntryIdErrorSet);
19754 assert(start_value->value.type->id == ZigTypeIdErrorSet);
1975519755 uint32_t start_index = start_value->value.data.x_err_set->value;
1975619756
19757 assert(end_value->value.type->id == TypeTableEntryIdErrorSet);
19757 assert(end_value->value.type->id == ZigTypeIdErrorSet);
1975819758 uint32_t end_index = end_value->value.data.x_err_set->value;
1975919759
1976019760 if (start_index != end_index) {
......@@ -19790,7 +19790,7 @@ static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1979019790 }
1979119791
1979219792 free(field_prev_uses);
19793 } else if (switch_type->id == TypeTableEntryIdInt) {
19793 } else if (switch_type->id == ZigTypeIdInt) {
1979419794 RangeSet rs = {0};
1979519795 for (size_t range_i = 0; range_i < instruction->range_count; range_i += 1) {
1979619796 IrInstructionCheckSwitchProngsRange *range = &instruction->ranges[range_i];
......@@ -19817,8 +19817,8 @@ static ZigType *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira,
1981719817 if (!end_val)
1981819818 return ira->codegen->builtin_types.entry_invalid;
1981919819
19820 assert(start_val->type->id == TypeTableEntryIdInt || start_val->type->id == TypeTableEntryIdComptimeInt);
19821 assert(end_val->type->id == TypeTableEntryIdInt || end_val->type->id == TypeTableEntryIdComptimeInt);
19820 assert(start_val->type->id == ZigTypeIdInt || start_val->type->id == ZigTypeIdComptimeInt);
19821 assert(end_val->type->id == ZigTypeIdInt || end_val->type->id == ZigTypeIdComptimeInt);
1982219822 AstNode *prev_node = rangeset_add_range(&rs, &start_val->data.x_bigint, &end_val->data.x_bigint,
1982319823 start_value->source_node);
1982419824 if (prev_node != nullptr) {
......@@ -19854,7 +19854,7 @@ static ZigType *ir_analyze_instruction_check_statement_is_void(IrAnalyze *ira,
1985419854 if (type_is_invalid(statement_type))
1985519855 return ira->codegen->builtin_types.entry_invalid;
1985619856
19857 if (statement_type->id != TypeTableEntryIdVoid) {
19857 if (statement_type->id != ZigTypeIdVoid) {
1985819858 ir_add_error(ira, &instruction->base, buf_sprintf("expression value is ignored"));
1985919859 }
1986019860
......@@ -19892,24 +19892,24 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3
1989219892 ZigType *result_type;
1989319893 uint32_t old_align_bytes;
1989419894
19895 if (target_type->id == TypeTableEntryIdPointer) {
19895 if (target_type->id == ZigTypeIdPointer) {
1989619896 result_type = adjust_ptr_align(ira->codegen, target_type, align_bytes);
1989719897 old_align_bytes = target_type->data.pointer.alignment;
19898 } else if (target_type->id == TypeTableEntryIdFn) {
19898 } else if (target_type->id == ZigTypeIdFn) {
1989919899 FnTypeId fn_type_id = target_type->data.fn.fn_type_id;
1990019900 old_align_bytes = fn_type_id.alignment;
1990119901 fn_type_id.alignment = align_bytes;
1990219902 result_type = get_fn_type(ira->codegen, &fn_type_id);
19903 } else if (target_type->id == TypeTableEntryIdOptional &&
19904 target_type->data.maybe.child_type->id == TypeTableEntryIdPointer)
19903 } else if (target_type->id == ZigTypeIdOptional &&
19904 target_type->data.maybe.child_type->id == ZigTypeIdPointer)
1990519905 {
1990619906 ZigType *ptr_type = target_type->data.maybe.child_type;
1990719907 old_align_bytes = ptr_type->data.pointer.alignment;
1990819908 ZigType *better_ptr_type = adjust_ptr_align(ira->codegen, ptr_type, align_bytes);
1990919909
1991019910 result_type = get_optional_type(ira->codegen, better_ptr_type);
19911 } else if (target_type->id == TypeTableEntryIdOptional &&
19912 target_type->data.maybe.child_type->id == TypeTableEntryIdFn)
19911 } else if (target_type->id == ZigTypeIdOptional &&
19912 target_type->data.maybe.child_type->id == ZigTypeIdFn)
1991319913 {
1991419914 FnTypeId fn_type_id = target_type->data.maybe.child_type->data.fn.fn_type_id;
1991519915 old_align_bytes = fn_type_id.alignment;
......@@ -20033,33 +20033,33 @@ static ZigType *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtr
2003320033static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val) {
2003420034 assert(val->special == ConstValSpecialStatic);
2003520035 switch (val->type->id) {
20036 case TypeTableEntryIdInvalid:
20037 case TypeTableEntryIdMetaType:
20038 case TypeTableEntryIdOpaque:
20039 case TypeTableEntryIdBoundFn:
20040 case TypeTableEntryIdArgTuple:
20041 case TypeTableEntryIdNamespace:
20042 case TypeTableEntryIdBlock:
20043 case TypeTableEntryIdUnreachable:
20044 case TypeTableEntryIdComptimeFloat:
20045 case TypeTableEntryIdComptimeInt:
20046 case TypeTableEntryIdUndefined:
20047 case TypeTableEntryIdNull:
20048 case TypeTableEntryIdPromise:
20036 case ZigTypeIdInvalid:
20037 case ZigTypeIdMetaType:
20038 case ZigTypeIdOpaque:
20039 case ZigTypeIdBoundFn:
20040 case ZigTypeIdArgTuple:
20041 case ZigTypeIdNamespace:
20042 case ZigTypeIdBlock:
20043 case ZigTypeIdUnreachable:
20044 case ZigTypeIdComptimeFloat:
20045 case ZigTypeIdComptimeInt:
20046 case ZigTypeIdUndefined:
20047 case ZigTypeIdNull:
20048 case ZigTypeIdPromise:
2004920049 zig_unreachable();
20050 case TypeTableEntryIdVoid:
20050 case ZigTypeIdVoid:
2005120051 return;
20052 case TypeTableEntryIdBool:
20052 case ZigTypeIdBool:
2005320053 buf[0] = val->data.x_bool ? 1 : 0;
2005420054 return;
20055 case TypeTableEntryIdInt:
20055 case ZigTypeIdInt:
2005620056 bigint_write_twos_complement(&val->data.x_bigint, buf, val->type->data.integral.bit_count,
2005720057 codegen->is_big_endian);
2005820058 return;
20059 case TypeTableEntryIdFloat:
20059 case ZigTypeIdFloat:
2006020060 float_write_ieee597(val, buf, codegen->is_big_endian);
2006120061 return;
20062 case TypeTableEntryIdPointer:
20062 case ZigTypeIdPointer:
2006320063 if (val->data.x_ptr.special == ConstPtrSpecialHardCodedAddr) {
2006420064 BigInt bn;
2006520065 bigint_init_unsigned(&bn, val->data.x_ptr.data.hard_coded_addr.addr);
......@@ -20068,7 +20068,7 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
2006820068 } else {
2006920069 zig_unreachable();
2007020070 }
20071 case TypeTableEntryIdArray:
20071 case ZigTypeIdArray:
2007220072 {
2007320073 size_t buf_i = 0;
2007420074 expand_undef_array(codegen, val);
......@@ -20079,19 +20079,19 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
2007920079 }
2008020080 }
2008120081 return;
20082 case TypeTableEntryIdStruct:
20082 case ZigTypeIdStruct:
2008320083 zig_panic("TODO buf_write_value_bytes struct type");
20084 case TypeTableEntryIdOptional:
20084 case ZigTypeIdOptional:
2008520085 zig_panic("TODO buf_write_value_bytes maybe type");
20086 case TypeTableEntryIdErrorUnion:
20086 case ZigTypeIdErrorUnion:
2008720087 zig_panic("TODO buf_write_value_bytes error union");
20088 case TypeTableEntryIdErrorSet:
20088 case ZigTypeIdErrorSet:
2008920089 zig_panic("TODO buf_write_value_bytes pure error type");
20090 case TypeTableEntryIdEnum:
20090 case ZigTypeIdEnum:
2009120091 zig_panic("TODO buf_write_value_bytes enum type");
20092 case TypeTableEntryIdFn:
20092 case ZigTypeIdFn:
2009320093 zig_panic("TODO buf_write_value_bytes fn type");
20094 case TypeTableEntryIdUnion:
20094 case ZigTypeIdUnion:
2009520095 zig_panic("TODO buf_write_value_bytes union type");
2009620096 }
2009720097 zig_unreachable();
......@@ -20100,33 +20100,33 @@ static void buf_write_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
2010020100static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue *val) {
2010120101 assert(val->special == ConstValSpecialStatic);
2010220102 switch (val->type->id) {
20103 case TypeTableEntryIdInvalid:
20104 case TypeTableEntryIdMetaType:
20105 case TypeTableEntryIdOpaque:
20106 case TypeTableEntryIdBoundFn:
20107 case TypeTableEntryIdArgTuple:
20108 case TypeTableEntryIdNamespace:
20109 case TypeTableEntryIdBlock:
20110 case TypeTableEntryIdUnreachable:
20111 case TypeTableEntryIdComptimeFloat:
20112 case TypeTableEntryIdComptimeInt:
20113 case TypeTableEntryIdUndefined:
20114 case TypeTableEntryIdNull:
20115 case TypeTableEntryIdPromise:
20103 case ZigTypeIdInvalid:
20104 case ZigTypeIdMetaType:
20105 case ZigTypeIdOpaque:
20106 case ZigTypeIdBoundFn:
20107 case ZigTypeIdArgTuple:
20108 case ZigTypeIdNamespace:
20109 case ZigTypeIdBlock:
20110 case ZigTypeIdUnreachable:
20111 case ZigTypeIdComptimeFloat:
20112 case ZigTypeIdComptimeInt:
20113 case ZigTypeIdUndefined:
20114 case ZigTypeIdNull:
20115 case ZigTypeIdPromise:
2011620116 zig_unreachable();
20117 case TypeTableEntryIdVoid:
20117 case ZigTypeIdVoid:
2011820118 return;
20119 case TypeTableEntryIdBool:
20119 case ZigTypeIdBool:
2012020120 val->data.x_bool = (buf[0] != 0);
2012120121 return;
20122 case TypeTableEntryIdInt:
20122 case ZigTypeIdInt:
2012320123 bigint_read_twos_complement(&val->data.x_bigint, buf, val->type->data.integral.bit_count,
2012420124 codegen->is_big_endian, val->type->data.integral.is_signed);
2012520125 return;
20126 case TypeTableEntryIdFloat:
20126 case ZigTypeIdFloat:
2012720127 float_read_ieee597(val, buf, codegen->is_big_endian);
2012820128 return;
20129 case TypeTableEntryIdPointer:
20129 case ZigTypeIdPointer:
2013020130 {
2013120131 val->data.x_ptr.special = ConstPtrSpecialHardCodedAddr;
2013220132 BigInt bn;
......@@ -20135,21 +20135,21 @@ static void buf_read_value_bytes(CodeGen *codegen, uint8_t *buf, ConstExprValue
2013520135 val->data.x_ptr.data.hard_coded_addr.addr = bigint_as_unsigned(&bn);
2013620136 return;
2013720137 }
20138 case TypeTableEntryIdArray:
20138 case ZigTypeIdArray:
2013920139 zig_panic("TODO buf_read_value_bytes array type");
20140 case TypeTableEntryIdStruct:
20140 case ZigTypeIdStruct:
2014120141 zig_panic("TODO buf_read_value_bytes struct type");
20142 case TypeTableEntryIdOptional:
20142 case ZigTypeIdOptional:
2014320143 zig_panic("TODO buf_read_value_bytes maybe type");
20144 case TypeTableEntryIdErrorUnion:
20144 case ZigTypeIdErrorUnion:
2014520145 zig_panic("TODO buf_read_value_bytes error union");
20146 case TypeTableEntryIdErrorSet:
20146 case ZigTypeIdErrorSet:
2014720147 zig_panic("TODO buf_read_value_bytes pure error type");
20148 case TypeTableEntryIdEnum:
20148 case ZigTypeIdEnum:
2014920149 zig_panic("TODO buf_read_value_bytes enum type");
20150 case TypeTableEntryIdFn:
20150 case ZigTypeIdFn:
2015120151 zig_panic("TODO buf_read_value_bytes fn type");
20152 case TypeTableEntryIdUnion:
20152 case ZigTypeIdUnion:
2015320153 zig_panic("TODO buf_read_value_bytes union type");
2015420154 }
2015520155 zig_unreachable();
......@@ -20180,18 +20180,18 @@ static ZigType *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstructionBit
2018020180 }
2018120181
2018220182 switch (src_type->id) {
20183 case TypeTableEntryIdInvalid:
20184 case TypeTableEntryIdMetaType:
20185 case TypeTableEntryIdOpaque:
20186 case TypeTableEntryIdBoundFn:
20187 case TypeTableEntryIdArgTuple:
20188 case TypeTableEntryIdNamespace:
20189 case TypeTableEntryIdBlock:
20190 case TypeTableEntryIdUnreachable:
20191 case TypeTableEntryIdComptimeFloat:
20192 case TypeTableEntryIdComptimeInt:
20193 case TypeTableEntryIdUndefined:
20194 case TypeTableEntryIdNull:
20183 case ZigTypeIdInvalid:
20184 case ZigTypeIdMetaType:
20185 case ZigTypeIdOpaque:
20186 case ZigTypeIdBoundFn:
20187 case ZigTypeIdArgTuple:
20188 case ZigTypeIdNamespace:
20189 case ZigTypeIdBlock:
20190 case ZigTypeIdUnreachable:
20191 case ZigTypeIdComptimeFloat:
20192 case ZigTypeIdComptimeInt:
20193 case ZigTypeIdUndefined:
20194 case ZigTypeIdNull:
2019520195 ir_add_error(ira, dest_type_value,
2019620196 buf_sprintf("unable to @bitCast from type '%s'", buf_ptr(&src_type->name)));
2019720197 return ira->codegen->builtin_types.entry_invalid;
......@@ -20206,18 +20206,18 @@ static ZigType *ir_analyze_instruction_bit_cast(IrAnalyze *ira, IrInstructionBit
2020620206 }
2020720207
2020820208 switch (dest_type->id) {
20209 case TypeTableEntryIdInvalid:
20210 case TypeTableEntryIdMetaType:
20211 case TypeTableEntryIdOpaque:
20212 case TypeTableEntryIdBoundFn:
20213 case TypeTableEntryIdArgTuple:
20214 case TypeTableEntryIdNamespace:
20215 case TypeTableEntryIdBlock:
20216 case TypeTableEntryIdUnreachable:
20217 case TypeTableEntryIdComptimeFloat:
20218 case TypeTableEntryIdComptimeInt:
20219 case TypeTableEntryIdUndefined:
20220 case TypeTableEntryIdNull:
20209 case ZigTypeIdInvalid:
20210 case ZigTypeIdMetaType:
20211 case ZigTypeIdOpaque:
20212 case ZigTypeIdBoundFn:
20213 case ZigTypeIdArgTuple:
20214 case ZigTypeIdNamespace:
20215 case ZigTypeIdBlock:
20216 case ZigTypeIdUnreachable:
20217 case ZigTypeIdComptimeFloat:
20218 case ZigTypeIdComptimeInt:
20219 case ZigTypeIdUndefined:
20220 case ZigTypeIdNull:
2022120221 ir_add_error(ira, dest_type_value,
2022220222 buf_sprintf("unable to @bitCast to type '%s'", buf_ptr(&dest_type->name)));
2022320223 return ira->codegen->builtin_types.entry_invalid;
......@@ -20384,7 +20384,7 @@ static ZigType *ir_analyze_instruction_ptr_to_int(IrAnalyze *ira, IrInstructionP
2038420384 ConstExprValue *val = ir_resolve_const(ira, target, UndefBad);
2038520385 if (!val)
2038620386 return ira->codegen->builtin_types.entry_invalid;
20387 if (val->type->id == TypeTableEntryIdPointer && val->data.x_ptr.special == ConstPtrSpecialHardCodedAddr) {
20387 if (val->type->id == ZigTypeIdPointer && val->data.x_ptr.special == ConstPtrSpecialHardCodedAddr) {
2038820388 IrInstruction *result = ir_create_const(&ira->new_irb, instruction->base.scope,
2038920389 instruction->base.source_node, usize);
2039020390 bigint_init_unsigned(&result->value.data.x_bigint, val->data.x_ptr.data.hard_coded_addr.addr);
......@@ -20406,10 +20406,10 @@ static ZigType *ir_analyze_instruction_ptr_type(IrAnalyze *ira, IrInstructionPtr
2040620406 if (type_is_invalid(child_type))
2040720407 return ira->codegen->builtin_types.entry_invalid;
2040820408
20409 if (child_type->id == TypeTableEntryIdUnreachable) {
20409 if (child_type->id == ZigTypeIdUnreachable) {
2041020410 ir_add_error(ira, &instruction->base, buf_sprintf("pointer to noreturn not allowed"));
2041120411 return ira->codegen->builtin_types.entry_invalid;
20412 } else if (child_type->id == TypeTableEntryIdOpaque && instruction->ptr_len == PtrLenUnknown) {
20412 } else if (child_type->id == ZigTypeIdOpaque && instruction->ptr_len == PtrLenUnknown) {
2041320413 ir_add_error(ira, &instruction->base, buf_sprintf("unknown-length pointer to opaque"));
2041420414 return ira->codegen->builtin_types.entry_invalid;
2041520415 }
......@@ -20510,7 +20510,7 @@ static ZigType *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstructionArg
2051020510 if (!ir_resolve_usize(ira, arg_index_inst, &arg_index))
2051120511 return ira->codegen->builtin_types.entry_invalid;
2051220512
20513 if (fn_type->id != TypeTableEntryIdFn) {
20513 if (fn_type->id != ZigTypeIdFn) {
2051420514 ir_add_error(ira, fn_type_inst, buf_sprintf("expected function, found '%s'", buf_ptr(&fn_type->name)));
2051520515 return ira->codegen->builtin_types.entry_invalid;
2051620516 }
......@@ -20545,14 +20545,14 @@ static ZigType *ir_analyze_instruction_tag_type(IrAnalyze *ira, IrInstructionTag
2054520545 if (type_is_invalid(enum_type))
2054620546 return ira->codegen->builtin_types.entry_invalid;
2054720547
20548 if (enum_type->id == TypeTableEntryIdEnum) {
20548 if (enum_type->id == ZigTypeIdEnum) {
2054920549 if ((err = ensure_complete_type(ira->codegen, enum_type)))
2055020550 return ira->codegen->builtin_types.entry_invalid;
2055120551
2055220552 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
2055320553 out_val->data.x_type = enum_type->data.enumeration.tag_int_type;
2055420554 return ira->codegen->builtin_types.entry_type;
20555 } else if (enum_type->id == TypeTableEntryIdUnion) {
20555 } else if (enum_type->id == ZigTypeIdUnion) {
2055620556 if ((err = ensure_complete_type(ira->codegen, enum_type)))
2055720557 return ira->codegen->builtin_types.entry_invalid;
2055820558
......@@ -20734,7 +20734,7 @@ static ZigType *ir_analyze_instruction_coro_promise(IrAnalyze *ira, IrInstructio
2073420734 if (type_is_invalid(coro_handle->value.type))
2073520735 return ira->codegen->builtin_types.entry_invalid;
2073620736
20737 if (coro_handle->value.type->id != TypeTableEntryIdPromise ||
20737 if (coro_handle->value.type->id != ZigTypeIdPromise ||
2073820738 coro_handle->value.type->data.promise.result_type == nullptr)
2073920739 {
2074020740 ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T, found '%s'",
......@@ -20774,7 +20774,7 @@ static ZigType *ir_resolve_atomic_operand_type(IrAnalyze *ira, IrInstruction *op
2077420774 if (type_is_invalid(operand_type))
2077520775 return ira->codegen->builtin_types.entry_invalid;
2077620776
20777 if (operand_type->id == TypeTableEntryIdInt) {
20777 if (operand_type->id == ZigTypeIdInt) {
2077820778 if (operand_type->data.integral.bit_count < 8) {
2077920779 ir_add_error(ira, op,
2078020780 buf_sprintf("expected integer type 8 bits or larger, found %" PRIu32 "-bit integer type",
......@@ -20907,7 +20907,7 @@ static ZigType *ir_analyze_instruction_promise_result_type(IrAnalyze *ira, IrIns
2090720907 if (type_is_invalid(promise_type))
2090820908 return ira->codegen->builtin_types.entry_invalid;
2090920909
20910 if (promise_type->id != TypeTableEntryIdPromise || promise_type->data.promise.result_type == nullptr) {
20910 if (promise_type->id != ZigTypeIdPromise || promise_type->data.promise.result_type == nullptr) {
2091120911 ir_add_error(ira, &instruction->base, buf_sprintf("expected promise->T, found '%s'",
2091220912 buf_ptr(&promise_type->name)));
2091320913 return ira->codegen->builtin_types.entry_invalid;
......@@ -20942,9 +20942,9 @@ static ZigType *ir_analyze_instruction_merge_err_ret_traces(IrAnalyze *ira,
2094220942 if (type_is_invalid(coro_promise_ptr->value.type))
2094320943 return ira->codegen->builtin_types.entry_invalid;
2094420944
20945 assert(coro_promise_ptr->value.type->id == TypeTableEntryIdPointer);
20945 assert(coro_promise_ptr->value.type->id == ZigTypeIdPointer);
2094620946 ZigType *promise_frame_type = coro_promise_ptr->value.type->data.pointer.child_type;
20947 assert(promise_frame_type->id == TypeTableEntryIdStruct);
20947 assert(promise_frame_type->id == ZigTypeIdStruct);
2094820948 ZigType *promise_result_type = promise_frame_type->data.structure.fields[1].type_entry;
2094920949
2095020950 if (!type_can_fail(promise_result_type)) {
......@@ -20997,7 +20997,7 @@ static ZigType *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *i
2099720997 if (type_is_invalid(op->value.type))
2099820998 return ira->codegen->builtin_types.entry_invalid;
2099920999
21000 bool ok_type = float_type->id == TypeTableEntryIdComptimeFloat || float_type->id == TypeTableEntryIdFloat;
21000 bool ok_type = float_type->id == ZigTypeIdComptimeFloat || float_type->id == ZigTypeIdFloat;
2100121001 if (!ok_type) {
2100221002 ir_add_error(ira, instruction->type, buf_sprintf("@sqrt does not support type '%s'", buf_ptr(&float_type->name)));
2100321003 return ira->codegen->builtin_types.entry_invalid;
......@@ -21014,9 +21014,9 @@ static ZigType *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *i
2101421014
2101521015 ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base);
2101621016
21017 if (float_type->id == TypeTableEntryIdComptimeFloat) {
21017 if (float_type->id == ZigTypeIdComptimeFloat) {
2101821018 bigfloat_sqrt(&out_val->data.x_bigfloat, &val->data.x_bigfloat);
21019 } else if (float_type->id == TypeTableEntryIdFloat) {
21019 } else if (float_type->id == ZigTypeIdFloat) {
2102021020 switch (float_type->data.floating.bit_count) {
2102121021 case 16:
2102221022 out_val->data.x_f16 = f16_sqrt(val->data.x_f16);
......@@ -21040,7 +21040,7 @@ static ZigType *ir_analyze_instruction_sqrt(IrAnalyze *ira, IrInstructionSqrt *i
2104021040 return float_type;
2104121041 }
2104221042
21043 assert(float_type->id == TypeTableEntryIdFloat);
21043 assert(float_type->id == ZigTypeIdFloat);
2104421044 if (float_type->data.floating.bit_count != 16 &&
2104521045 float_type->data.floating.bit_count != 32 &&
2104621046 float_type->data.floating.bit_count != 64) {
......@@ -21061,7 +21061,7 @@ static ZigType *ir_analyze_instruction_enum_to_int(IrAnalyze *ira, IrInstruction
2106121061 if (type_is_invalid(target->value.type))
2106221062 return ira->codegen->builtin_types.entry_invalid;
2106321063
21064 if (target->value.type->id != TypeTableEntryIdEnum) {
21064 if (target->value.type->id != ZigTypeIdEnum) {
2106521065 ir_add_error(ira, instruction->target,
2106621066 buf_sprintf("expected enum, found type '%s'", buf_ptr(&target->value.type->name)));
2106721067 return ira->codegen->builtin_types.entry_invalid;
......@@ -21084,7 +21084,7 @@ static ZigType *ir_analyze_instruction_int_to_enum(IrAnalyze *ira, IrInstruction
2108421084 if (type_is_invalid(dest_type))
2108521085 return ira->codegen->builtin_types.entry_invalid;
2108621086
21087 if (dest_type->id != TypeTableEntryIdEnum) {
21087 if (dest_type->id != ZigTypeIdEnum) {
2108821088 ir_add_error(ira, instruction->dest_type,
2108921089 buf_sprintf("expected enum, found type '%s'", buf_ptr(&dest_type->name)));
2109021090 return ira->codegen->builtin_types.entry_invalid;
......@@ -21420,8 +21420,8 @@ static ZigType *ir_analyze_instruction(IrAnalyze *ira, IrInstruction *instructio
2142021420 if (instruction->other) {
2142121421 instruction->other->value.type = instruction_type;
2142221422 } else {
21423 assert(instruction_type->id == TypeTableEntryIdInvalid ||
21424 instruction_type->id == TypeTableEntryIdUnreachable);
21423 assert(instruction_type->id == ZigTypeIdInvalid ||
21424 instruction_type->id == ZigTypeIdUnreachable);
2142521425 instruction->other = instruction;
2142621426 }
2142721427
......@@ -21478,7 +21478,7 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_
2147821478 }
2147921479
2148021480 // unreachable instructions do their own control flow.
21481 if (return_type->id == TypeTableEntryIdUnreachable)
21481 if (return_type->id == ZigTypeIdUnreachable)
2148221482 continue;
2148321483
2148421484 ira->instruction_index += 1;