| ... | ... | @@ -157,9 +157,9 @@ pub const InferredErrorSet = struct { |
| 157 | 157 | arena: Allocator, |
| 158 | 158 | ) !void { |
| 159 | 159 | switch (err_set_ty.toIntern()) { |
| 160 | | .anyerror_type => { |
| 161 | | self.resolved = .anyerror_type; |
| 162 | | }, |
| 160 | .anyerror_type => self.resolved = .anyerror_type, |
| 161 | .adhoc_inferred_error_set_type => {}, // Adding an inferred error set to itself. |
| 162 | |
| 163 | 163 | else => switch (ip.indexToKey(err_set_ty.toIntern())) { |
| 164 | 164 | .error_set_type => |error_set_type| { |
| 165 | 165 | for (error_set_type.names.get(ip)) |name| { |
| ... | ... | @@ -7055,12 +7055,11 @@ fn analyzeCall( |
| 7055 | 7055 | |
| 7056 | 7056 | if (module_fn.analysis(ip).inferred_error_set) { |
| 7057 | 7057 | // Create a fresh inferred error set type for inline/comptime calls. |
| 7058 | | const error_set_ty = try mod.intern(.{ .inferred_error_set_type = module_fn_index }); |
| 7059 | 7058 | const ies = try sema.arena.create(InferredErrorSet); |
| 7060 | | ies.* = .{ .func = module_fn_index }; |
| 7059 | ies.* = .{ .func = .none }; |
| 7061 | 7060 | sema.fn_ret_ty_ies = ies; |
| 7062 | 7061 | sema.fn_ret_ty = (try ip.get(gpa, .{ .error_union_type = .{ |
| 7063 | | .error_set_type = error_set_ty, |
| 7062 | .error_set_type = .adhoc_inferred_error_set_type, |
| 7064 | 7063 | .payload_type = bare_return_type.toIntern(), |
| 7065 | 7064 | } })).toType(); |
| 7066 | 7065 | } |
| ... | ... | @@ -7081,6 +7080,7 @@ fn analyzeCall( |
| 7081 | 7080 | } |
| 7082 | 7081 | } |
| 7083 | 7082 | |
| 7083 | new_fn_info.return_type = sema.fn_ret_ty.toIntern(); |
| 7084 | 7084 | const new_func_resolved_ty = try mod.funcType(new_fn_info); |
| 7085 | 7085 | if (!is_comptime_call and !block.is_typeof) { |
| 7086 | 7086 | try sema.emitDbgInline(block, parent_func_index, module_fn_index, new_func_resolved_ty, .dbg_inline_begin); |
| ... | ... | @@ -8841,7 +8841,8 @@ fn funcCommon( |
| 8841 | 8841 | if (inferred_error_set) { |
| 8842 | 8842 | assert(!is_extern); |
| 8843 | 8843 | assert(has_body); |
| 8844 | | try sema.validateErrorUnionPayloadType(block, bare_return_type, ret_ty_src); |
| 8844 | if (!ret_poison) |
| 8845 | try sema.validateErrorUnionPayloadType(block, bare_return_type, ret_ty_src); |
| 8845 | 8846 | const func_index = try ip.getFuncDeclIes(gpa, .{ |
| 8846 | 8847 | .owner_decl = sema.owner_decl_index, |
| 8847 | 8848 | |
| ... | ... | @@ -34051,11 +34052,8 @@ fn resolveInferredErrorSet( |
| 34051 | 34052 | // In order to ensure that all dependencies are properly added to the set, |
| 34052 | 34053 | // we need to ensure the function body is analyzed of the inferred error |
| 34053 | 34054 | // set. However, in the case of comptime/inline function calls with |
| 34054 | | // inferred error sets, each call gets a new InferredErrorSet object, which |
| 34055 | | // contains the `InternPool.Index` of the callee. Not only is the function |
| 34056 | | // not relevant to the inferred error set in this case, it may be a generic |
| 34057 | | // function which would cause an assertion failure if we called |
| 34058 | | // `ensureFuncBodyAnalyzed` on it here. |
| 34055 | // inferred error sets, each call gets an adhoc InferredErrorSet object, which |
| 34056 | // has no corresponding function body. |
| 34059 | 34057 | const ies_func_owner_decl = mod.declPtr(func.owner_decl); |
| 34060 | 34058 | const ies_func_info = mod.typeToFunc(ies_func_owner_decl.ty).?; |
| 34061 | 34059 | // if ies declared by a inline function with generic return type, the return_type should be generic_poison, |