tests/reject/temptycaseobj.nim
This commit is contained in:
parent
18bec94e22
commit
898e5c3d2c
2 changed files with 5 additions and 45 deletions
|
|
@ -7,43 +7,6 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
proc checkTypeInfo*(dest: Pointer, src: int, mt: pointer)
|
|
||||||
proc checkTypeInfo(dest: Pointer, src: int, n: ptr TNimNode) =
|
|
||||||
var
|
|
||||||
d = cast[TAddress](dest)
|
|
||||||
s = cast[TAddress](src)
|
|
||||||
case n.kind
|
|
||||||
of nkSlot: checkTypeInfo(cast[pointer](d +% n.offset), src, n.typ)
|
|
||||||
of nkList:
|
|
||||||
for i in 0..n.len-1: checkTypeInfo(dest, src, n.sons[i])
|
|
||||||
of nkCase:
|
|
||||||
var m = selectBranch(dest, n)
|
|
||||||
if m != nil: checkTypeInfo(dest, src, m)
|
|
||||||
else:
|
|
||||||
c_fprintf(cstdout, "ugh memory corruption! in check type info %ld\n", src)
|
|
||||||
quit 1
|
|
||||||
#of nkNone: assert(false)
|
|
||||||
|
|
||||||
proc checkTypeInfo(dest: Pointer, src: int, mt: pointer) =
|
|
||||||
var mt = cast[PNimType](mt)
|
|
||||||
var
|
|
||||||
d = cast[TAddress](dest)
|
|
||||||
s = cast[TAddress](src)
|
|
||||||
assert(mt != nil)
|
|
||||||
case mt.Kind
|
|
||||||
of tyString: nil
|
|
||||||
of tySequence: nil
|
|
||||||
of tyObject, tyTuple, tyPureObject:
|
|
||||||
checkTypeInfo(dest, src, mt.node)
|
|
||||||
of tyArray, tyArrayConstr:
|
|
||||||
for i in 0..(mt.size div mt.base.size)-1:
|
|
||||||
checkTypeInfo(cast[pointer](d +% i*% mt.base.size),
|
|
||||||
src, mt.base)
|
|
||||||
of tyRef: nil
|
|
||||||
else:
|
|
||||||
nil # copy raw bits
|
|
||||||
|
|
||||||
|
|
||||||
proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool)
|
proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool)
|
||||||
proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) =
|
proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) =
|
||||||
var
|
var
|
||||||
|
|
@ -61,10 +24,10 @@ proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) =
|
||||||
n.typ.size)
|
n.typ.size)
|
||||||
var m = selectBranch(src, n)
|
var m = selectBranch(src, n)
|
||||||
if m != nil: genericAssignAux(dest, src, m, shallow)
|
if m != nil: genericAssignAux(dest, src, m, shallow)
|
||||||
else:
|
of nkNone: assert(false)
|
||||||
echo "ugh memory corruption! ", n.kind
|
#else:
|
||||||
quit 1
|
# echo "ugh memory corruption! ", n.kind
|
||||||
#of nkNone: assert(false)
|
# quit 1
|
||||||
|
|
||||||
proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) =
|
proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) =
|
||||||
var
|
var
|
||||||
|
|
|
||||||
5
todo.txt
5
todo.txt
|
|
@ -1,9 +1,5 @@
|
||||||
High priority (version 0.8.12)
|
High priority (version 0.8.12)
|
||||||
==============================
|
==============================
|
||||||
- sorting with leads to a strange memory corruption: tsimplesort
|
|
||||||
--> system.swap or genericAssign is broken! And indeed, if reference counts
|
|
||||||
are not modified and the GC is triggered in between a swap, bad things
|
|
||||||
may happen!
|
|
||||||
- bug: invoking a generic iterator twice triggers a code gen bug (titer2)
|
- bug: invoking a generic iterator twice triggers a code gen bug (titer2)
|
||||||
* implement message passing built-ins
|
* implement message passing built-ins
|
||||||
* add --deadlock_prevention:on|off switch? timeout for locks?
|
* add --deadlock_prevention:on|off switch? timeout for locks?
|
||||||
|
|
@ -14,6 +10,7 @@ High priority (version 0.8.12)
|
||||||
version 0.9.0
|
version 0.9.0
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
- bug: tfFinal not passed to generic
|
||||||
- bug: forward proc for generic seems broken
|
- bug: forward proc for generic seems broken
|
||||||
- test the sort implementation again
|
- test the sort implementation again
|
||||||
- warning for implicit openArray -> varargs convention
|
- warning for implicit openArray -> varargs convention
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue