diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/concepts/tusertypeclasses.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/concepts/tusertypeclasses.nim b/tests/concepts/tusertypeclasses.nim index 3ea10569f..c7104f2a6 100644 --- a/tests/concepts/tusertypeclasses.nim +++ b/tests/concepts/tusertypeclasses.nim @@ -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 |