| ... | ... | @@ -3912,18 +3912,20 @@ fn analyzeCall( |
| 3912 | 3912 | const ret_ty_inst = try sema.resolveBody(&child_block, fn_info.ret_ty_body); |
| 3913 | 3913 | const ret_ty_src = func_src; // TODO better source location |
| 3914 | 3914 | const bare_return_type = try sema.analyzeAsType(&child_block, ret_ty_src, ret_ty_inst); |
| 3915 | | // If the function has an inferred error set, `bare_return_type` is the payload type only. |
| 3915 | // Create a fresh inferred error set type for inline/comptime calls. |
| 3916 | 3916 | const fn_ret_ty = blk: { |
| 3917 | | if (func_ty_info.return_type.tag() == .error_union) { |
| 3918 | | const node = try sema.gpa.create(Module.Fn.InferredErrorSetListNode); |
| 3919 | | node.data = .{ .func = module_fn }; |
| 3920 | | parent_func.?.inferred_error_sets.prepend(node); |
| 3921 | | |
| 3922 | | const error_set_ty = try Type.Tag.error_set_inferred.create(sema.arena, &node.data); |
| 3923 | | break :blk try Type.Tag.error_union.create(sema.arena, .{ |
| 3924 | | .error_set = error_set_ty, |
| 3925 | | .payload = bare_return_type, |
| 3926 | | }); |
| 3917 | if (func_ty_info.return_type.castTag(.error_union)) |payload| { |
| 3918 | if (payload.data.error_set.tag() == .error_set_inferred) { |
| 3919 | const node = try sema.gpa.create(Module.Fn.InferredErrorSetListNode); |
| 3920 | node.data = .{ .func = module_fn }; |
| 3921 | parent_func.?.inferred_error_sets.prepend(node); |
| 3922 | |
| 3923 | const error_set_ty = try Type.Tag.error_set_inferred.create(sema.arena, &node.data); |
| 3924 | break :blk try Type.Tag.error_union.create(sema.arena, .{ |
| 3925 | .error_set = error_set_ty, |
| 3926 | .payload = bare_return_type, |
| 3927 | }); |
| 3928 | } |
| 3927 | 3929 | } |
| 3928 | 3930 | break :blk bare_return_type; |
| 3929 | 3931 | }; |
| ... | ... | @@ -12473,7 +12475,7 @@ fn coerceInMemoryAllowed( |
| 12473 | 12475 | dest_ty: Type, |
| 12474 | 12476 | src_ty: Type, |
| 12475 | 12477 | dest_is_mut: bool, |
| 12476 | | target: std.Target |
| 12478 | target: std.Target, |
| 12477 | 12479 | ) CompileError!InMemoryCoercionResult { |
| 12478 | 12480 | if (dest_ty.eql(src_ty)) |
| 12479 | 12481 | return .ok; |