summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-04-10 11:58:17 +0200
committerAraq <rumpf_a@web.de>2015-04-10 14:03:47 +0200
commit3a9500f7b102c4cfd10dd551e0c4b40449492351 (patch)
tree534432dca5a44bd4159f8e231f66ed68f2894cd9 /compiler
parent6e6c6446a4d3d30a7e97ef4417bdca892e376b53 (diff)
downloadNim-3a9500f7b102c4cfd10dd551e0c4b40449492351.tar.gz
fixes #2500
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sigmatch.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 805266389..7e0820593 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -99,10 +99,12 @@ proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PSym,
   c.calleeSym = callee
   if callee.kind in skProcKinds and calleeScope == -1:
     if callee.originatingModule == ctx.module:
-      let rootSym = if sfFromGeneric notin callee.flags: callee
-                    else: callee.owner
-      c.calleeScope = 2 #  rootSym.scope.depthLevel
-      #echo "SCOPE IS ", rootSym.scope.depthLevel
+      c.calleeScope = 2
+      var owner = callee
+      while true:
+        owner = owner.skipGenericOwner
+        if owner.kind == skModule: break
+        inc c.calleeScope
     else:
       c.calleeScope = 1
   else: