summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/typerel/tgeneric_subtype_regression.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/typerel/tgeneric_subtype_regression.nim b/tests/typerel/tgeneric_subtype_regression.nim
new file mode 100644
index 000000000..e279c0ad4
--- /dev/null
+++ b/tests/typerel/tgeneric_subtype_regression.nim
@@ -0,0 +1,19 @@
+discard """
+  errormsg: "type mismatch: got (FooRef[system.string])"
+  line: 15
+"""
+
+# bug #4478
+
+type
+  Foo[T] = object
+  FooRef[T] = ref Foo[T]
+
+proc takeFoo[T](foo: Foo[T]): int = discard
+
+proc g(x: FooRef[string]) =
+  echo x.takeFoo() != 8
+
+var x: FooRef[string]
+
+g(x)