blob: 2d9c8d023499f36ecdd8aa908d2c03c9d4dfa122 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# It turned out that it's hard to generate correct for these two test cases at
# the same time.
type
TFoo = ref object of RootObj
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)
# bug #837
type
PView* = ref TView
TView* {.inheritable.} = object
data: int
PWindow* = ref TWindow
TWindow* = object of TView
data3: int
PDesktop* = ref TDesktop
TDesktop* = object of TView
data2: int
proc makeDesktop(): PDesktop = new(TDesktop)
proc makeWindow(): PWindow = new(TWindow)
proc thisCausesError(a: var PView, b: PView) =
discard
var dd = makeDesktop()
var aa = makeWindow()
thisCausesError(dd, aa)
|