Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_init_super_call.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 init(i: Int) do i.output
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) do
44 super
45 j.output
46 end
47 end
48
49 class D1
50 super A
51 init(j) do
52 super
53 j.output
54 end
55 end
56
57 class E1
58 super A
59 init(j: Bool) do
60 super(8)#alt4#super
61 j.output
62 end
63 end
64
65 class C2
66 super A
67 init(j: Int) do
68 super(j)
69 j.output
70 end
71 end
72
73 class D2
74 super A
75 init(j) do
76 super(j)
77 j.output
78 end
79 end
80
81 class E2
82 super A
83 init(j: Bool) do
84 super(11)#alt5#super(j)
85 j.output
86 end
87 end
88
89 class C3
90 super A
91 init(j: Int) do
92 j.output
93 end
94 end
95
96 class D3
97 super A
98 init(j) do
99 j.output
100 end
101 end
102
103 class E3
104 super A
105 init(j: Bool) do
106 super(14)#alt6#
107 j.output
108 end
109 end
110
111 class F1
112 super A
113 init(j: Int, k: Bool) do
114 super
115 j.output
116 end
117 end
118
119 class F2
120 super A
121 init(j: Int, k: Bool) do
122 j.output
123 end
124 end
125
126 var x
127 x = new A(1)
128 x = new B1(2) #alt1# x = new B1
129 x = new B2
130 x = new B3(4) #alt2# x = new B3
131 x = new B4(5) #alt3# x = new B4
132 x = new C1(6)
133 x = new D1(7)
134 x = new E1(true)
135 x = new C2(9)
136 x = new D2(10)
137 x = new E2(true)
138 x = new C3(12)
139 x = new D3(13)
140 x = new E3(true)
141 x = new F1(15,true)
142 x = new F2(16,true)