zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit e27b2b3ab911df8b7905d8adba589d0e3c87d65b (tree)
parent 3a4d565254f918bc949179f0f5a6934ef43b4f0d
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sun, 16 Jul 2023 21:51:59 -0700

Sema: restore WipCaptures logic

Earlier in this branch, I failed to properly port this logic while
reworking generic functions. This commit fixes it.

Diffstat:
Msrc/Sema.zig | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/Sema.zig b/src/Sema.zig @@ -7509,12 +7509,15 @@ fn instantiateGenericCall( }; defer child_sema.deinit(); + var wip_captures = try WipCaptureScope.init(gpa, sema.owner_decl.src_scope); + defer wip_captures.deinit(); + var child_block: Block = .{ .parent = null, .sema = &child_sema, .src_decl = generic_owner_func.owner_decl, .namespace = namespace_index, - .wip_capture_scope = block.wip_capture_scope, + .wip_capture_scope = wip_captures.scope, .instructions = .{}, .inlining = null, .is_comptime = true, @@ -7551,6 +7554,8 @@ fn instantiateGenericCall( const func_ty = callee.ty.toType(); const func_ty_info = mod.typeToFunc(func_ty).?; + try wip_captures.finalize(); + // If the call evaluated to a return type that requires comptime, never mind // our generic instantiation. Instead we need to perform a comptime call. if (try sema.typeRequiresComptime(func_ty_info.return_type.toType())) {