summary refs log tree commit diff stats
path: root/tests/object/tobject3.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-01-13 02:10:03 +0100
committerAraq <rumpf_a@web.de>2014-01-13 02:10:03 +0100
commit20b5f31c03fb556ec0aa2428a40adbac004d8987 (patch)
tree58086941e7d6bb8f480ca1173a95722ada9435b2 /tests/object/tobject3.nim
parent51ee524109cf7e3e86c676bc1676063a01bfd979 (diff)
downloadNim-20b5f31c03fb556ec0aa2428a40adbac004d8987.tar.gz
new tester; all tests categorized
Diffstat (limited to 'tests/object/tobject3.nim')
-rw-r--r--tests/object/tobject3.nim28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/object/tobject3.nim b/tests/object/tobject3.nim
new file mode 100644
index 000000000..935e6ca8c
--- /dev/null
+++ b/tests/object/tobject3.nim
@@ -0,0 +1,28 @@
+type
+  TFoo = ref object of TObject
+    Data: int  
+  TBar = ref object of TFoo
+    nil
+  TBar2 = ref object of TBar
+    d2: int
+
+template super(self: TBar): TFoo = self
+
+template super(self: TBar2): TBar = self
+
+proc Foo(self: TFoo) =
+  echo "TFoo"
+
+#proc Foo(self: TBar) =
+#  echo "TBar"
+#  Foo(super(self))
+# works when this code is uncommented
+
+proc Foo(self: TBar2) =
+  echo "TBar2"
+  Foo(super(self))
+
+var b: TBar2
+new(b)
+
+Foo(b)