blob: 935e6ca8cfe9dbfb727cdbdae9fd89ba4784e846 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
|