summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--tests/concepts/tvarconcept.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/concepts/tvarconcept.nim b/tests/concepts/tvarconcept.nim
new file mode 100644
index 000000000..e33686b05
--- /dev/null
+++ b/tests/concepts/tvarconcept.nim
@@ -0,0 +1,15 @@
+
+# bug #2346
+
+type RNG64 = concept var rng
+  rng.randomUint64() is uint64
+
+proc randomInt*(rng: var RNG64; max: int): int = 4
+
+
+type MyRNG* = object
+
+proc randomUint64*(self: var MyRNG): uint64 = 4
+
+var r = MyRNG()
+echo r.randomInt(5)