aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorWillLillis <wlillis@umass.edu>2024-07-20 02:31:19 -0400
committerAndrew Kelley <andrew@ziglang.org>2024-07-21 00:10:36 -0700
commit18d412ab2fb7bda92f7bfbdf732849bbcd066c33 (patch)
tree3363867ffee39f01401cd130f82f108d087ec62e /src/Sema.zig
parent9b292c094909e51718c1d37dbeb859674dd98c8a (diff)
downloadzig-18d412ab2fb7bda92f7bfbdf732849bbcd066c33.tar.gz
zig-18d412ab2fb7bda92f7bfbdf732849bbcd066c33.zip
fix: remove misleading error note for failed array coercions
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index f0a4e7f4c2..959545c9dd 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -30279,7 +30279,7 @@ pub fn coerceInMemoryAllowed(
if ((src_info.signedness == dest_info.signedness and dest_info.bits < src_info.bits) or
// small enough unsigned ints can get casted to large enough signed ints
- (dest_info.signedness == .signed and (src_info.signedness == .unsigned or dest_info.bits <= src_info.bits)) or
+ (dest_info.signedness == .signed and src_info.signedness == .unsigned and dest_info.bits <= src_info.bits) or
(dest_info.signedness == .unsigned and src_info.signedness == .signed))
{
return InMemoryCoercionResult{ .int_not_coercible = .{
@@ -30360,12 +30360,16 @@ pub fn coerceInMemoryAllowed(
}
const child = try sema.coerceInMemoryAllowed(block, dest_info.elem_type, src_info.elem_type, dest_is_mut, target, dest_src, src_src, null);
- if (child != .ok) {
- return InMemoryCoercionResult{ .array_elem = .{
- .child = try child.dupe(sema.arena),
- .actual = src_info.elem_type,
- .wanted = dest_info.elem_type,
- } };
+ switch (child) {
+ .ok => {},
+ .no_match => return child,
+ else => {
+ return InMemoryCoercionResult{ .array_elem = .{
+ .child = try child.dupe(sema.arena),
+ .actual = src_info.elem_type,
+ .wanted = dest_info.elem_type,
+ } };
+ },
}
const ok_sent = (dest_info.sentinel == null and src_info.sentinel == null) or
(src_info.sentinel != null and