| ... | @@ -7031,16 +7031,21 @@ fn instantiateGenericCall( | ... | @@ -7031,16 +7031,21 @@ fn instantiateGenericCall( |
| 7031 | } | 7031 | } |
| 7032 | const arg = uncasted_args[arg_i]; | 7032 | const arg = uncasted_args[arg_i]; |
| 7033 | if (is_comptime) { | 7033 | if (is_comptime) { |
| 7034 | if (try sema.resolveMaybeUndefVal(arg)) |arg_val| { | 7034 | const arg_val = (try sema.resolveMaybeUndefVal(arg)).?; |
| 7035 | const child_arg = try child_sema.addConstant(sema.typeOf(arg), arg_val); | 7035 | const child_arg = try child_sema.addConstant(sema.typeOf(arg), arg_val); |
| 7036 | child_sema.inst_map.putAssumeCapacityNoClobber(inst, child_arg); | 7036 | child_sema.inst_map.putAssumeCapacityNoClobber(inst, child_arg); |
| 7037 | } else { | | |
| 7038 | return sema.failWithNeededComptime(block, .unneeded, ""); | | |
| 7039 | } | | |
| 7040 | } else if (is_anytype) { | 7037 | } else if (is_anytype) { |
| 7041 | const arg_ty = sema.typeOf(arg); | 7038 | const arg_ty = sema.typeOf(arg); |
| 7042 | if (try sema.typeRequiresComptime(arg_ty)) { | 7039 | if (try sema.typeRequiresComptime(arg_ty)) { |
| 7043 | const arg_val = try sema.resolveConstValue(block, .unneeded, arg, ""); | 7040 | const arg_val = sema.resolveConstValue(block, .unneeded, arg, "") catch |err| switch (err) { |
| | 7041 | error.NeededSourceLocation => { |
| | 7042 | const decl = sema.mod.declPtr(block.src_decl); |
| | 7043 | const arg_src = Module.argSrc(call_src.node_offset.x, sema.gpa, decl, arg_i, bound_arg_src); |
| | 7044 | _ = try sema.resolveConstValue(block, arg_src, arg, "argument to parameter with comptime-only type must be comptime-known"); |
| | 7045 | return error.AnalysisFail; |
| | 7046 | }, |
| | 7047 | else => |e| return e, |
| | 7048 | }; |
| 7044 | const child_arg = try child_sema.addConstant(arg_ty, arg_val); | 7049 | const child_arg = try child_sema.addConstant(arg_ty, arg_val); |
| 7045 | child_sema.inst_map.putAssumeCapacityNoClobber(inst, child_arg); | 7050 | child_sema.inst_map.putAssumeCapacityNoClobber(inst, child_arg); |
| 7046 | } else { | 7051 | } else { |