diff --git a/spec/compiler/type_inference/macro_spec.cr b/spec/compiler/type_inference/macro_spec.cr
index fd19fdf7280bf5c11072de8f371df7375e2096ad..7f1ccfe1662623ef54dde089b34a5d5e8fabc12b 100755
--- a/spec/compiler/type_inference/macro_spec.cr
+++ b/spec/compiler/type_inference/macro_spec.cr
@@ -259,4 +259,22 @@ describe "Type inference: macro" do
       ),
       "can't define def inside def"
   end
+
+  it "uses typeof(self.method) in macro def" do
+    assert_type(%(
+      class Foo
+        macro def foo : typeof(self.bar)
+          bar
+        end
+      end
+
+      class Bar < Foo
+        def bar
+          1.5
+        end
+      end
+
+      Bar.new.foo
+      )) { float64 }
+  end
 end
diff --git a/src/compiler/crystal/semantic/type_lookup.cr b/src/compiler/crystal/semantic/type_lookup.cr
index b6b579ad96a488df42edd4cbdab9310107f3c72d..ae2f294fba865235199bff88d48775b1902ad876 100644
--- a/src/compiler/crystal/semantic/type_lookup.cr
+++ b/src/compiler/crystal/semantic/type_lookup.cr
@@ -15,6 +15,8 @@ module Crystal
     def initialize(@root, @self_type)
     end
 
+    delegate program, @root
+
     def visit(node : ASTNode)
       true
     end
@@ -33,7 +35,7 @@ module Crystal
         ident.accept self
         type
       end
-      @type = @root.program.type_merge(types)
+      @type = program.type_merge(types)
       false
     end
 
@@ -87,10 +89,10 @@ module Crystal
         output.accept self
         types << type
       else
-        types << @root.program.void
+        types << program.void
       end
 
-      @type = @root.program.fun_of(types)
+      @type = program.fun_of(types)
       false
     end
 
@@ -100,14 +102,10 @@ module Crystal
     end
 
     def visit(node : TypeOf)
-      meta_vars = MetaVars.new
-      meta_vars["self"] = MetaVar.new("self", @root.instance_type)
-
-      visitor = TypeVisitor.new(@root.program, meta_vars)
-      node.expressions.each do |exp|
-        exp.accept visitor
-      end
-      @type = @root.program.type_merge(node.expressions.map &.type)
+      meta_vars = MetaVars { "self": MetaVar.new("self", @self_type) }
+      visitor = TypeVisitor.new(program, meta_vars)
+      node.expressions.each &.accept visitor
+      @type = program.type_merge node.expressions
       false
     end