summary refs log tree commit diff stats
path: root/tests/errmsgs/tnested_generic_instantiation.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/errmsgs/tnested_generic_instantiation.nim')
-rw-r--r--tests/errmsgs/tnested_generic_instantiation.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/errmsgs/tnested_generic_instantiation.nim b/tests/errmsgs/tnested_generic_instantiation.nim
new file mode 100644
index 000000000..ab9ab54cd
--- /dev/null
+++ b/tests/errmsgs/tnested_generic_instantiation.nim
@@ -0,0 +1,24 @@
+discard """
+action: compile
+"""
+
+# bug #4766
+
+type
+  Plain = ref object
+    discard
+
+  Wrapped[T] = object
+    value: T
+
+converter toWrapped[T](value: T): Wrapped[T] =
+  Wrapped[T](value: value)
+
+let result = Plain()
+discard $result
+
+proc foo[T2](a: Wrapped[T2]) =
+  # Error: generic instantiation too nested
+  discard $a
+
+foo(result)