| ... | @@ -5296,41 +5296,6 @@ bool contains_comptime_undefined_value(ConstExprValue *value) { | ... | @@ -5296,41 +5296,6 @@ bool contains_comptime_undefined_value(ConstExprValue *value) { |
| 5296 | switch (value->type->id) { | 5296 | switch (value->type->id) { |
| 5297 | case TypeTableEntryIdInvalid: | 5297 | case TypeTableEntryIdInvalid: |
| 5298 | zig_unreachable(); | 5298 | zig_unreachable(); |
| 5299 | | | |
| 5300 | case TypeTableEntryIdPointer: { | | |
| 5301 | ConstPtrValue *ptr = &value->data.x_ptr; | | |
| 5302 | if (ptr->mut == ConstPtrMutRuntimeVar) | | |
| 5303 | return false; | | |
| 5304 | | | |
| 5305 | switch (ptr->special) { | | |
| 5306 | case ConstPtrSpecialInvalid: | | |
| 5307 | zig_unreachable(); | | |
| 5308 | case ConstPtrSpecialRef: | | |
| 5309 | return contains_comptime_undefined_value(ptr->data.ref.pointee); | | |
| 5310 | case ConstPtrSpecialBaseArray: { | | |
| 5311 | size_t index = ptr->data.base_array.elem_index; | | |
| 5312 | ConstExprValue *arr = ptr->data.base_array.array_val; | | |
| 5313 | if (arr->special == ConstValSpecialUndef) | | |
| 5314 | return true; | | |
| 5315 | if (arr->data.x_array.special == ConstArraySpecialUndef) | | |
| 5316 | return true; | | |
| 5317 | | | |
| 5318 | return contains_comptime_undefined_value(&arr->data.x_array.s_none.elements[index]); | | |
| 5319 | } | | |
| 5320 | case ConstPtrSpecialBaseStruct: { | | |
| 5321 | size_t index = ptr->data.base_struct.field_index; | | |
| 5322 | ConstExprValue *str = ptr->data.base_struct.struct_val; | | |
| 5323 | if (str->special == ConstValSpecialUndef) | | |
| 5324 | return true; | | |
| 5325 | | | |
| 5326 | return contains_comptime_undefined_value(&str->data.x_struct.fields[index]); | | |
| 5327 | } | | |
| 5328 | case ConstPtrSpecialFunction: // TODO: Can a fn ptr have an undefined value? | | |
| 5329 | case ConstPtrSpecialDiscard: | | |
| 5330 | case ConstPtrSpecialHardCodedAddr: | | |
| 5331 | return false; | | |
| 5332 | } | | |
| 5333 | } | | |
| 5334 | case TypeTableEntryIdArray: { | 5299 | case TypeTableEntryIdArray: { |
| 5335 | ConstArrayValue *arr = &value->data.x_array; | 5300 | ConstArrayValue *arr = &value->data.x_array; |
| 5336 | if (arr->special == ConstArraySpecialUndef) | 5301 | if (arr->special == ConstArraySpecialUndef) |
| ... | @@ -5344,42 +5309,6 @@ bool contains_comptime_undefined_value(ConstExprValue *value) { | ... | @@ -5344,42 +5309,6 @@ bool contains_comptime_undefined_value(ConstExprValue *value) { |
| 5344 | } | 5309 | } |
| 5345 | case TypeTableEntryIdStruct: { | 5310 | case TypeTableEntryIdStruct: { |
| 5346 | ConstStructValue *str = &value->data.x_struct; | 5311 | ConstStructValue *str = &value->data.x_struct; |
| 5347 | if (value->type->data.structure.is_slice) { | | |
| 5348 | ConstExprValue *len = &str->fields[slice_len_index]; | | |
| 5349 | ConstExprValue *ptr = &str->fields[slice_ptr_index]; | | |
| 5350 | if (len->special == ConstValSpecialUndef) | | |
| 5351 | return true; | | |
| 5352 | if (ptr->special == ConstValSpecialUndef) | | |
| 5353 | return true; | | |
| 5354 | | | |
| 5355 | switch (ptr->data.x_ptr.special) { | | |
| 5356 | case ConstPtrSpecialRef: | | |
| 5357 | return contains_comptime_undefined_value(ptr->data.x_ptr.data.ref.pointee); | | |
| 5358 | case ConstPtrSpecialBaseArray: { | | |
| 5359 | size_t offset = ptr->data.x_ptr.data.base_array.elem_index; | | |
| 5360 | ConstExprValue *arr = ptr->data.x_ptr.data.base_array.array_val; | | |
| 5361 | if (arr->special == ConstValSpecialUndef) | | |
| 5362 | return true; | | |
| 5363 | if (arr->data.x_array.special == ConstArraySpecialUndef) | | |
| 5364 | return true; | | |
| 5365 | | | |
| 5366 | uint64_t slice_len = bigint_as_unsigned(&len->data.x_bigint); | | |
| 5367 | for (size_t i = 0; i < slice_len; ++i) { | | |
| 5368 | if (contains_comptime_undefined_value(&arr->data.x_array.s_none.elements[i + offset])) | | |
| 5369 | return true; | | |
| 5370 | } | | |
| 5371 | | | |
| 5372 | return false; | | |
| 5373 | } | | |
| 5374 | case ConstPtrSpecialBaseStruct: | | |
| 5375 | case ConstPtrSpecialInvalid: | | |
| 5376 | case ConstPtrSpecialFunction: | | |
| 5377 | case ConstPtrSpecialDiscard: | | |
| 5378 | case ConstPtrSpecialHardCodedAddr: | | |
| 5379 | zig_unreachable(); | | |
| 5380 | } | | |
| 5381 | } | | |
| 5382 | | | |
| 5383 | for (size_t i = 0; i < value->type->data.structure.src_field_count; ++i) { | 5312 | for (size_t i = 0; i < value->type->data.structure.src_field_count; ++i) { |
| 5384 | if (contains_comptime_undefined_value(&str->fields[i])) | 5313 | if (contains_comptime_undefined_value(&str->fields[i])) |
| 5385 | return true; | 5314 | return true; |
| ... | @@ -5400,6 +5329,7 @@ bool contains_comptime_undefined_value(ConstExprValue *value) { | ... | @@ -5400,6 +5329,7 @@ bool contains_comptime_undefined_value(ConstExprValue *value) { |
| 5400 | case TypeTableEntryIdUnion: | 5329 | case TypeTableEntryIdUnion: |
| 5401 | return contains_comptime_undefined_value(value->data.x_union.payload); | 5330 | return contains_comptime_undefined_value(value->data.x_union.payload); |
| 5402 | | 5331 | |
| | 5332 | case TypeTableEntryIdPointer: |
| 5403 | case TypeTableEntryIdArgTuple: | 5333 | case TypeTableEntryIdArgTuple: |
| 5404 | case TypeTableEntryIdVoid: | 5334 | case TypeTableEntryIdVoid: |
| 5405 | case TypeTableEntryIdBool: | 5335 | case TypeTableEntryIdBool: |