From e27b2b3ab911df8b7905d8adba589d0e3c87d65b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 16 Jul 2023 21:51:59 -0700 Subject: [PATCH] Sema: restore WipCaptures logic Earlier in this branch, I failed to properly port this logic while reworking generic functions. This commit fixes it. --- src/Sema.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Sema.zig b/src/Sema.zig index e95c248428..d12540427c 100644 --- 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())) {