| author | |
| committer | |
| log | 924dd674e2e584bbef5e7650f481e49829c8fe28 |
| tree | fec5f00575cf95b8584e498683de9234fd4c9b9a |
| parent | 6cddf9d7238a58b88064c3f3ce6e3948143598d8 |
Fixes #37032 files changed, 14 insertions(+), 0 deletions(-)
src/ir.cpp+2| ... | @@ -17695,6 +17695,8 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh | ... | @@ -17695,6 +17695,8 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh |
| 17695 | peer_parent->resolved_type = ir_resolve_peer_types(ira, | 17695 | peer_parent->resolved_type = ir_resolve_peer_types(ira, |
| 17696 | peer_parent->base.source_instruction->source_node, expected_type, instructions, | 17696 | peer_parent->base.source_instruction->source_node, expected_type, instructions, |
| 17697 | peer_parent->peers.length); | 17697 | peer_parent->peers.length); |
| 17698 | if (type_is_invalid(peer_parent->resolved_type)) | ||
| 17699 | return ira->codegen->invalid_instruction; | ||
| 17698 | 17700 | ||
| 17699 | // the logic below assumes there are no instructions in the new current basic block yet | 17701 | // the logic below assumes there are no instructions in the new current basic block yet |
| 17700 | ir_assert(ira->new_irb.current_basic_block->instruction_list.length == 0, &phi_instruction->base); | 17702 | ir_assert(ira->new_irb.current_basic_block->instruction_list.length == 0, &phi_instruction->base); |
test/compile_errors.zig+12| ... | @@ -2,6 +2,18 @@ const tests = @import("tests.zig"); | ... | @@ -2,6 +2,18 @@ const tests = @import("tests.zig"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | 3 | ||
| 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { | 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 5 | cases.add( | ||
| 6 | "missing result type for phi node", | ||
| 7 | \\fn foo() !void { | ||
| 8 | \\ return anyerror.Foo; | ||
| 9 | \\} | ||
| 10 | \\export fn entry() void { | ||
| 11 | \\ foo() catch 0; | ||
| 12 | \\} | ||
| 13 | , | ||
| 14 | "tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void'", | ||
| 15 | ); | ||
| 16 | |||
| 5 | cases.add( | 17 | cases.add( |
| 6 | "atomicrmw with enum op not .Xchg", | 18 | "atomicrmw with enum op not .Xchg", |
| 7 | \\export fn entry() void { | 19 | \\export fn entry() void { |