| author | |
| committer | |
| log | a99ad52b362d966f772f29ad14ae1714218bc033 |
| tree | ad8a93f55ed7c4cff101789aedea0b5cc930d0f6 |
| parent | 2fb78430dbff206af24ecd5e7be163e624fdbb6f |
| signature |
And add a corresponding test case.2 files changed, 30 insertions(+), 0 deletions(-)
src/Sema.zig+7| ... | ... | @@ -7598,6 +7598,9 @@ fn analyzeCall( |
| 7598 | 7598 | |
| 7599 | 7599 | const module_fn = zcu.funcInfo(module_fn_index); |
| 7600 | 7600 | |
| 7601 | // The call site definitely depends on the function's signature. | |
| 7602 | try sema.declareDependency(.{ .src_hash = module_fn.zir_body_inst }); | |
| 7603 | ||
| 7601 | 7604 | // This is not a function instance, so the function's `Nav` has a |
| 7602 | 7605 | // `Cau` -- we don't need to check `generic_owner`. |
| 7603 | 7606 | const fn_nav = ip.getNav(module_fn.owner_nav); |
| ... | ... | @@ -7755,6 +7758,10 @@ fn analyzeCall( |
| 7755 | 7758 | break :res Air.internedToRef(memoized_call.result); |
| 7756 | 7759 | } |
| 7757 | 7760 | |
| 7761 | // Since we're doing an inline call, we depend on the source code of the whole | |
| 7762 | // function declaration. | |
| 7763 | try sema.declareDependency(.{ .src_hash = fn_cau.zir_index }); | |
| 7764 | ||
| 7758 | 7765 | new_fn_info.return_type = sema.fn_ret_ty.toIntern(); |
| 7759 | 7766 | if (!is_comptime_call and !block.is_typeof) { |
| 7760 | 7767 | const zir_tags = sema.code.instructions.items(.tag); |
test/incremental/modify_inline_fn created+23| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | #target=x86_64-linux | |
| 2 | #update=initial version | |
| 3 | #file=main.zig | |
| 4 | const std = @import("std"); | |
| 5 | pub fn main() !void { | |
| 6 | const str = getStr(); | |
| 7 | try std.io.getStdOut().writeAll(str); | |
| 8 | } | |
| 9 | inline fn getStr() []const u8 { | |
| 10 | return "foo\n"; | |
| 11 | } | |
| 12 | #expect_stdout="foo\n" | |
| 13 | #update=change the string | |
| 14 | #file=main.zig | |
| 15 | const std = @import("std"); | |
| 16 | pub fn main() !void { | |
| 17 | const str = getStr(); | |
| 18 | try std.io.getStdOut().writeAll(str); | |
| 19 | } | |
| 20 | inline fn getStr() []const u8 { | |
| 21 | return "bar\n"; | |
| 22 | } | |
| 23 | #expect_stdout="bar\n" |