fix compilation regression in alea
This commit is contained in:
parent
dfbafff2e7
commit
4da8536701
4 changed files with 37 additions and 12 deletions
|
|
@ -81,6 +81,8 @@ template mdbg*: bool {.dirty.} =
|
||||||
p.lex.fileIdx == gProjectMainIdx
|
p.lex.fileIdx == gProjectMainIdx
|
||||||
else:
|
else:
|
||||||
p.module.module.fileIdx == gProjectMainIdx
|
p.module.module.fileIdx == gProjectMainIdx
|
||||||
|
elif compiles(m.module.fileIdx):
|
||||||
|
m.module.fileIdx == gProjectMainIdx
|
||||||
elif compiles(L.fileIdx):
|
elif compiles(L.fileIdx):
|
||||||
L.fileIdx == gProjectMainIdx
|
L.fileIdx == gProjectMainIdx
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1094,7 +1094,7 @@ proc genDeepCopyProc(m: BModule; s: PSym; result: Rope) =
|
||||||
|
|
||||||
proc genTypeInfo(m: BModule, t: PType): Rope =
|
proc genTypeInfo(m: BModule, t: PType): Rope =
|
||||||
let origType = t
|
let origType = t
|
||||||
var t = skipTypes(origType, irrelevantForBackend)
|
var t = skipTypes(origType, irrelevantForBackend + tyUserTypeClasses)
|
||||||
|
|
||||||
let sig = hashType(origType)
|
let sig = hashType(origType)
|
||||||
result = m.typeInfoMarker.getOrDefault(sig)
|
result = m.typeInfoMarker.getOrDefault(sig)
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||||
else:
|
else:
|
||||||
c.hashSym(t.sym)
|
c.hashSym(t.sym)
|
||||||
return
|
return
|
||||||
of tyAlias, tyGenericInst:
|
of tyAlias, tyGenericInst, tyUserTypeClasses:
|
||||||
c.hashType t.lastSon, flags
|
c.hashType t.lastSon, flags
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|
@ -201,16 +201,6 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||||
of tyRef, tyPtr, tyGenericBody, tyVar:
|
of tyRef, tyPtr, tyGenericBody, tyVar:
|
||||||
c.hashType t.lastSon, flags
|
c.hashType t.lastSon, flags
|
||||||
if tfVarIsPtr in t.flags: c &= ".varisptr"
|
if tfVarIsPtr in t.flags: c &= ".varisptr"
|
||||||
of tyUserTypeClass:
|
|
||||||
if t.sym != nil and t.sym.owner != nil:
|
|
||||||
c &= t.sym.owner.name.s
|
|
||||||
else:
|
|
||||||
c &= "unknown typeclass"
|
|
||||||
of tyUserTypeClassInst:
|
|
||||||
let body = t.sons[0]
|
|
||||||
c.hashSym body.sym
|
|
||||||
for i in countup(1, sonsLen(t) - 2):
|
|
||||||
c.hashType t.sons[i], flags
|
|
||||||
of tyFromExpr, tyFieldAccessor:
|
of tyFromExpr, tyFieldAccessor:
|
||||||
c.hashTree(t.n)
|
c.hashTree(t.n)
|
||||||
of tyTuple:
|
of tyTuple:
|
||||||
|
|
|
||||||
33
tests/concepts/tconceptinclosure.nim
Normal file
33
tests/concepts/tconceptinclosure.nim
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
discard """
|
||||||
|
output: "10\n20"
|
||||||
|
"""
|
||||||
|
|
||||||
|
type
|
||||||
|
FonConcept = concept x
|
||||||
|
x.x is int
|
||||||
|
|
||||||
|
Implementation = object
|
||||||
|
x: int
|
||||||
|
|
||||||
|
Closure = object
|
||||||
|
f: proc()
|
||||||
|
|
||||||
|
proc f1(x: FonConcept): Closure =
|
||||||
|
result.f = proc () =
|
||||||
|
echo x.x
|
||||||
|
|
||||||
|
proc f2(x: FonConcept): Closure =
|
||||||
|
result.f = proc () =
|
||||||
|
echo x.x
|
||||||
|
|
||||||
|
let x = Implementation(x: 10)
|
||||||
|
let y = Implementation(x: 20)
|
||||||
|
|
||||||
|
let a = x.f1
|
||||||
|
let b = x.f2
|
||||||
|
let c = x.f1
|
||||||
|
let d = y.f2
|
||||||
|
|
||||||
|
a.f()
|
||||||
|
d.f()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue