aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-08-05 19:15:59 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-08-05 19:19:19 -0700
commitc03a04a58942446b48e9294df991a17a3a6f7b48 (patch)
tree9e306df81d9c1443bee81ccc499d76f620e23923 /src/Module.zig
parente9e3a2994696a3131125ebc4b1f0eec7ca5306d9 (diff)
downloadzig-c03a04a58942446b48e9294df991a17a3a6f7b48.tar.gz
zig-c03a04a58942446b48e9294df991a17a3a6f7b48.zip
stage2: return type expressions of generic functions
* ZIR encoding for function instructions have a body for the return type. This lets Sema for generic functions do the same thing it does for parameters, handling `error.GenericPoison` in the evaluation of the return type by marking the function as generic. * Sema: fix missing block around the new Decl arena finalization. This led to a memory corruption. * Added some floating point support to the LLVM backend but didn't get far enough to pass any new tests.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 2556ad3f0e..da11bc1c3c 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -842,6 +842,9 @@ pub const Fn = struct {
pub fn getInferredErrorSet(func: *Fn) ?*std.StringHashMapUnmanaged(void) {
const ret_ty = func.owner_decl.ty.fnReturnType();
+ if (ret_ty.tag() == .generic_poison) {
+ return null;
+ }
if (ret_ty.zigTypeTag() == .ErrorUnion) {
if (ret_ty.errorUnionSet().castTag(.error_set_inferred)) |payload| {
return &payload.data.map;