| ... | ... | @@ -9015,7 +9015,18 @@ fn zirParam( |
| 9015 | 9015 | if (is_comptime and sema.preallocated_new_func != null) { |
| 9016 | 9016 | // We have a comptime value for this parameter so it should be elided from the |
| 9017 | 9017 | // function type of the function instruction in this block. |
| 9018 | | const coerced_arg = try sema.coerce(block, param_ty, arg, src); |
| 9018 | const coerced_arg = sema.coerce(block, param_ty, arg, .unneeded) catch |err| switch (err) { |
| 9019 | error.NeededSourceLocation => { |
| 9020 | // We are instantiating a generic function and a comptime arg |
| 9021 | // cannot be coerced to the param type, but since we don't |
| 9022 | // have the callee source location return `GenericPoison` |
| 9023 | // so that the instantiation is failed and the coercion |
| 9024 | // is handled by comptime call logic instead. |
| 9025 | assert(sema.is_generic_instantiation); |
| 9026 | return error.GenericPoison; |
| 9027 | }, |
| 9028 | else => return err, |
| 9029 | }; |
| 9019 | 9030 | sema.inst_map.putAssumeCapacity(inst, coerced_arg); |
| 9020 | 9031 | return; |
| 9021 | 9032 | } |