| ... | ... | @@ -2536,6 +2536,9 @@ fn coerceResultPtr( |
| 2536 | 2536 | .wrap_errunion_payload => { |
| 2537 | 2537 | new_ptr = try sema.analyzeErrUnionPayloadPtr(block, src, new_ptr, false, true); |
| 2538 | 2538 | }, |
| 2539 | .array_to_slice => { |
| 2540 | return sema.fail(block, src, "TODO coerce_result_ptr array_to_slice", .{}); |
| 2541 | }, |
| 2539 | 2542 | else => { |
| 2540 | 2543 | if (std.debug.runtime_safety) { |
| 2541 | 2544 | std.debug.panic("unexpected AIR tag for coerce_result_ptr: {}", .{ |
| ... | ... | @@ -7839,7 +7842,23 @@ fn zirIntToEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 7839 | 7842 | |
| 7840 | 7843 | if (try sema.resolveMaybeUndefVal(operand)) |int_val| { |
| 7841 | 7844 | if (dest_ty.isNonexhaustiveEnum()) { |
| 7842 | | return sema.addConstant(dest_ty, int_val); |
| 7845 | var buffer: Type.Payload.Bits = undefined; |
| 7846 | const int_tag_ty = dest_ty.intTagType(&buffer); |
| 7847 | if (try sema.intFitsInType(int_val, int_tag_ty, null)) { |
| 7848 | return sema.addConstant(dest_ty, int_val); |
| 7849 | } |
| 7850 | const msg = msg: { |
| 7851 | const msg = try sema.errMsg( |
| 7852 | block, |
| 7853 | src, |
| 7854 | "int value '{}' out of range of non-exhaustive enum '{}'", |
| 7855 | .{ int_val.fmtValue(sema.typeOf(operand), sema.mod), dest_ty.fmt(sema.mod) }, |
| 7856 | ); |
| 7857 | errdefer msg.destroy(sema.gpa); |
| 7858 | try sema.addDeclaredHereNote(msg, dest_ty); |
| 7859 | break :msg msg; |
| 7860 | }; |
| 7861 | return sema.failWithOwnedErrorMsg(msg); |
| 7843 | 7862 | } |
| 7844 | 7863 | if (int_val.isUndef()) { |
| 7845 | 7864 | return sema.failWithUseOfUndef(block, operand_src); |
| ... | ... | @@ -32886,7 +32905,7 @@ fn enumHasInt( |
| 32886 | 32905 | int: Value, |
| 32887 | 32906 | ) CompileError!bool { |
| 32888 | 32907 | switch (ty.tag()) { |
| 32889 | | .enum_nonexhaustive => return sema.intFitsInType(int, ty, null), |
| 32908 | .enum_nonexhaustive => unreachable, |
| 32890 | 32909 | .enum_full => { |
| 32891 | 32910 | const enum_full = ty.castTag(.enum_full).?.data; |
| 32892 | 32911 | const tag_ty = enum_full.tag_ty; |