| ... | ... | @@ -67,6 +67,8 @@ enum ConstCastResultId { |
| 67 | 67 | struct ConstCastOnly; |
| 68 | 68 | struct ConstCastArg { |
| 69 | 69 | size_t arg_index; |
| 70 | ZigType *actual_param_type; |
| 71 | ZigType *expected_param_type; |
| 70 | 72 | ConstCastOnly *child; |
| 71 | 73 | }; |
| 72 | 74 | |
| ... | ... | @@ -8638,6 +8640,8 @@ static ConstCastOnly types_match_const_cast_only(IrAnalyze *ira, ZigType *wanted |
| 8638 | 8640 | if (arg_child.id != ConstCastResultIdOk) { |
| 8639 | 8641 | result.id = ConstCastResultIdFnArg; |
| 8640 | 8642 | result.data.fn_arg.arg_index = i; |
| 8643 | result.data.fn_arg.actual_param_type = actual_param_info->type; |
| 8644 | result.data.fn_arg.expected_param_type = expected_param_info->type; |
| 8641 | 8645 | result.data.fn_arg.child = allocate_nonzero<ConstCastOnly>(1); |
| 8642 | 8646 | *result.data.fn_arg.child = arg_child; |
| 8643 | 8647 | return result; |
| ... | ... | @@ -10483,6 +10487,15 @@ static void report_recursive_error(IrAnalyze *ira, AstNode *source_node, ConstCa |
| 10483 | 10487 | } |
| 10484 | 10488 | break; |
| 10485 | 10489 | } |
| 10490 | case ConstCastResultIdFnArg: { |
| 10491 | ErrorMsg *msg = add_error_note(ira->codegen, parent_msg, source_node, |
| 10492 | buf_sprintf("parameter %" ZIG_PRI_usize ": '%s' cannot cast into '%s'", |
| 10493 | cast_result->data.fn_arg.arg_index, |
| 10494 | buf_ptr(&cast_result->data.fn_arg.actual_param_type->name), |
| 10495 | buf_ptr(&cast_result->data.fn_arg.expected_param_type->name))); |
| 10496 | report_recursive_error(ira, source_node, cast_result->data.fn_arg.child, msg); |
| 10497 | break; |
| 10498 | } |
| 10486 | 10499 | case ConstCastResultIdFnAlign: // TODO |
| 10487 | 10500 | case ConstCastResultIdFnCC: // TODO |
| 10488 | 10501 | case ConstCastResultIdFnVarArgs: // TODO |
| ... | ... | @@ -10490,7 +10503,6 @@ static void report_recursive_error(IrAnalyze *ira, AstNode *source_node, ConstCa |
| 10490 | 10503 | case ConstCastResultIdFnReturnType: // TODO |
| 10491 | 10504 | case ConstCastResultIdFnArgCount: // TODO |
| 10492 | 10505 | case ConstCastResultIdFnGenericArgCount: // TODO |
| 10493 | | case ConstCastResultIdFnArg: // TODO |
| 10494 | 10506 | case ConstCastResultIdFnArgNoAlias: // TODO |
| 10495 | 10507 | case ConstCastResultIdUnresolvedInferredErrSet: // TODO |
| 10496 | 10508 | case ConstCastResultIdAsyncAllocatorType: // TODO |