summary refs log tree commit diff stats
path: root/tests/concepts/mvarconcept.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-03-25 13:21:50 +0100
committerAraq <rumpf_a@web.de>2015-03-25 13:21:50 +0100
commit43228a704f555a771ae2c40616de4bd0f2b5ca2f (patch)
tree51d3507d233867d2c7702df1d63b5b1233760dba /tests/concepts/mvarconcept.nim
parent94f2d639b18f71a4d17347ab134c155dc00cc788 (diff)
downloadNim-43228a704f555a771ae2c40616de4bd0f2b5ca2f.tar.gz
fixes #2404
Diffstat (limited to 'tests/concepts/mvarconcept.nim')
-rw-r--r--tests/concepts/mvarconcept.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/concepts/mvarconcept.nim b/tests/concepts/mvarconcept.nim
new file mode 100644
index 000000000..0f9d0beff
--- /dev/null
+++ b/tests/concepts/mvarconcept.nim
@@ -0,0 +1,13 @@
+type RNG* = concept var rng
+  rng.randomUint32() is uint32
+
+type MersenneTwister* = object
+
+proc randomUint32*(self: var MersenneTwister): uint32 = 5
+
+proc randomInt*(rng: var RNG; max: Positive): Natural = 5
+
+var mersenneTwisterInst = MersenneTwister()
+
+proc randomInt*(max: Positive): Natural =
+  mersenneTwisterInst.randomInt(max)