| ... | @@ -7552,6 +7552,18 @@ fn instantiateGenericCall( | ... | @@ -7552,6 +7552,18 @@ fn instantiateGenericCall( |
| 7552 | // Make a runtime call to the new function, making sure to omit the comptime args. | 7552 | // Make a runtime call to the new function, making sure to omit the comptime args. |
| 7553 | const func_ty = callee.ty.toType(); | 7553 | const func_ty = callee.ty.toType(); |
| 7554 | const func_ty_info = mod.typeToFunc(func_ty).?; | 7554 | const func_ty_info = mod.typeToFunc(func_ty).?; |
| | 7555 | |
| | 7556 | // If the call evaluated to a return type that requires comptime, never mind |
| | 7557 | // our generic instantiation. Instead we need to perform a comptime call. |
| | 7558 | if (try sema.typeRequiresComptime(func_ty_info.return_type.toType())) { |
| | 7559 | return error.ComptimeReturn; |
| | 7560 | } |
| | 7561 | // Similarly, if the call evaluated to a generic type we need to instead |
| | 7562 | // call it inline. |
| | 7563 | if (func_ty_info.is_generic or func_ty_info.cc == .Inline) { |
| | 7564 | return error.GenericPoison; |
| | 7565 | } |
| | 7566 | |
| 7555 | const runtime_args_len: u32 = func_ty_info.param_types.len; | 7567 | const runtime_args_len: u32 = func_ty_info.param_types.len; |
| 7556 | const runtime_args = try sema.arena.alloc(Air.Inst.Ref, runtime_args_len); | 7568 | const runtime_args = try sema.arena.alloc(Air.Inst.Ref, runtime_args_len); |
| 7557 | { | 7569 | { |