summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-10-03 00:08:45 +0200
committerAraq <rumpf_a@web.de>2018-10-03 00:08:45 +0200
commit1428aeccfb38170f4580eb3153d2e9f3d91c6756 (patch)
tree63b4306bcbf9fabcb8e1be4c74d414441e3422cf /tests
parent9bd23b2d4cc94f6b31d7c45eb9dd20dcb64ccebe (diff)
downloadNim-1428aeccfb38170f4580eb3153d2e9f3d91c6756.tar.gz
closes #5868
Diffstat (limited to 'tests')
-rw-r--r--tests/concepts/tusertypeclasses.nim19
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