aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-29 16:56:12 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-29 16:56:12 -0700
commitb59428e9f78b1f9f265c0ffdba79b128d77644d2 (patch)
treec6a9a066eee45fc5ca3009e3b8bcf1f219adbd83 /src
parent12e1304805cbe132d17b31bac2e8123869007e4d (diff)
downloadzig-b59428e9f78b1f9f265c0ffdba79b128d77644d2.tar.gz
zig-b59428e9f78b1f9f265c0ffdba79b128d77644d2.zip
Sema: adjust coercion of undefined error union payload
To no longer set the error code to undefined. This fixes the problem where an undefined single-item pointer coerced to an error union of a slice set the whole thing to undefined even though the sub-coercion to the slice would have produced a defined value.
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig5
1 files changed, 0 insertions, 5 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index afb97f3b3d..09f99c5751 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -18140,11 +18140,6 @@ fn coerce(
return sema.addConstUndef(dest_ty);
},
else => {
- // undefined sets the error code also to undefined.
- if (is_undef) {
- return sema.addConstUndef(dest_ty);
- }
-
// T to E!T
return sema.wrapErrorUnionPayload(block, dest_ty, inst, inst_src);
},