aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/break_void_result_location.zig
AgeCommit message (Collapse)Author
2025-09-16test: rename backend=stage2 to backend=selfhosted, and add backend=autoAlex Rønne Petersen
backend=auto (now the default if backend is omitted) means to let the compiler pick whatever backend it wants as the default. This is important for platforms where we don't yet have a self-hosted backend, such as loongarch64. Also purge a bunch of redundant target=native.
2023-11-19test: update cases to silence 'var is never mutated' errorsmlugg
2023-08-20AstGen: add result location analysis passmlugg
The main motivation for this change is eliminating the `block_ptr` result location and corresponding `store_to_block_ptr` ZIR instruction. This is achieved through a simple pass over the AST before AstGen which determines, for AST nodes which have a choice on whether to provide a result location, which choice to make, based on whether the result pointer is consumed non-trivially. This eliminates so much logic from AstGen that we almost break even on line count! AstGen no longer has to worry about instruction rewriting based on whether or not a result location was consumed: it always knows what to do ahead of time, which simplifies a *lot* of logic. This also incidentally fixes a few random AstGen bugs related to result location handling, leading to the changes in `test/` and `lib/std/`. This opens the door to future RLS improvements by making them much easier to implement correctly, and fixes many bugs. Most ZIR is made more compact after this commit, mainly due to not having redundant `store_to_block_ptr` instructions lying around, but also due to a few bugs in the old system which are implicitly fixed here.
2023-06-25AstGen: add source location to certain const initializersJacob Young
Before: assign_local_bad_coercion.zig:5:1: error: expected type 'u32', found 'u64' export fn constEntry() u32 { ^~~~~~ assign_local_bad_coercion.zig:11:19: error: expected type 'u32', found 'u64' var x: u32 = g(); ~^~ After: assign_local_bad_coercion.zig:6:21: error: expected type 'u32', found 'u64' const x: u32 = g(); ~^~ assign_local_bad_coercion.zig:11:19: error: expected type 'u32', found 'u64' var x: u32 = g(); ~^~
2023-03-08astgen: fill result location with `void` value if no other valueJohn Schmidt
With this change, `break` and `break :blk` will fill the result location with `.void_value`, ensuring that the value will be type checked. The same will happen for a for loop that contains no `break`s in it's body. Closes https://github.com/ziglang/zig/issues/14686.