mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
fixes #2039
This commit is contained in:
@@ -1120,7 +1120,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
|
||||
var r = rdLoc(tmp)
|
||||
if isRef:
|
||||
rawGenNew(p, tmp, nil)
|
||||
t = t.sons[0].skipTypes(abstractInst)
|
||||
t = t.lastSon.skipTypes(abstractInst)
|
||||
r = ropef("(*$1)", r)
|
||||
gcUsage(e)
|
||||
else:
|
||||
@@ -1201,9 +1201,9 @@ proc genNewFinalize(p: BProc, e: PNode) =
|
||||
appf(p.module.s[cfsTypeInit3], "$1->finalizer = (void*)$2;$n", [ti, rdLoc(f)])
|
||||
b.r = ropecg(p.module, "($1) #newObj($2, sizeof($3))", [
|
||||
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:
|
||||
bt = skipTypes(refType.sons[0], abstractRange)
|
||||
bt = skipTypes(refType.lastSon, abstractRange)
|
||||
genObjectInit(p, cpsStmts, bt, a, false)
|
||||
gcUsage(e)
|
||||
|
||||
|
||||
@@ -956,9 +956,10 @@ proc makeDeref(n: PNode): PNode =
|
||||
t = skipTypes(t.sons[0], {tyGenericInst})
|
||||
while t.kind in {tyPtr, tyRef}:
|
||||
var a = result
|
||||
result = newNodeIT(nkHiddenDeref, n.info, t.sons[0])
|
||||
let baseTyp = t.lastSon
|
||||
result = newNodeIT(nkHiddenDeref, n.info, baseTyp)
|
||||
addSon(result, a)
|
||||
t = skipTypes(t.lastSon, {tyGenericInst})
|
||||
t = skipTypes(baseTyp, {tyGenericInst})
|
||||
|
||||
const
|
||||
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!
|
||||
- parameter lists without type end up in 'experimental'
|
||||
- iterators always require a return type
|
||||
- overloading of '='
|
||||
|
||||
- make nimble part of the distribution
|
||||
- split docgen into separate tool
|
||||
@@ -50,7 +51,6 @@ Bugs
|
||||
version 0.9.x
|
||||
=============
|
||||
|
||||
- overloading of '='
|
||||
- allow simple read accesses to global variables --> difficult to ensure that
|
||||
no data races happen
|
||||
- pragmas need 'bindSym' support
|
||||
|
||||
Reference in New Issue
Block a user