summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index e99ce8937..53d381f5d 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1898,8 +1898,8 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
   elif s.kind == skFunc:
     incl(s.flags, sfNoSideEffect)
     incl(s.typ.flags, tfNoSideEffect)
-  var proto: PSym = if isAnon: nil
-                    else: searchForProc(c, oldScope, s)
+  var (proto, comesFromShadowScope) = if isAnon: (nil, false)
+                                      else: searchForProc(c, oldScope, s)
   if proto == nil and sfForward in s.flags:
     #This is a definition that shares its sym with its forward declaration (generated by a macro),
     #if the symbol is also gensymmed we won't find it with searchForProc, so we check here
@@ -1941,8 +1941,9 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
     onDefResolveForward(n[namePos].info, proto)
     if sfForward notin proto.flags and proto.magic == mNone:
       wrongRedefinition(c, n.info, proto.name.s, proto.info)
-    excl(proto.flags, sfForward)
-    incl(proto.flags, sfWasForwarded)
+    if not comesFromShadowScope:
+      excl(proto.flags, sfForward)
+      incl(proto.flags, sfWasForwarded)
     closeScope(c)         # close scope with wrong parameter symbols
     openScope(c)          # open scope for old (correct) parameter symbols
     if proto.ast[genericParamsPos].kind != nkEmpty: