Commit e27b2b3ab9

Andrew Kelley <andrew@ziglang.org>
2023-07-17 06:51:59
Sema: restore WipCaptures logic
Earlier in this branch, I failed to properly port this logic while reworking generic functions. This commit fixes it.
1 parent 3a4d565
Changed files (1)
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())) {