| author | |
| committer | |
| log | 9fa35adbd4772f55e3e43dd7cc69823415661153 |
| tree | 3b678df3295a336401543d072d5d7e01ba26aed7 |
| parent | 629f134d3805f99938f59a6ee7f6598591abc9d7 |
closes #774
regression introduced in cfb2c676925d77887e46631dcafa783e6c65e61d2 files changed, 14 insertions(+), 1 deletions(-)
src/ir.cpp+1-1| ... | ... | @@ -6727,8 +6727,8 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, TypeTableEntry |
| 6727 | 6727 | result.id = ConstCastResultIdFnReturnType; |
| 6728 | 6728 | result.data.return_type = allocate_nonzero<ConstCastOnly>(1); |
| 6729 | 6729 | *result.data.return_type = child; |
| 6730 | return result; | |
| 6730 | 6731 | } |
| 6731 | return result; | |
| 6732 | 6732 | } |
| 6733 | 6733 | if (expected_type->data.fn.fn_type_id.param_count != actual_type->data.fn.fn_type_id.param_count) { |
| 6734 | 6734 | result.id = ConstCastResultIdFnArgCount; |
test/compile_errors.zig+13| ... | ... | @@ -1,6 +1,19 @@ |
| 1 | 1 | const tests = @import("tests.zig"); |
| 2 | 2 | |
| 3 | 3 | pub fn addCases(cases: &tests.CompileErrorContext) void { |
| 4 | cases.add("type checking function pointers", | |
| 5 | \\fn a(b: fn (&const u8) void) void { | |
| 6 | \\ b('a'); | |
| 7 | \\} | |
| 8 | \\fn c(d: u8) void { | |
| 9 | \\ @import("std").debug.warn("{c}\n", d); | |
| 10 | \\} | |
| 11 | \\export fn entry() void { | |
| 12 | \\ a(c); | |
| 13 | \\} | |
| 14 | , | |
| 15 | ".tmp_source.zig:8:7: error: expected type 'fn(&const u8) void', found 'fn(u8) void'"); | |
| 16 | ||
| 4 | 17 | cases.add("no else prong on switch on global error set", |
| 5 | 18 | \\export fn entry() void { |
| 6 | 19 | \\ foo(error.A); |