Commit graph

8 commits

Author SHA1 Message Date
mlugg
b4da8eef2a Zir: split up start and end of range in for_len
The old lowering was kind of neat, but it unintentionally allowed the
syntax `for (123) |_| { ... }`, and there wasn't really a way to fix
that. So, instead, we include both the start and the end of the range in
the `for_len` instruction (each operand to `for` now has *two* entries
in this multi-op instruction). This slightly increases the size of ZIR
for loops of predominantly indexables, but the difference is small
enough that it's not worth complicating ZIR to try and fix it.
2025-01-03 22:28:37 +00:00
mlugg
21fa187abc
test: update cases to silence 'var is never mutated' errors 2023-11-19 09:56:51 +00:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
r00ster91
3485a0e7fb Sema: fix and improve errors for for loop objects and non-indexables
Operands to @memcpy and @memset were being called "for loop operands" in
the error.
2023-05-06 09:32:34 +02:00
Andrew Kelley
8b05205bb7 implement error for unbounded for loops 2023-02-18 19:20:19 -07:00
Andrew Kelley
4dd958d585 improve error message for byref capture of byval array 2023-02-18 19:20:19 -07:00
Andrew Kelley
601db3981c fix source location for not-indexable for loop errors 2023-02-18 19:20:19 -07:00
Andrew Kelley
22965e6fcb Sema: improve error message for mismatched for loop lengths 2023-02-18 19:17:21 -07:00