authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-14 15:29:07-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-07-14 15:29:07-07:00
loga7c3cec65f1639195e787b98900c3f126953f880
treeaa1088b140e821e80dd81e16ee8cfc8fd8bbd5c2
parent4696cd3e09c4e33519dbb53a41c32bbdfd97f6f6

follow up from previous commit for generic methods


2 files changed, 6 insertions(+), 1 deletions(-)

src/ir.cpp+1-1
......@@ -20317,7 +20317,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr,
2031720317 }
2031820318
2031920319 IrInstGen *first_arg;
20320 if (!first_arg_known_bare && handle_is_ptr(ira->codegen, first_arg_ptr->value->type->data.pointer.child_type)) {
20320 if (!first_arg_known_bare) {
2032120321 first_arg = first_arg_ptr;
2032220322 } else {
2032320323 first_arg = ir_get_deref(ira, &first_arg_ptr->base, first_arg_ptr, nullptr);
test/stage1/behavior/enum.zig+5
......@@ -1150,10 +1150,15 @@ test "method call on an enum" {
11501150 fn method(self: *E) bool {
11511151 return self.* == .two;
11521152 }
1153
1154 fn generic_method(self: *E, foo: anytype) bool {
1155 return self.* == .two and foo == bool;
1156 }
11531157 };
11541158 fn doTheTest() void {
11551159 var e = E.two;
11561160 expect(e.method());
1161 expect(e.generic_method(bool));
11571162 }
11581163 };
11591164 S.doTheTest();