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(...@@ -7509,12 +7509,15 @@ fn instantiateGenericCall(
7509 };7509 };
7510 defer child_sema.deinit();7510 defer child_sema.deinit();
75117511
7512 var wip_captures = try WipCaptureScope.init(gpa, sema.owner_decl.src_scope);
7513 defer wip_captures.deinit();
7514
7512 var child_block: Block = .{7515 var child_block: Block = .{
7513 .parent = null,7516 .parent = null,
7514 .sema = &child_sema,7517 .sema = &child_sema,
7515 .src_decl = generic_owner_func.owner_decl,7518 .src_decl = generic_owner_func.owner_decl,
7516 .namespace = namespace_index,7519 .namespace = namespace_index,
7517 .wip_capture_scope = block.wip_capture_scope,7520 .wip_capture_scope = wip_captures.scope,
7518 .instructions = .{},7521 .instructions = .{},
7519 .inlining = null,7522 .inlining = null,
7520 .is_comptime = true,7523 .is_comptime = true,
...@@ -7551,6 +7554,8 @@ fn instantiateGenericCall(...@@ -7551,6 +7554,8 @@ fn instantiateGenericCall(
7551 const func_ty = callee.ty.toType();7554 const func_ty = callee.ty.toType();
7552 const func_ty_info = mod.typeToFunc(func_ty).?;7555 const func_ty_info = mod.typeToFunc(func_ty).?;
75537556
7557 try wip_captures.finalize();
7558
7554 // If the call evaluated to a return type that requires comptime, never mind7559 // If the call evaluated to a return type that requires comptime, never mind
7555 // our generic instantiation. Instead we need to perform a comptime call.7560 // our generic instantiation. Instead we need to perform a comptime call.
7556 if (try sema.typeRequiresComptime(func_ty_info.return_type.toType())) {7561 if (try sema.typeRequiresComptime(func_ty_info.return_type.toType())) {