| ... | @@ -30346,11 +30346,6 @@ fn coerceExtra( | ... | @@ -30346,11 +30346,6 @@ fn coerceExtra( |
| 30346 | else => {}, | 30346 | else => {}, |
| 30347 | } | 30347 | } |
| 30348 | | 30348 | |
| 30349 | // undefined to anything. We do this after the big switch above so that | | |
| 30350 | // special logic has a chance to run first, such as `*[N]T` to `[]T` which | | |
| 30351 | // should initialize the length field of the slice. | | |
| 30352 | if (maybe_inst_val) |val| if (val.toIntern() == .undef) return pt.undefRef(dest_ty); | | |
| 30353 | | | |
| 30354 | if (!opts.report_err) return error.NotCoercible; | 30349 | if (!opts.report_err) return error.NotCoercible; |
| 30355 | | 30350 | |
| 30356 | if (opts.is_ret and dest_ty.zigTypeTag(zcu) == .noreturn) { | 30351 | if (opts.is_ret and dest_ty.zigTypeTag(zcu) == .noreturn) { |
| ... | @@ -30368,6 +30363,11 @@ fn coerceExtra( | ... | @@ -30368,6 +30363,11 @@ fn coerceExtra( |
| 30368 | return sema.failWithOwnedErrorMsg(block, msg); | 30363 | return sema.failWithOwnedErrorMsg(block, msg); |
| 30369 | } | 30364 | } |
| 30370 | | 30365 | |
| | 30366 | // undefined to anything. We do this after the big switch above so that |
| | 30367 | // special logic has a chance to run first, such as `*[N]T` to `[]T` which |
| | 30368 | // should initialize the length field of the slice. |
| | 30369 | if (maybe_inst_val) |val| if (val.toIntern() == .undef) return pt.undefRef(dest_ty); |
| | 30370 | |
| 30371 | const msg = msg: { | 30371 | const msg = msg: { |
| 30372 | const msg = try sema.errMsg(inst_src, "expected type '{}', found '{}'", .{ dest_ty.fmt(pt), inst_ty.fmt(pt) }); | 30372 | const msg = try sema.errMsg(inst_src, "expected type '{}', found '{}'", .{ dest_ty.fmt(pt), inst_ty.fmt(pt) }); |
| 30373 | errdefer msg.destroy(sema.gpa); | 30373 | errdefer msg.destroy(sema.gpa); |