update NOTICE and LICENSE
[nit.git] / tests / base_gen2.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2009 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 import end
18
19 class Object
20 fun output is abstract
21 end
22
23 class Int
24 redef fun output is intern
25 end
26
27 class A
28 redef fun output do 1.output
29 end
30
31 class B[E]
32 redef fun output do _e.output
33 var _e: E
34 init(e: E) do _e = e
35 end
36
37 class C[F, G]
38 redef fun output
39 do
40 _f.output
41 _g.output
42 end
43 var _f: F
44 var _g: G
45 init(f: F, g: G)
46 do
47 _f = f
48 _g = g
49 end
50 end
51
52 var a = new A
53 a.output
54
55 var b = new B[Int](2)
56 b.output
57
58 var c = new C[Int, A](2, a)
59 c.output
60
61 #alt1#var d = new A[Int]
62 #alt2#var d = new B
63 #alt3#var d = new B[Int, Int]
64 #alt4#var d = new C
65 #alt5#var d = new C[Int]
66