summary refs log tree commit diff stats
path: root/tests/generics
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-05-15 08:17:29 +0200
committerGitHub <noreply@github.com>2019-05-15 08:17:29 +0200
commit9ecb24e443453066e2f9361784daf51f3e5c7f9c (patch)
tree6a87cbc8f668bc970376b5ae67507a99dfe3ab3d /tests/generics
parentfa3d19b4773648744834c67e5b2b9411e062b844 (diff)
downloadNim-9ecb24e443453066e2f9361784daf51f3e5c7f9c.tar.gz
fixes #88 (#11243)
Diffstat (limited to 'tests/generics')
-rw-r--r--tests/generics/tobjecttyperel.nim27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/generics/tobjecttyperel.nim b/tests/generics/tobjecttyperel.nim
index 6c2184cc2..80fe23459 100644
--- a/tests/generics/tobjecttyperel.nim
+++ b/tests/generics/tobjecttyperel.nim
@@ -4,7 +4,8 @@ discard """
 17
 (width: 0.0, taste: "", color: 13)
 (width: 0.0, taste: "", color: 15)
-cool'''
+cool
+test'''
 """
 
 # bug #5241
@@ -62,4 +63,26 @@ method m[T](o: Foo[T]) = echo "cool"
 
 var v: Bar
 v.new()
-v.m() # Abstract method not called anymore
\ No newline at end of file
+v.m() # Abstract method not called anymore
+
+
+# bug #88
+
+type
+  TGen[T] = object of RootObj
+    field: T
+
+  TDerived[T] = object of TGen[T]
+    nextField: T
+
+proc doSomething[T](x: ref TGen[T]) =
+  type
+    Ty = ref TDerived[T]
+  echo Ty(x).nextField
+
+var
+  x: ref TDerived[string]
+new(x)
+x.nextField = "test"
+
+doSomething(x)