0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test/behavior/array.zig
Justus Klausecker c566010559 Sema: make slices with comptime-known lengths and OPV elem types deref correctly
Basically removes a bunch of special casing for slices from the main `analyzeLoad`
code path and moves it to the new `preparePtrForDeref` function which supplants
the `verifyDeref` function. The `preparePtrForDeref` function turns slices with
comptime-known lengths into single-item pointers to arrays and is called directly
in the functions where that kind of conversion could happen. All subsequent code
now doesn't have to deal with the possibility that a derefable pointer could be a
slice anymore.
This fixes a bug where dereferencing a slice of an OPV type would result in
a single instance of that OPV type as if the slice had been a single-item
pointer to that type.
2026-11-03 13:46:38 +01:00

1122 lines
34 KiB