summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-06-17 10:24:32 +0300
committerGitHub <noreply@github.com>2023-06-17 15:24:32 +0800
commit6d2163724550ed3a115d22e00f9d40150534a8b9 (patch)
tree9e5c411a3ba7065c8bafec1703807b694988a550 /compiler
parent647d9611ae81c7af2c86af5b33a14787254896b5 (diff)
downloadNim-6d2163724550ed3a115d22e00f9d40150534a8b9.tar.gz
fix scoping regression with calls in generic bodies (#22115)
refs #22029, refs https://github.com/status-im/nim-libp2p/actions/runs/5263850340/jobs/9514434659
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sem.nim4
-rw-r--r--compiler/semcall.nim2
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index de78667ba..ca2c6bc00 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -405,6 +405,8 @@ proc semExprFlagDispatched(c: PContext, n: PNode, flags: TExprFlags; expectedTyp
       evaluated = evalAtCompileTime(c, result)
       if evaluated != nil: return evaluated
 
+proc semGenericStmt(c: PContext, n: PNode): PNode
+
 include hlo, seminst, semcall
 
 proc resetSemFlag(n: PNode) =
@@ -513,8 +515,6 @@ proc semConstBoolExpr(c: PContext, n: PNode): PNode =
   result = forceBool(c, semConstExpr(c, n, getSysType(c.graph, n.info, tyBool)))
   if result.kind != nkIntLit:
     localError(c.config, n.info, errConstExprExpected)
-
-proc semGenericStmt(c: PContext, n: PNode): PNode
 proc semConceptBody(c: PContext, n: PNode): PNode
 
 include semtypes
diff --git a/compiler/semcall.nim b/compiler/semcall.nim
index c0317f4d6..d2460ab06 100644
--- a/compiler/semcall.nim
+++ b/compiler/semcall.nim
@@ -628,7 +628,7 @@ proc semOverloadedCall(c: PContext, n, nOrig: PNode,
     result = semResolvedCall(c, r, n, flags)
   else:
     if efDetermineType in flags and c.inGenericContext > 0 and c.matchedConcept == nil:
-      result = n
+      result = semGenericStmt(c, n)
       result.typ = makeTypeFromExpr(c, result.copyTree)
     elif efExplain notin flags:
       # repeat the overload resolution,