fixes #2599
This commit is contained in:
parent
e01e0a4b40
commit
14354b436f
5 changed files with 40 additions and 13 deletions
17
tests/generics/mbind_bracket.nim
Normal file
17
tests/generics/mbind_bracket.nim
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
import tables
|
||||
|
||||
type
|
||||
UUIDObject* = ref object
|
||||
uuid: string
|
||||
|
||||
Registry*[T] = ref object
|
||||
objects: Table[string, T]
|
||||
|
||||
proc newRegistry*[T](): Registry[T] =
|
||||
result = Registry[T]()
|
||||
result.objects = initTable[string, T](128)
|
||||
|
||||
proc register*[T](self: Registry[T], obj: T) =
|
||||
self.objects[obj.uuid] = obj
|
||||
|
||||
20
tests/generics/tbind_bracket.nim
Normal file
20
tests/generics/tbind_bracket.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
discard """
|
||||
output: "317"
|
||||
"""
|
||||
|
||||
# bug #2599
|
||||
|
||||
import mbind_bracket
|
||||
|
||||
# also test that `[]` can be passed now as a first class construct:
|
||||
|
||||
template takeBracket(x, a, i: untyped) =
|
||||
echo x(a, i)
|
||||
|
||||
var a: array[10, int]
|
||||
a[8] = 317
|
||||
|
||||
takeBracket(`[]`, a, 8)
|
||||
|
||||
let reg = newRegistry[UUIDObject]()
|
||||
reg.register(UUIDObject())
|
||||
|
|
@ -3,7 +3,7 @@ discard """
|
|||
"""
|
||||
|
||||
type
|
||||
TThreadFuncArgs[T] = object of TObject
|
||||
TThreadFuncArgs[T] = object of RootObj
|
||||
a: proc(): T {.thread.}
|
||||
b: proc(val: T) {.thread.}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue