Sema: cleanup coerceExtra

* remove unreachable code
 * remove already handled cases
 * avoid `InternPool.getCoerced`
 * add some undef checks
 * error when converting undef int to float

Closes #16987
This commit is contained in:
Jacob Young authored and Andrew Kelley committed 2023-08-30 16:50:30 -04:00
1 parent 49075d2055
commit e2ff486de5
5 files changed
+102 -99

No files matched your search

+1 -1
View File
@@ -6360,7 +6360,7 @@ pub fn errorSetFromUnsortedNames(
/// Supports only pointers, not pointer-like optionals.
pub fn ptrIntValue(mod: *Module, ty: Type, x: u64) Allocator.Error!Value {
assert(ty.zigTypeTag(mod) == .Pointer);
assert(ty.zigTypeTag(mod) == .Pointer and !ty.isSlice(mod));
const i = try intern(mod, .{ .ptr = .{
.ty = ty.toIntern(),
.addr = .{ .int = (try mod.intValue_u64(Type.usize, x)).toIntern() },