update NOTICE and LICENSE
[nit.git] / tests / base_upcast2.nit
1 import kernel
2
3 class A[E]
4 end
5
6 class B[G] super A[Int]
7 end
8
9 class C super B[Bool]
10 end
11
12 class X
13 #1alt1#type T: A[Int]
14 #1alt2#type T: A[Bool]
15 #1alt3#type T: B[Int]
16 #1alt4#type T: B[Bool]
17 #1alt5#type T: C
18 fun toto
19 do
20 var ai = new A[Int]
21 var ab = new A[Bool]
22 var bi = new B[Int]
23 var bb = new B[Bool]
24 var c = new C
25
26 var t: T = c.as(T)
27 #alt1#if maybe then t = ai
28 #alt2#if maybe then t = ab
29 #alt3#if maybe then t = bi
30 #alt4#if maybe then t = bb
31 #alt5#if maybe then t = c
32 #alt6#if maybe then ai = t
33 #alt7#if maybe then ab = t
34 #alt8#if maybe then bi = t
35 #alt9#if maybe then bb = t
36 #alt10#if maybe then c = t
37 end
38 end
39
40 fun maybe: Bool do return true
41