bugfix: type alias to generic; generic type not stripped away from for loop variable
This commit is contained in:
parent
0e22a51095
commit
7405278138
8 changed files with 118 additions and 69 deletions
11
tests/compile/tgeneric.nim
Normal file
11
tests/compile/tgeneric.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import tables
|
||||
|
||||
type
|
||||
TX = TTable[string, int]
|
||||
|
||||
proc foo(models: seq[TTable[string, float]]): seq[float] =
|
||||
result = @[]
|
||||
for model in models.items:
|
||||
result.add model["foobar"]
|
||||
|
||||
|
||||
11
tests/compile/tgeneric2.nim
Normal file
11
tests/compile/tgeneric2.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import tables
|
||||
|
||||
type
|
||||
TX = TTable[string, int]
|
||||
|
||||
proc foo(models: seq[TX]): seq[int] =
|
||||
result = @[]
|
||||
for model in models.items:
|
||||
result.add model["foobar"]
|
||||
|
||||
|
||||
12
tests/compile/tgenericprop.nim
Normal file
12
tests/compile/tgenericprop.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
type
|
||||
TProperty[T] = object of TObject
|
||||
getProc: proc(property: TProperty[T]): T
|
||||
setProc: proc(property: TProperty[T], value: T)
|
||||
value: T
|
||||
|
||||
proc newProperty[T](value: TObject): TProperty[T] =
|
||||
result.getProc = proc (property: TProperty[T]) =
|
||||
return property.value
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue