zig/test/behavior
Andrew Kelley 70894d5c2f AstGen: fix loop result locations
The main problem was that the loop body was treated as an expression
that was one of the peer result values of a loop, when in reality the
loop body is noreturn and only the `break` operands are the result
values of loops.

This was solved by introducing an override that prevents rvalue() from
emitting a store to result location instruction for loop bodies.

An orthogonal change also included in this commit is switching
`elem_val` index expressions to using `coerced_ty` and doing the
coercion to `usize` inside `Sema`, resulting in smaller ZIR (since the
cast becomes implied).

I also changed the break operand expression to use `reachableExpr`,
introducing a new compile error for double break.

This makes a few more behavior tests pass for `while` and `for` loops.
2021-12-27 15:30:31 -07:00
..
2021-12-27 15:30:31 -07:00
2021-10-21 19:05:26 -07:00
2021-10-21 19:05:26 -07:00
2021-10-26 16:43:18 -07:00
2021-10-28 17:33:05 -07:00
2021-08-30 18:50:07 -04:00
2021-11-22 03:21:31 +01:00
2021-12-21 01:47:27 +01:00
2021-12-21 01:47:27 +01:00
2021-11-27 00:27:52 -07:00
2021-11-27 00:27:52 -07:00
2021-12-27 15:30:31 -07:00
2021-11-27 00:27:52 -07:00
2021-12-21 01:47:27 +01:00
2021-12-21 01:47:27 +01:00
2021-11-27 00:27:52 -07:00
2021-11-26 23:17:01 -07:00
2021-07-26 20:05:48 -04:00
2021-11-27 00:27:52 -07:00
2021-12-27 15:30:31 -07:00