summary refs log tree commit diff stats
path: root/tests/errmsgs/tconceptconstraint.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errmsgs/tconceptconstraint.nim')
-rw-r--r--tests/errmsgs/tconceptconstraint.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/errmsgs/tconceptconstraint.nim b/tests/errmsgs/tconceptconstraint.nim
new file mode 100644
index 000000000..066ec5bdb
--- /dev/null
+++ b/tests/errmsgs/tconceptconstraint.nim
@@ -0,0 +1,20 @@
+discard """
+  errormsg: "cannot instantiate B"
+  nimout: '''
+got: <typedesc[string]>
+but expected: <T: A>
+'''
+"""
+
+type
+  A = concept c
+    advance(c)
+
+  B[T: A] = object
+    child: ref B[T]
+
+proc advance(x: int): int = x + 1
+
+var a: B[int]
+var b: B[string]
+