diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2023-06-02 01:15:36 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-06-10 20:47:59 -0700 |
| commit | 04e66e6b4deb67aef9a4064decd82a678cb7ec82 (patch) | |
| tree | 85c7c8127147467d13707adbc255fc1239b1b7f6 /src/Sema.zig | |
| parent | fdfe730487972f089786938706f311b1f8631333 (diff) | |
| download | zig-04e66e6b4deb67aef9a4064decd82a678cb7ec82.tar.gz zig-04e66e6b4deb67aef9a4064decd82a678cb7ec82.zip | |
InternPool: add optional coercion
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 794638ea43..f8af883c42 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -26470,7 +26470,11 @@ fn coerceExtra( } if (dest_info.sentinel == null or inst_info.sentinel == null or - !dest_info.sentinel.?.eql(inst_info.sentinel.?, dest_info.pointee_type, mod)) + !dest_info.sentinel.?.eql( + try mod.getCoerced(inst_info.sentinel.?, dest_info.pointee_type), + dest_info.pointee_type, + mod, + )) break :p; const slice_ptr = try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty); @@ -27350,7 +27354,11 @@ fn coerceInMemoryAllowed( } const ok_sent = dest_info.sentinel == null or (src_info.sentinel != null and - dest_info.sentinel.?.eql(src_info.sentinel.?, dest_info.elem_type, mod)); + dest_info.sentinel.?.eql( + try mod.getCoerced(src_info.sentinel.?, dest_info.elem_type), + dest_info.elem_type, + mod, + )); if (!ok_sent) { return InMemoryCoercionResult{ .array_sentinel = .{ .actual = src_info.sentinel orelse Value.@"unreachable", @@ -27704,8 +27712,11 @@ fn coerceInMemoryAllowedPtrs( } const ok_sent = dest_info.sentinel == null or src_info.size == .C or - (src_info.sentinel != null and - dest_info.sentinel.?.eql(src_info.sentinel.?, dest_info.pointee_type, sema.mod)); + (src_info.sentinel != null and dest_info.sentinel.?.eql( + try mod.getCoerced(src_info.sentinel.?, dest_info.pointee_type), + dest_info.pointee_type, + sema.mod, + )); if (!ok_sent) { return InMemoryCoercionResult{ .ptr_sentinel = .{ .actual = src_info.sentinel orelse Value.@"unreachable", |
