| ... | @@ -24581,8 +24581,12 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -24581,8 +24581,12 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 24581 | | 24581 | |
| 24582 | const len = try sema.usizeCast(block, src, dest_ty.arrayLen(zcu)); | 24582 | const len = try sema.usizeCast(block, src, dest_ty.arrayLen(zcu)); |
| 24583 | | 24583 | |
| 24584 | // `len == 0` because `[0:s]T` always has a comptime-known splat. | 24584 | if (try sema.typeHasOnePossibleValue(dest_ty)) |val| { |
| 24585 | if (!dest_ty.hasRuntimeBits(zcu) or len == 0) { | 24585 | return Air.internedToRef(val.toIntern()); |
| | 24586 | } |
| | 24587 | |
| | 24588 | // We also need this case because `[0:s]T` is not OPV. |
| | 24589 | if (len == 0) { |
| 24586 | const empty_aggregate = try pt.intern(.{ .aggregate = .{ | 24590 | const empty_aggregate = try pt.intern(.{ .aggregate = .{ |
| 24587 | .ty = dest_ty.toIntern(), | 24591 | .ty = dest_ty.toIntern(), |
| 24588 | .storage = .{ .elems = &.{} }, | 24592 | .storage = .{ .elems = &.{} }, |