Commit a7c3cec65f

Andrew Kelley <andrew@ziglang.org>
2020-07-15 00:29:07
follow up from previous commit for generic methods
1 parent 4696cd3
Changed files (2)
src
test
stage1
behavior
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);
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();