From a7c3cec65f1639195e787b98900c3f126953f880 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 14 Jul 2020 15:29:07 -0700 Subject: [PATCH] follow up from previous commit for generic methods --- src/ir.cpp | 2 +- test/stage1/behavior/enum.zig | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ir.cpp b/src/ir.cpp index 0dd8f4e86a..e162125fb4 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -20317,7 +20317,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, } IrInstGen *first_arg; - if (!first_arg_known_bare && handle_is_ptr(ira->codegen, first_arg_ptr->value->type->data.pointer.child_type)) { + if (!first_arg_known_bare) { first_arg = first_arg_ptr; } else { first_arg = ir_get_deref(ira, &first_arg_ptr->base, first_arg_ptr, nullptr); diff --git a/test/stage1/behavior/enum.zig b/test/stage1/behavior/enum.zig index b9bb1db533..f569264520 100644 --- a/test/stage1/behavior/enum.zig +++ b/test/stage1/behavior/enum.zig @@ -1150,10 +1150,15 @@ test "method call on an enum" { fn method(self: *E) bool { return self.* == .two; } + + fn generic_method(self: *E, foo: anytype) bool { + return self.* == .two and foo == bool; + } }; fn doTheTest() void { var e = E.two; expect(e.method()); + expect(e.generic_method(bool)); } }; S.doTheTest();