| ... | @@ -604,21 +604,7 @@ pub fn hasRuntimeBitsInner( | ... | @@ -604,21 +604,7 @@ pub fn hasRuntimeBitsInner( |
| 604 | // and then later if our guess was incorrect, we emit a compile error. | 604 | // and then later if our guess was incorrect, we emit a compile error. |
| 605 | if (union_type.assumeRuntimeBitsIfFieldTypesWip(ip)) return true; | 605 | if (union_type.assumeRuntimeBitsIfFieldTypesWip(ip)) return true; |
| 606 | }, | 606 | }, |
| 607 | .safety, .tagged => { | 607 | .safety, .tagged => {}, |
| 608 | const tag_ty = union_type.tagTypeUnordered(ip); | | |
| 609 | // tag_ty will be `none` if this union's tag type is not resolved yet, | | |
| 610 | // in which case we want control flow to continue down below. | | |
| 611 | if (tag_ty != .none and | | |
| 612 | try Type.fromInterned(tag_ty).hasRuntimeBitsInner( | | |
| 613 | ignore_comptime_only, | | |
| 614 | strat, | | |
| 615 | zcu, | | |
| 616 | tid, | | |
| 617 | )) | | |
| 618 | { | | |
| 619 | return true; | | |
| 620 | } | | |
| 621 | }, | | |
| 622 | } | 608 | } |
| 623 | switch (strat) { | 609 | switch (strat) { |
| 624 | .sema => try ty.resolveFields(strat.pt(zcu, tid)), | 610 | .sema => try ty.resolveFields(strat.pt(zcu, tid)), |
| ... | @@ -626,6 +612,21 @@ pub fn hasRuntimeBitsInner( | ... | @@ -626,6 +612,21 @@ pub fn hasRuntimeBitsInner( |
| 626 | .lazy => if (!union_flags.status.haveFieldTypes()) | 612 | .lazy => if (!union_flags.status.haveFieldTypes()) |
| 627 | return error.NeedLazy, | 613 | return error.NeedLazy, |
| 628 | } | 614 | } |
| | 615 | switch (union_flags.runtime_tag) { |
| | 616 | .none => {}, |
| | 617 | .safety, .tagged => { |
| | 618 | const tag_ty = union_type.tagTypeUnordered(ip); |
| | 619 | assert(tag_ty != .none); // tag_ty should have been resolved above |
| | 620 | if (try Type.fromInterned(tag_ty).hasRuntimeBitsInner( |
| | 621 | ignore_comptime_only, |
| | 622 | strat, |
| | 623 | zcu, |
| | 624 | tid, |
| | 625 | )) { |
| | 626 | return true; |
| | 627 | } |
| | 628 | }, |
| | 629 | } |
| 629 | for (0..union_type.field_types.len) |field_index| { | 630 | for (0..union_type.field_types.len) |field_index| { |
| 630 | const field_ty = Type.fromInterned(union_type.field_types.get(ip)[field_index]); | 631 | const field_ty = Type.fromInterned(union_type.field_types.get(ip)[field_index]); |
| 631 | if (try field_ty.hasRuntimeBitsInner(ignore_comptime_only, strat, zcu, tid)) | 632 | if (try field_ty.hasRuntimeBitsInner(ignore_comptime_only, strat, zcu, tid)) |