mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
@@ -2023,8 +2023,11 @@ proc tryExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
|
||||
let oldErrorCount = c.config.errorCounter
|
||||
let oldErrorMax = c.config.errorMax
|
||||
let oldCompilesId = c.compilesContextId
|
||||
inc c.compilesContextIdGenerator
|
||||
c.compilesContextId = c.compilesContextIdGenerator
|
||||
# if this is a nested 'when compiles', do not increase the ID so that
|
||||
# generic instantations can still be cached for this level.
|
||||
if c.compilesContextId == 0:
|
||||
inc c.compilesContextIdGenerator
|
||||
c.compilesContextId = c.compilesContextIdGenerator
|
||||
# do not halt after first error:
|
||||
c.config.errorMax = high(int)
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ proc sameInstantiation(a, b: TInstantiation): bool =
|
||||
proc genericCacheGet(genericSym: PSym, entry: TInstantiation;
|
||||
id: CompilesId): PSym =
|
||||
for inst in genericSym.procInstCache:
|
||||
if inst.compilesId == id and sameInstantiation(entry, inst[]):
|
||||
if (inst.compilesId == 0 or inst.compilesId == id) and sameInstantiation(entry, inst[]):
|
||||
return inst.sym
|
||||
|
||||
when false:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
discard """
|
||||
errormsg: "generic instantiation too nested"
|
||||
file: "system.nim"
|
||||
action: compile
|
||||
"""
|
||||
|
||||
# bug #4766
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
discard """
|
||||
errormsg: "generic instantiation too nested"
|
||||
action: compile
|
||||
"""
|
||||
|
||||
#[
|
||||
|
||||
Reference in New Issue
Block a user