diff options
author | Zahary Karadjov <zahary@gmail.com> | 2017-10-07 22:17:16 +0300 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-12-21 11:06:36 +0100 |
commit | 057d5789ba6cf7e1f0cef681ffba77b0c4788110 (patch) | |
tree | 847aeb3ca7418792af594ff209f9641de0c3dfeb /tests/concepts | |
parent | 70380882c54a6eea08c715b015399673b55e9bc0 (diff) | |
download | Nim-057d5789ba6cf7e1f0cef681ffba77b0c4788110.tar.gz |
fix #6277
Diffstat (limited to 'tests/concepts')
-rw-r--r-- | tests/concepts/titerable.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/concepts/titerable.nim b/tests/concepts/titerable.nim new file mode 100644 index 000000000..b18658b2a --- /dev/null +++ b/tests/concepts/titerable.nim @@ -0,0 +1,20 @@ +discard """ + nimout: "int\nint" + output: 15 +""" + +import typetraits + +type + Iterable[T] = concept x + for value in x: + type(value) is T + +proc sum*[T](iter: Iterable[T]): T = + static: echo T.name + for element in iter: + static: echo element.type.name + result += element + +echo sum([1, 2, 3, 4, 5]) + |