| author | |
| committer | |
| log | 914ad1ec2eff4ea9061804ad0da9cde7dd6543b6 |
| tree | 387ccac6981a2c0ab0ce4698ed3363cc4f49c082 |
| parent | c6e77f248d3771070162d80341f9aeef89a49924 |
| signature |
...runtime condition, comptime prongs.
closes #32442 files changed, 21 insertions(+), 1 deletions(-)
src/ir.cpp+1-1| ... | ... | @@ -15198,7 +15198,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 15198 | 15198 | } |
| 15199 | 15199 | peer_parent->skipped = true; |
| 15200 | 15200 | return ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, |
| 15201 | value_type, value, force_runtime, true, true); | |
| 15201 | value_type, value, force_runtime || !is_comptime, true, true); | |
| 15202 | 15202 | } |
| 15203 | 15203 | |
| 15204 | 15204 | if (peer_parent->resolved_type == nullptr) { |
test/stage1/behavior/misc.zig+20| ... | ... | @@ -721,3 +721,23 @@ test "global variable assignment with optional unwrapping with var initialized t |
| 721 | 721 | }; |
| 722 | 722 | expect(global_foo.* == 1234); |
| 723 | 723 | } |
| 724 | ||
| 725 | test "peer result location with typed parent, runtime condition, comptime prongs" { | |
| 726 | const S = struct { | |
| 727 | fn doTheTest(arg: i32) i32 { | |
| 728 | const st = Structy{ | |
| 729 | .bleh = if (arg == 1) 1 else 1, | |
| 730 | }; | |
| 731 | ||
| 732 | if (st.bleh == 1) | |
| 733 | return 1234; | |
| 734 | return 0; | |
| 735 | } | |
| 736 | ||
| 737 | const Structy = struct { | |
| 738 | bleh: i32, | |
| 739 | }; | |
| 740 | }; | |
| 741 | expect(S.doTheTest(0) == 1234); | |
| 742 | expect(S.doTheTest(1) == 1234); | |
| 743 | } |