aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-09 00:10:53 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-02-09 00:10:53 -0700
commit97019bc56d27349e0aeb44faa9d3f738887abe7f (patch)
tree4c9ceb095fa8885a21a77030108d8cae90173e3e /src/Module.zig
parentf4fa32a63219917e8fb26f43cbd2d97b17e0aeee (diff)
downloadzig-97019bc56d27349e0aeb44faa9d3f738887abe7f.tar.gz
zig-97019bc56d27349e0aeb44faa9d3f738887abe7f.zip
Sema: handle inferred error set tail call
When Sema sees a store_node instruction, it now checks for the possibility of this pattern: %a = ret_ptr %b = store(%a, %c) Where %c is an error union. In such case we need to add to the current function's inferred error set, if any. Coercion from error union to error union will be handled ideally if the operand is comptime known. In such case it does the appropriate unwrapping, then wraps again. In the future, coercion from error union to error union should do the same thing for a runtime value; emitting a runtime branch to check if the value is an error or not. `Value.arrayLen` for structs returns the number of fields. This is so that Liveness can use it for the `vector_init` instruction (soon to be renamed to `aggregate_init`).
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Module.zig b/src/Module.zig
index bc806cfb9c..3631e41f25 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -3547,7 +3547,7 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void {
.code = file.zir,
.owner_decl = new_decl,
.func = null,
- .fn_ret_ty = Type.initTag(.void),
+ .fn_ret_ty = Type.void,
.owner_func = null,
};
defer sema.deinit();
@@ -3628,7 +3628,7 @@ fn semaDecl(mod: *Module, decl: *Decl) !bool {
.code = zir,
.owner_decl = decl,
.func = null,
- .fn_ret_ty = Type.initTag(.void),
+ .fn_ret_ty = Type.void,
.owner_func = null,
};
defer sema.deinit();