This commit is contained in:
Araq
2018-10-03 00:08:45 +02:00
parent 9bd23b2d4c
commit 1428aeccfb

View File

@@ -5,6 +5,7 @@ Container
TObj
int
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"
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