fixes #2039
This commit is contained in:
parent
e9a197e704
commit
ee4e95fefe
4 changed files with 30 additions and 6 deletions
|
|
@ -1120,7 +1120,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||||
var r = rdLoc(tmp)
|
var r = rdLoc(tmp)
|
||||||
if isRef:
|
if isRef:
|
||||||
rawGenNew(p, tmp, nil)
|
rawGenNew(p, tmp, nil)
|
||||||
t = t.sons[0].skipTypes(abstractInst)
|
t = t.lastSon.skipTypes(abstractInst)
|
||||||
r = ropef("(*$1)", r)
|
r = ropef("(*$1)", r)
|
||||||
gcUsage(e)
|
gcUsage(e)
|
||||||
else:
|
else:
|
||||||
|
|
@ -1201,9 +1201,9 @@ proc genNewFinalize(p: BProc, e: PNode) =
|
||||||
appf(p.module.s[cfsTypeInit3], "$1->finalizer = (void*)$2;$n", [ti, rdLoc(f)])
|
appf(p.module.s[cfsTypeInit3], "$1->finalizer = (void*)$2;$n", [ti, rdLoc(f)])
|
||||||
b.r = ropecg(p.module, "($1) #newObj($2, sizeof($3))", [
|
b.r = ropecg(p.module, "($1) #newObj($2, sizeof($3))", [
|
||||||
getTypeDesc(p.module, refType),
|
getTypeDesc(p.module, refType),
|
||||||
ti, getTypeDesc(p.module, skipTypes(refType.sons[0], abstractRange))])
|
ti, getTypeDesc(p.module, skipTypes(refType.lastSon, abstractRange))])
|
||||||
genAssignment(p, a, b, {needToKeepAlive}) # set the object type:
|
genAssignment(p, a, b, {needToKeepAlive}) # set the object type:
|
||||||
bt = skipTypes(refType.sons[0], abstractRange)
|
bt = skipTypes(refType.lastSon, abstractRange)
|
||||||
genObjectInit(p, cpsStmts, bt, a, false)
|
genObjectInit(p, cpsStmts, bt, a, false)
|
||||||
gcUsage(e)
|
gcUsage(e)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -956,9 +956,10 @@ proc makeDeref(n: PNode): PNode =
|
||||||
t = skipTypes(t.sons[0], {tyGenericInst})
|
t = skipTypes(t.sons[0], {tyGenericInst})
|
||||||
while t.kind in {tyPtr, tyRef}:
|
while t.kind in {tyPtr, tyRef}:
|
||||||
var a = result
|
var a = result
|
||||||
result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
|
let baseTyp = t.lastSon
|
||||||
|
result = newNodeIT(nkHiddenDeref, n.info, baseTyp)
|
||||||
addSon(result, a)
|
addSon(result, a)
|
||||||
t = skipTypes(t.lastSon, {tyGenericInst})
|
t = skipTypes(baseTyp, {tyGenericInst})
|
||||||
|
|
||||||
const
|
const
|
||||||
tyTypeParamsHolders = {tyGenericInst, tyCompositeTypeClass}
|
tyTypeParamsHolders = {tyGenericInst, tyCompositeTypeClass}
|
||||||
|
|
|
||||||
23
tests/typerel/tregionptrs2.nim
Normal file
23
tests/typerel/tregionptrs2.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
# bug #2039
|
||||||
|
|
||||||
|
type
|
||||||
|
RegionTy = object
|
||||||
|
ThingyPtr = RegionTy ptr Thingy
|
||||||
|
Thingy = object
|
||||||
|
next: ThingyPtr
|
||||||
|
name: string
|
||||||
|
|
||||||
|
proc iname(t: ThingyPtr) =
|
||||||
|
var x = t
|
||||||
|
|
||||||
|
while not x.isNil:
|
||||||
|
echo x.name
|
||||||
|
x = x.next
|
||||||
|
|
||||||
|
proc go() =
|
||||||
|
var athing : ThingyPtr
|
||||||
|
|
||||||
|
iname(athing)
|
||||||
|
|
||||||
|
go()
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -7,6 +7,7 @@ version 0.10
|
||||||
prevent 'not 4 == 5' from compiling. -> requires 'mixin' annotation for procs!
|
prevent 'not 4 == 5' from compiling. -> requires 'mixin' annotation for procs!
|
||||||
- parameter lists without type end up in 'experimental'
|
- parameter lists without type end up in 'experimental'
|
||||||
- iterators always require a return type
|
- iterators always require a return type
|
||||||
|
- overloading of '='
|
||||||
|
|
||||||
- make nimble part of the distribution
|
- make nimble part of the distribution
|
||||||
- split docgen into separate tool
|
- split docgen into separate tool
|
||||||
|
|
@ -50,7 +51,6 @@ Bugs
|
||||||
version 0.9.x
|
version 0.9.x
|
||||||
=============
|
=============
|
||||||
|
|
||||||
- overloading of '='
|
|
||||||
- allow simple read accesses to global variables --> difficult to ensure that
|
- allow simple read accesses to global variables --> difficult to ensure that
|
||||||
no data races happen
|
no data races happen
|
||||||
- pragmas need 'bindSym' support
|
- pragmas need 'bindSym' support
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue