closes #5868
This commit is contained in:
parent
9bd23b2d4c
commit
1428aeccfb
1 changed files with 19 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ Container
|
||||||
TObj
|
TObj
|
||||||
int
|
int
|
||||||
111 111
|
111 111
|
||||||
|
(id: @[1, 2, 3], name: @["Vas", "Pas", "NafNaf"], age: @[10, 16, 18])
|
||||||
'''
|
'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -107,3 +108,21 @@ let usedToFail: stringTest = "111"
|
||||||
let working: string = "111"
|
let working: string = "111"
|
||||||
|
|
||||||
echo usedToFail, " ", working
|
echo usedToFail, " ", working
|
||||||
|
|
||||||
|
# bug #5868
|
||||||
|
|
||||||
|
type TaggedType[T; Key: static[string]] = T
|
||||||
|
|
||||||
|
proc setKey*[DT](dt: DT, key: static[string]): TaggedType[DT, key] =
|
||||||
|
result = cast[type(result)](dt)
|
||||||
|
|
||||||
|
type Students = object
|
||||||
|
id : seq[int]
|
||||||
|
name : seq[string]
|
||||||
|
age: seq[int]
|
||||||
|
|
||||||
|
let
|
||||||
|
stud = Students(id : @[1,2,3], name : @["Vas", "Pas", "NafNaf"], age : @[10,16,18])
|
||||||
|
stud2 = stud.setkey("id")
|
||||||
|
|
||||||
|
echo stud2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue