| ... | @@ -22833,6 +22833,7 @@ fn fieldCallBind( | ... | @@ -22833,6 +22833,7 @@ fn fieldCallBind( |
| 22833 | { | 22833 | { |
| 22834 | const first_param_type = decl_type.fnParamType(0); | 22834 | const first_param_type = decl_type.fnParamType(0); |
| 22835 | const first_param_tag = first_param_type.tag(); | 22835 | const first_param_tag = first_param_type.tag(); |
| | 22836 | var opt_buf: Type.Payload.ElemType = undefined; |
| 22836 | // zig fmt: off | 22837 | // zig fmt: off |
| 22837 | if (first_param_tag == .var_args_param or | 22838 | if (first_param_tag == .var_args_param or |
| 22838 | first_param_tag == .generic_poison or ( | 22839 | first_param_tag == .generic_poison or ( |
| ... | @@ -22851,7 +22852,27 @@ fn fieldCallBind( | ... | @@ -22851,7 +22852,27 @@ fn fieldCallBind( |
| 22851 | }); | 22852 | }); |
| 22852 | return sema.addConstant(ty, value); | 22853 | return sema.addConstant(ty, value); |
| 22853 | } else if (first_param_type.eql(concrete_ty, sema.mod)) { | 22854 | } else if (first_param_type.eql(concrete_ty, sema.mod)) { |
| 22854 | var deref = try sema.analyzeLoad(block, src, object_ptr, src); | 22855 | const deref = try sema.analyzeLoad(block, src, object_ptr, src); |
| | 22856 | const ty = Type.Tag.bound_fn.init(); |
| | 22857 | const value = try Value.Tag.bound_fn.create(arena, .{ |
| | 22858 | .func_inst = decl_val, |
| | 22859 | .arg0_inst = deref, |
| | 22860 | }); |
| | 22861 | return sema.addConstant(ty, value); |
| | 22862 | } else if (first_param_tag != .generic_poison and first_param_type.zigTypeTag() == .Optional and |
| | 22863 | first_param_type.optionalChild(&opt_buf).eql(concrete_ty, sema.mod)) |
| | 22864 | { |
| | 22865 | const deref = try sema.analyzeLoad(block, src, object_ptr, src); |
| | 22866 | const ty = Type.Tag.bound_fn.init(); |
| | 22867 | const value = try Value.Tag.bound_fn.create(arena, .{ |
| | 22868 | .func_inst = decl_val, |
| | 22869 | .arg0_inst = deref, |
| | 22870 | }); |
| | 22871 | return sema.addConstant(ty, value); |
| | 22872 | } else if (first_param_tag != .generic_poison and first_param_type.zigTypeTag() == .ErrorUnion and |
| | 22873 | first_param_type.errorUnionPayload().eql(concrete_ty, sema.mod)) |
| | 22874 | { |
| | 22875 | const deref = try sema.analyzeLoad(block, src, object_ptr, src); |
| 22855 | const ty = Type.Tag.bound_fn.init(); | 22876 | const ty = Type.Tag.bound_fn.init(); |
| 22856 | const value = try Value.Tag.bound_fn.create(arena, .{ | 22877 | const value = try Value.Tag.bound_fn.create(arena, .{ |
| 22857 | .func_inst = decl_val, | 22878 | .func_inst = decl_val, |