aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-06-14 18:10:47 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-15 02:43:06 -0700
commit11d0dfb8829f7a247b21b417157bafeebd6a2a90 (patch)
treef78e3fe50d8d691196cfdddc11a7f8988c5cc3c0 /src/Module.zig
parentce88c43a4ee94d82a64e7580885dc6693cc6120c (diff)
downloadzig-11d0dfb8829f7a247b21b417157bafeebd6a2a90.tar.gz
zig-11d0dfb8829f7a247b21b417157bafeebd6a2a90.zip
Sema: fix @intToPtr of zero value to optional pointer
Calling into coercion logic here is a little opaque, and more to the point wholly unnecessary. Instead, the (very short) logic is now implemented directly in Sema. Resolves: #16033
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/Module.zig b/src/Module.zig
index e8cea97b8f..8c5a86652d 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -6817,17 +6817,12 @@ pub fn errorSetFromUnsortedNames(
return new_ty.toType();
}
-/// Supports optionals in addition to pointers.
+/// Supports only pointers, not pointer-like optionals.
pub fn ptrIntValue(mod: *Module, ty: Type, x: u64) Allocator.Error!Value {
- return mod.getCoerced(try mod.intValue_u64(Type.usize, x), ty);
-}
-
-/// Supports only pointers. See `ptrIntValue` for pointer-like optional support.
-pub fn ptrIntValue_ptronly(mod: *Module, ty: Type, x: u64) Allocator.Error!Value {
assert(ty.zigTypeTag(mod) == .Pointer);
const i = try intern(mod, .{ .ptr = .{
.ty = ty.toIntern(),
- .addr = .{ .int = try mod.intValue_u64(Type.usize, x) },
+ .addr = .{ .int = (try mod.intValue_u64(Type.usize, x)).toIntern() },
} });
return i.toValue();
}