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
2023-08-27 17:14:31 -04:00
committed by Andrew Kelley
parent 49075d2055
commit e2ff486de5
5 changed files with 102 additions and 99 deletions

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() },