| ... | ... | @@ -8195,8 +8195,22 @@ fn zirParam( |
| 8195 | 8195 | .is_comptime = comptime_syntax, |
| 8196 | 8196 | .name = param_name, |
| 8197 | 8197 | }); |
| 8198 | | const result = try sema.addConstant(param_ty, Value.initTag(.generic_poison)); |
| 8199 | | try sema.inst_map.putNoClobber(sema.gpa, inst, result); |
| 8198 | |
| 8199 | if (is_comptime) { |
| 8200 | // If this is a comptime parameter we can add a constant generic_poison |
| 8201 | // since this is also a generic parameter. |
| 8202 | const result = try sema.addConstant(param_ty, Value.initTag(.generic_poison)); |
| 8203 | try sema.inst_map.putNoClobber(sema.gpa, inst, result); |
| 8204 | } else { |
| 8205 | // Otherwise we need a dummy runtime instruction. |
| 8206 | const result_index = @intCast(Air.Inst.Index, sema.air_instructions.len); |
| 8207 | try sema.air_instructions.append(sema.gpa, .{ |
| 8208 | .tag = .alloc, |
| 8209 | .data = .{ .ty = param_ty }, |
| 8210 | }); |
| 8211 | const result = Air.indexToRef(result_index); |
| 8212 | try sema.inst_map.putNoClobber(sema.gpa, inst, result); |
| 8213 | } |
| 8200 | 8214 | } |
| 8201 | 8215 | |
| 8202 | 8216 | fn zirParamAnytype( |