| author | |
| committer | |
| log | 0e405c5fc52945a03711454e86c1caa7c72c4d02 |
| tree | e4ce7066139e5ffe9f932dc3b9cb8f72883bb93d |
| parent | 7de138ad7cef1f9d1743a82f9a0419142484f24a |
| signature | Commit is signed but in an unrecognized format. |
2 files changed, 18 insertions(+), 0 deletions(-)
src/ir.cpp+5| ... | ... | @@ -17682,6 +17682,11 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 17682 | 17682 | if (!handle_is_ptr(result_loc->value->type->data.pointer.child_type)) { |
| 17683 | 17683 | ir_reset_result(call_instruction->result_loc); |
| 17684 | 17684 | result_loc = nullptr; |
| 17685 | } else { | |
| 17686 | call_instruction->base.value.type = return_type; | |
| 17687 | IrInstruction *casted_value = ir_implicit_cast(ira, &call_instruction->base, result_loc->value.type->data.pointer.child_type); | |
| 17688 | if (type_is_invalid(casted_value->value.type)) | |
| 17689 | return casted_value; | |
| 17685 | 17690 | } |
| 17686 | 17691 | } |
| 17687 | 17692 | } else if (call_instruction->is_async_call_builtin) { |
test/compile_errors.zig+13| ... | ... | @@ -96,6 +96,19 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 96 | 96 | "tmp.zig:11:25: error: expected type 'u32', found '@typeOf(get_uval).ReturnType.ErrorSet!u32'", |
| 97 | 97 | ); |
| 98 | 98 | |
| 99 | cases.add( | |
| 100 | "function call assigned to incorrect type", | |
| 101 | \\export fn entry() void { | |
| 102 | \\ var arr: [4]f32 = undefined; | |
| 103 | \\ arr = concat(); | |
| 104 | \\} | |
| 105 | \\fn concat() [16]f32 { | |
| 106 | \\ return [1]f32{0}**16; | |
| 107 | \\} | |
| 108 | , | |
| 109 | "tmp.zig:3:17: error: expected type '[4]f32', found '[16]f32'" | |
| 110 | ); | |
| 111 | ||
| 99 | 112 | cases.add( |
| 100 | 113 | "asigning to struct or union fields that are not optionals with a function that returns an optional", |
| 101 | 114 | \\fn maybe(is: bool) ?u8 { |