summary refs log tree commit diff stats
path: root/tests/objects
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-11-21 02:26:49 +0100
committerAraq <rumpf_a@web.de>2014-11-21 02:26:49 +0100
commit326bdae8ca14a981f5ab8c553fbba45e28a36082 (patch)
treed30e680097fb0476e8a0b1d4a4d74e717b93e284 /tests/objects
parent5ab3542c1801ba042fbe964245be004c0683abb2 (diff)
downloadNim-326bdae8ca14a981f5ab8c553fbba45e28a36082.tar.gz
fixes #837
Diffstat (limited to 'tests/objects')
-rw-r--r--tests/objects/tobject3.nim33
-rw-r--r--tests/objects/toop1.nim7
2 files changed, 34 insertions, 6 deletions
diff --git a/tests/objects/tobject3.nim b/tests/objects/tobject3.nim
index 935e6ca8c..85cf1cfe3 100644
--- a/tests/objects/tobject3.nim
+++ b/tests/objects/tobject3.nim
@@ -1,5 +1,9 @@
+
+# It turned out that it's hard to generate correct for these two test cases at
+# the same time.
+
 type
-  TFoo = ref object of TObject
+  TFoo = ref object of RootObj
     Data: int  
   TBar = ref object of TFoo
     nil
@@ -26,3 +30,30 @@ 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)
+
diff --git a/tests/objects/toop1.nim b/tests/objects/toop1.nim
index 350799f51..0d8ba124b 100644
--- a/tests/objects/toop1.nim
+++ b/tests/objects/toop1.nim
@@ -6,7 +6,7 @@ discard """
 import macros
 
 type
-  TFigure = object of TObject    # abstract base class:
+  TFigure = object of RootObj    # abstract base class:
     draw: proc (my: var TFigure) {.nimcall.} # concrete classes implement this
   
 proc init(f: var TFigure) = 
@@ -56,7 +56,7 @@ macro `!` (n: expr): stmt {.immediate.} =
     result.add(n[1]) # obj
 
 type
-  TSocket* = object of TObject
+  TSocket* = object of RootObj
     FHost: int # cannot be accessed from the outside of the module
                # the `F` prefix is a convention to avoid clashes since
                # the accessors are named `host`
@@ -84,6 +84,3 @@ r!draw
 c!draw() 
 
 #OUT 34[]o 5
-
-
-
v class='alt'>
a98f609ae ^






86f4dae74 ^
c701ed3c9 ^
a98f609ae ^
f7a0a42b0 ^
86f4dae74 ^





a98f609ae ^












a48cbfe56 ^
a98f609ae ^












a48cbfe56 ^
a98f609ae ^









86f4dae74 ^
a98f609ae ^














a48cbfe56 ^
a98f609ae ^



a48cbfe56 ^
a98f609ae ^









a48cbfe56 ^
a98f609ae ^









a48cbfe56 ^
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153