authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-16 21:51:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-18 19:02:06-07:00
loge27b2b3ab911df8b7905d8adba589d0e3c87d65b
tree0a4cf80287eec7d12f8c17a0cb78bd52e1aeb41b
parent3a4d565254f918bc949179f0f5a6934ef43b4f0d

Sema: restore WipCaptures logic

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

1 files changed, 6 insertions(+), 1 deletions(-)

src/Sema.zig+6-1
......@@ -7509,12 +7509,15 @@ fn instantiateGenericCall(
75097509 };
75107510 defer child_sema.deinit();
75117511
7512 var wip_captures = try WipCaptureScope.init(gpa, sema.owner_decl.src_scope);
7513 defer wip_captures.deinit();
7514
75127515 var child_block: Block = .{
75137516 .parent = null,
75147517 .sema = &child_sema,
75157518 .src_decl = generic_owner_func.owner_decl,
75167519 .namespace = namespace_index,
7517 .wip_capture_scope = block.wip_capture_scope,
7520 .wip_capture_scope = wip_captures.scope,
75187521 .instructions = .{},
75197522 .inlining = null,
75207523 .is_comptime = true,
......@@ -7551,6 +7554,8 @@ fn instantiateGenericCall(
75517554 const func_ty = callee.ty.toType();
75527555 const func_ty_info = mod.typeToFunc(func_ty).?;
75537556
7557 try wip_captures.finalize();
7558
75547559 // If the call evaluated to a return type that requires comptime, never mind
75557560 // our generic instantiation. Instead we need to perform a comptime call.
75567561 if (try sema.typeRequiresComptime(func_ty_info.return_type.toType())) {