| ... | ... | @@ -13859,6 +13859,15 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 13859 | 13859 | } |
| 13860 | 13860 | } else if (child_type->id == TypeTableEntryIdFn) { |
| 13861 | 13861 | if (buf_eql_str(field_name, "ReturnType")) { |
| 13862 | if (child_type->data.fn.fn_type_id.return_type == nullptr) { |
| 13863 | // Return type can only ever be null, if the function is generic |
| 13864 | assert(child_type->data.fn.is_generic); |
| 13865 | |
| 13866 | ir_add_error(ira, &field_ptr_instruction->base, |
| 13867 | buf_sprintf("ReturnType has not been resolved because '%s' is generic", buf_ptr(&child_type->name))); |
| 13868 | return ira->codegen->builtin_types.entry_invalid; |
| 13869 | } |
| 13870 | |
| 13862 | 13871 | bool ptr_is_const = true; |
| 13863 | 13872 | bool ptr_is_volatile = false; |
| 13864 | 13873 | return ir_analyze_const_ptr(ira, &field_ptr_instruction->base, |
| ... | ... | @@ -17860,6 +17869,16 @@ static TypeTableEntry *ir_analyze_instruction_arg_type(IrAnalyze *ira, IrInstruc |
| 17860 | 17869 | |
| 17861 | 17870 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 17862 | 17871 | out_val->data.x_type = fn_type_id->param_info[arg_index].type; |
| 17872 | if (out_val->data.x_type == nullptr) { |
| 17873 | // Args are only unresolved if our function is generic. |
| 17874 | assert(fn_type->data.fn.is_generic); |
| 17875 | |
| 17876 | ir_add_error(ira, arg_index_inst, |
| 17877 | buf_sprintf("@ArgType could not resolve the type of arg %" ZIG_PRI_usize " because '%s' is generic", |
| 17878 | arg_index, buf_ptr(&fn_type->name))); |
| 17879 | return ira->codegen->builtin_types.entry_invalid; |
| 17880 | } |
| 17881 | |
| 17863 | 17882 | return ira->codegen->builtin_types.entry_type; |
| 17864 | 17883 | } |
| 17865 | 17884 | |