| ... | @@ -4371,13 +4371,19 @@ fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -4371,13 +4371,19 @@ fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 4371 | const mod = sema.mod; | 4371 | const mod = sema.mod; |
| 4372 | const un_tok = sema.code.instructions.items(.data)[inst].un_tok; | 4372 | const un_tok = sema.code.instructions.items(.data)[inst].un_tok; |
| 4373 | const src = un_tok.src(); | 4373 | const src = un_tok.src(); |
| 4374 | const ty_operand = sema.resolveType(block, src, un_tok.operand) catch |err| switch (err) { | 4374 | // In case of GenericPoison, we don't actually have a type, so this will be |
| 4375 | error.GenericPoison => { | 4375 | // treated as an untyped address-of operator. |
| 4376 | // We don't actually have a type, so this will be treated as an untyped address-of operator. | 4376 | if (un_tok.operand == .var_args_param_type) return; |
| 4377 | return; | 4377 | const operand_air_inst = sema.resolveInst(un_tok.operand) catch |err| switch (err) { |
| 4378 | }, | 4378 | error.GenericPoison => return, |
| | 4379 | else => |e| return e, |
| | 4380 | }; |
| | 4381 | if (operand_air_inst == .var_args_param_type) return; |
| | 4382 | const ty_operand = sema.analyzeAsType(block, src, operand_air_inst) catch |err| switch (err) { |
| | 4383 | error.GenericPoison => return, |
| 4379 | else => |e| return e, | 4384 | else => |e| return e, |
| 4380 | }; | 4385 | }; |
| | 4386 | if (ty_operand.isGenericPoison()) return; |
| 4381 | if (ty_operand.optEuBaseType(mod).zigTypeTag(mod) != .Pointer) { | 4387 | if (ty_operand.optEuBaseType(mod).zigTypeTag(mod) != .Pointer) { |
| 4382 | return sema.failWithOwnedErrorMsg(block, msg: { | 4388 | return sema.failWithOwnedErrorMsg(block, msg: { |
| 4383 | const msg = try sema.errMsg(block, src, "expected type '{}', found pointer", .{ty_operand.fmt(mod)}); | 4389 | const msg = try sema.errMsg(block, src, "expected type '{}', found pointer", .{ty_operand.fmt(mod)}); |
| ... | @@ -9846,11 +9852,19 @@ fn analyzeAs( | ... | @@ -9846,11 +9852,19 @@ fn analyzeAs( |
| 9846 | const mod = sema.mod; | 9852 | const mod = sema.mod; |
| 9847 | const operand = try sema.resolveInst(zir_operand); | 9853 | const operand = try sema.resolveInst(zir_operand); |
| 9848 | if (zir_dest_type == .var_args_param_type) return operand; | 9854 | if (zir_dest_type == .var_args_param_type) return operand; |
| 9849 | const dest_ty = sema.resolveType(block, src, zir_dest_type) catch |err| switch (err) { | 9855 | const operand_air_inst = sema.resolveInst(zir_dest_type) catch |err| switch (err) { |
| | 9856 | error.GenericPoison => return operand, |
| | 9857 | else => |e| return e, |
| | 9858 | }; |
| | 9859 | if (operand_air_inst == .var_args_param_type) return operand; |
| | 9860 | const dest_ty = sema.analyzeAsType(block, src, operand_air_inst) catch |err| switch (err) { |
| 9850 | error.GenericPoison => return operand, | 9861 | error.GenericPoison => return operand, |
| 9851 | else => |e| return e, | 9862 | else => |e| return e, |
| 9852 | }; | 9863 | }; |
| 9853 | if (dest_ty.zigTypeTag(mod) == .NoReturn) { | 9864 | const dest_ty_tag = dest_ty.zigTypeTagOrPoison(mod) catch |err| switch (err) { |
| | 9865 | error.GenericPoison => return operand, |
| | 9866 | }; |
| | 9867 | if (dest_ty_tag == .NoReturn) { |
| 9854 | return sema.fail(block, src, "cannot cast to noreturn", .{}); | 9868 | return sema.fail(block, src, "cannot cast to noreturn", .{}); |
| 9855 | } | 9869 | } |
| 9856 | const is_ret = if (Zir.refToIndex(zir_dest_type)) |ptr_index| | 9870 | const is_ret = if (Zir.refToIndex(zir_dest_type)) |ptr_index| |