summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/seminst.nim3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/seminst.nim b/compiler/seminst.nim
index 370990326..42a39d0df 100644
--- a/compiler/seminst.nim
+++ b/compiler/seminst.nim
@@ -221,6 +221,8 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
   # NOTE: for access of private fields within generics from a different module
   # we set the friend module:
   c.friendModules.add(getModule(fn))
+  let oldInTypeClass = c.inTypeClass
+  c.inTypeClass = 0
   let oldScope = c.currentScope
   while not isTopLevel(c): c.currentScope = c.currentScope.parent
   result = copySym(fn, false)
@@ -269,4 +271,5 @@ proc generateInstance(c: PContext, fn: PSym, pt: TIdTable,
   c.currentScope = oldScope
   discard c.friendModules.pop()
   dec(c.instCounter)
+  c.inTypeClass = oldInTypeClass
   if result.kind == skMethod: finishMethod(c, result)