summary refs log tree commit diff stats
path: root/tests/concepts/tmonoid.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/concepts/tmonoid.nim')
-rw-r--r--tests/concepts/tmonoid.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/concepts/tmonoid.nim b/tests/concepts/tmonoid.nim
index 49b3239bd..e0e19adbc 100644
--- a/tests/concepts/tmonoid.nim
+++ b/tests/concepts/tmonoid.nim
@@ -11,3 +11,15 @@ type Monoid = concept x, y
 proc z(x: typedesc[int]): int = 0
 
 echo(int is Monoid)
+
+# https://github.com/nim-lang/Nim/issues/8126
+type AdditiveMonoid* = concept x, y, type T
+  x + y is T
+
+  # some redundant checks to test an alternative approaches:
+  type TT = type(x)
+  x + y is type(x)
+  x + y is TT
+
+doAssert(1 is AdditiveMonoid)
+