new tester; all tests categorized
This commit is contained in:
parent
51ee524109
commit
20b5f31c03
481 changed files with 794 additions and 2506 deletions
|
|
@ -1,31 +0,0 @@
|
|||
# We need to open the gensym'ed symbol again so that the instantiation
|
||||
# creates a fresh copy; but this is wrong the very first reason for gensym
|
||||
# is that scope rules cannot be used! So simply removing 'sfGenSym' does
|
||||
# not work. Copying the symbol does not work either because we're already
|
||||
# the owner of the symbol! What we need to do is to copy the symbol
|
||||
# in the generic instantiation process...
|
||||
|
||||
type
|
||||
TA = object
|
||||
x: int
|
||||
TB = object
|
||||
x: string
|
||||
|
||||
template genImpl() =
|
||||
var gensymed: T
|
||||
when T is TB:
|
||||
gensymed.x = "abc"
|
||||
else:
|
||||
gensymed.x = 123
|
||||
shallowCopy(result, gensymed)
|
||||
|
||||
proc gen[T](x: T): T =
|
||||
genImpl()
|
||||
|
||||
var
|
||||
a: TA
|
||||
b: TB
|
||||
let x = gen(a)
|
||||
let y = gen(b)
|
||||
|
||||
echo x.x, " ", y.x
|
||||
Loading…
Add table
Add a link
Reference in a new issue