summary refs log tree commit diff stats
path: root/compiler/semgnrc.nim
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2018-09-30 14:11:53 +0200
committerLemonBoy <thatlemon@gmail.com>2018-09-30 14:11:53 +0200
commit6d4503325cc667dcfd18c53cee6ef0d245d9f870 (patch)
tree61fd6089fe9e4ff03bce388e635777a1d0b0b1cc /compiler/semgnrc.nim
parent5676e032bda9d86232b003797bdb67070af43e28 (diff)
downloadNim-6d4503325cc667dcfd18c53cee6ef0d245d9f870.tar.gz
Fix regression with runnableExamples in generic expr
The examples should not enter the generic analysis at all.
The regression was introduced in 4cf704bb as a fix for #8694.

Fixes #9130
Fixes #8694
Diffstat (limited to 'compiler/semgnrc.nim')
-rw-r--r--compiler/semgnrc.nim10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim
index 7be0610a2..e1a8390e1 100644
--- a/compiler/semgnrc.nim
+++ b/compiler/semgnrc.nim
@@ -225,7 +225,7 @@ proc semGenericStmt(c: PContext, n: PNode,
     var mixinContext = false
     if s != nil:
       incl(s.flags, sfUsed)
-      mixinContext = s.magic in {mDefined, mDefinedInScope, mCompiles, mRunnableExamples}
+      mixinContext = s.magic in {mDefined, mDefinedInScope, mCompiles}
       let sc = symChoice(c, fn, s, if s.isMixedIn: scForceOpen else: scOpen)
       case s.kind
       of skMacro:
@@ -255,11 +255,11 @@ proc semGenericStmt(c: PContext, n: PNode,
         discard
       of skProc, skFunc, skMethod, skIterator, skConverter, skModule:
         result.sons[0] = sc
-        # do not check of 's.magic==mRoof' here because it might be some
-        # other '^' but after overload resolution the proper one:
-        if ctx.bracketExpr != nil and n.len == 2 and s.name.s == "^":
-          result.add ctx.bracketExpr
         first = 1
+        # We're not interested in the example code during this pass so let's
+        # skip it
+        if s.magic == mRunnableExamples:
+          inc first
       of skGenericParam:
         result.sons[0] = newSymNodeTypeDesc(s, fn.info)
         styleCheckUse(fn.info, s)