summary refs log tree commit diff stats
path: root/tests/concepts/t5642.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2017-04-07 17:30:15 +0300
committerZahary Karadjov <zahary@gmail.com>2017-04-07 19:28:52 +0300
commitfb3ff64450526f532492c04c6cc02469cfb3d633 (patch)
tree45ac4e5e3a3e744f05564f90d1e4fa5a81a05cbd /tests/concepts/t5642.nim
parenteb635d9ccf4abb9a003808ed1ddce889ecd982ef (diff)
downloadNim-fb3ff64450526f532492c04c6cc02469cfb3d633.tar.gz
fix #5642
Diffstat (limited to 'tests/concepts/t5642.nim')
-rw-r--r--tests/concepts/t5642.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/concepts/t5642.nim b/tests/concepts/t5642.nim
new file mode 100644
index 000000000..d1e7bd1dd
--- /dev/null
+++ b/tests/concepts/t5642.nim
@@ -0,0 +1,25 @@
+discard """
+  output: 9
+"""
+
+type DataTable = concept x
+  x is object
+  for f in fields(x):
+    f is seq
+
+type Students = object
+   id : seq[int]
+   name : seq[string]
+   age: seq[int]
+
+proc nrow*(dt: DataTable) : Natural =
+  var totalLen = 0
+  for f in fields(dt):
+    totalLen += f.len
+  return totalLen
+
+let
+ stud = Students (id : @[1,2,3], name : @["Vas", "Pas", "NafNaf"], age : @[10,16,32])
+
+echo nrow(stud)
+