summary refs log tree commit diff stats
path: root/tests/errmsgs/tgenericconstraint.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errmsgs/tgenericconstraint.nim')
-rw-r--r--tests/errmsgs/tgenericconstraint.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/errmsgs/tgenericconstraint.nim b/tests/errmsgs/tgenericconstraint.nim
new file mode 100644
index 000000000..9129d257b
--- /dev/null
+++ b/tests/errmsgs/tgenericconstraint.nim
@@ -0,0 +1,15 @@
+discard """
+  errormsg: "cannot instantiate B"
+  line: 14
+  nimout: '''
+got: (type int)
+but expected: (T: string or float)
+'''
+"""
+
+type
+  B[T: string|float] = object
+    child: ref B[T]
+
+var b: B[int]
+