update NOTICE and LICENSE
[nit.git] / tests / base_upcast.nit
1 import kernel
2
3 class A[E]
4 end
5
6 class B[F] super A[F]
7 end
8
9 class C[G] super B[Int]
10 end
11
12 class D super C[Bool]
13 end
14
15 fun maybe: Bool do return true
16
17 var ai = new A[Int]
18 var ab = new A[Bool]
19 var bi = new B[Int]
20 var bb = new B[Bool]
21 var ci = new C[Int]
22 var cb = new C[Bool]
23 var d = new D
24
25 if maybe then ai = ai
26 #alt1#if maybe then ai = ab
27 if maybe then ai = bi
28 #alt1#if maybe then ai = bb
29 if maybe then ai = ci
30 if maybe then ai = cb
31 if maybe then ai = d
32
33 #alt1#if maybe then ab = ai
34 if maybe then ab = ab
35 #alt1#if maybe then ab = bi
36 if maybe then ab = bb
37 #alt1#if maybe then ab = ci
38 #alt1#if maybe then ab = cb
39 #alt1#if maybe then ab = d
40
41 #alt1#if maybe then bi = ai
42 #alt1#if maybe then bi = ab
43 if maybe then bi = bi
44 #alt1#if maybe then bi = bb
45 if maybe then bi = ci
46 if maybe then bi = cb
47 if maybe then bi = d
48
49 #alt1#if maybe then bb = ai
50 #alt1#if maybe then bb = ab
51 #alt1#if maybe then bb = bi
52 if maybe then bb = bb
53 #alt1#if maybe then bb = ci
54 #alt1#if maybe then bb = cb
55 #alt1#if maybe then bb = d
56
57 #alt1#if maybe then cb = ai
58 #alt1#if maybe then ci = ab
59 #alt1#if maybe then ci = bi
60 #alt1#if maybe then ci = bb
61 if maybe then ci = ci
62 #alt1#if maybe then ci = cb
63 #alt1#if maybe then ci = d
64
65 #alt1#if maybe then cb = ai
66 #alt1#if maybe then cb = ab
67 #alt1#if maybe then cb = bi
68 #alt1#if maybe then cb = bb
69 #alt1#if maybe then cb = ci
70 if maybe then cb = cb
71 if maybe then cb = d
72
73 #alt1#if maybe then d = ai
74 #alt1#if maybe then d = ab
75 #alt1#if maybe then d = bi
76 #alt1#if maybe then d = bb
77 #alt1#if maybe then d = ci
78 #alt1#if maybe then d = cb
79 if maybe then d = d