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)
3ea644690 ^
752cddb91 ^



657dca5c3 ^


752cddb91 ^





0b44d812f ^
752cddb91 ^

0b44d812f ^
752cddb91 ^









1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50