Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_init_super_call2.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import kernel
16
17 class A
18 var i: Int
19 end
20
21 class B1
22 super A
23 #alt1#init is old_style_init do super
24 end
25
26 class B2
27 super A
28 init is old_style_init do super(3)
29 end
30
31 class B3
32 super A
33 #alt2#init is old_style_init do super(true)
34 end
35
36 class B4
37 super A
38 #alt3#init is old_style_init do end
39 end
40
41 class C1
42 super A
43 init(j: Int)
44 is
45 old_style_init
46 do
47 super
48 j.output
49 end
50 end
51
52 class D1
53 super A
54 init(j: Int)
55 is
56 old_style_init
57 do
58 super
59 j.output
60 end
61 end
62
63 class E1
64 super A
65 init(j: Bool)
66 is
67 old_style_init
68 do
69 super(8)#alt4#super
70 j.output
71 end
72 end
73
74 class C2
75 super A
76 init(j: Int)
77 is
78 old_style_init
79 do
80 super(j)
81 j.output
82 end
83 end
84
85 class D2
86 super A
87 init(j: Int)
88 is
89 old_style_init
90 do
91 super(j)
92 j.output
93 end
94 end
95
96 class E2
97 super A
98 init(j: Bool)
99 is
100 old_style_init
101 do
102 super(11)#alt5#super(j)
103 j.output
104 end
105 end
106
107 class C3
108 super A
109 init(j: Int)
110 is
111 old_style_init
112 do
113 super(j)#alt6#
114 j.output
115 end
116 end
117
118 class D3
119 super A
120 init(j: Int)
121 is
122 old_style_init
123 do
124 super(j)#alt6#
125 j.output
126 end
127 end
128
129 class E3
130 super A
131 init(j: Bool)
132 is
133 old_style_init
134 do
135 super(14)#alt6#
136 j.output
137 end
138 end
139
140 class F1
141 super A
142 init(j: Int, k: Bool)
143 is
144 old_style_init
145 do
146 super
147 j.output
148 end
149 end
150
151 class F2
152 super A
153 init(j: Int, k: Bool)
154 is
155 old_style_init
156 do
157 super(j)#alt6#
158 j.output
159 end
160 end
161
162 var x
163 x = new A(1)
164 x.i.output
165 x = new B1(2) #alt1# x = new B1
166 x.i.output
167 x = new B2
168 x.i.output
169 x = new B3(4) #alt2# x = new B3
170 x.i.output
171 x = new B4(5) #alt3# x = new B4
172 x.i.output
173 x = new C1(6)
174 x.i.output
175 x = new D1(7)
176 x.i.output
177 x = new E1(true)
178 x.i.output
179 x = new C2(9)
180 x.i.output
181 x = new D2(10)
182 x.i.output
183 x = new E2(true)
184 x.i.output
185 x = new C3(12)
186 x.i.output
187 x = new D3(13)
188 x.i.output
189 x = new E3(true)
190 x.i.output
191 x = new F1(15,true)
192 x.i.output
193 x = new F2(16,true)
194 x.i.output