--- /dev/null
+import kernel
+
+class A[E]
+end
+
+class B[F] super A[F]
+end
+
+class C[G] super B[Int]
+end
+
+class D super C[Bool]
+end
+
+fun maybe: Bool do return true
+
+var ai = new A[Int]
+var ab = new A[Bool]
+var bi = new B[Int]
+var bb = new B[Bool]
+var ci = new C[Int]
+var cb = new C[Bool]
+var d = new D
+
+if maybe then ai = ai
+#alt1#if maybe then ai = ab
+if maybe then ai = bi
+#alt1#if maybe then ai = bb
+if maybe then ai = ci
+if maybe then ai = cb
+if maybe then ai = d
+
+#alt1#if maybe then ab = ai
+if maybe then ab = ab
+#alt1#if maybe then ab = bi
+if maybe then ab = bb
+#alt1#if maybe then ab = ci
+#alt1#if maybe then ab = cb
+#alt1#if maybe then ab = d
+
+#alt1#if maybe then bi = ai
+#alt1#if maybe then bi = ab
+if maybe then bi = bi
+#alt1#if maybe then bi = bb
+if maybe then bi = ci
+if maybe then bi = cb
+if maybe then bi = d
+
+#alt1#if maybe then bb = ai
+#alt1#if maybe then bb = ab
+#alt1#if maybe then bb = bi
+if maybe then bb = bb
+#alt1#if maybe then bb = ci
+#alt1#if maybe then bb = cb
+#alt1#if maybe then bb = d
+
+#alt1#if maybe then cb = ai
+#alt1#if maybe then ci = ab
+#alt1#if maybe then ci = bi
+#alt1#if maybe then ci = bb
+if maybe then ci = ci
+#alt1#if maybe then ci = cb
+#alt1#if maybe then ci = d
+
+#alt1#if maybe then cb = ai
+#alt1#if maybe then cb = ab
+#alt1#if maybe then cb = bi
+#alt1#if maybe then cb = bb
+#alt1#if maybe then cb = ci
+if maybe then cb = cb
+if maybe then cb = d
+
+#alt1#if maybe then d = ai
+#alt1#if maybe then d = ab
+#alt1#if maybe then d = bi
+#alt1#if maybe then d = bb
+#alt1#if maybe then d = ci
+#alt1#if maybe then d = cb
+if maybe then d = d
--- /dev/null
+import kernel
+
+class A[E]
+end
+
+class B[G] super A[Int]
+end
+
+class C super B[Bool]
+end
+
+class X
+ #1alt1#type T: A[Int]
+ #1alt2#type T: A[Bool]
+ #1alt3#type T: B[Int]
+ #1alt4#type T: B[Bool]
+ #1alt5#type T: C
+ fun toto
+ do
+ var ai = new A[Int]
+ var ab = new A[Bool]
+ var bi = new B[Int]
+ var bb = new B[Bool]
+ var c = new C
+
+ var t: T = c.as(T)
+ #alt1#if maybe then t = ai
+ #alt2#if maybe then t = ab
+ #alt3#if maybe then t = bi
+ #alt4#if maybe then t = bb
+ #alt5#if maybe then t = c
+ #alt6#if maybe then ai = t
+ #alt7#if maybe then ab = t
+ #alt8#if maybe then bi = t
+ #alt9#if maybe then bb = t
+ #alt10#if maybe then c = t
+ end
+end
+
+fun maybe: Bool do return true
+
--- /dev/null
+./base_upcast2.nit:26,10: Type error: class T not found in module base_upcast2.
+./base_upcast2.nit:26,19: Type error: class T not found in module base_upcast2.
--- /dev/null
+alt/base_upcast2_1alt1_alt10.nit:36,21: Type error: expected C, got T
--- /dev/null
+alt/base_upcast2_1alt1_alt2.nit:28,21--22: Type error: expected T, got A[Bool]
--- /dev/null
+alt/base_upcast2_1alt1_alt7.nit:33,22: Type error: expected A[Bool], got T
--- /dev/null
+alt/base_upcast2_1alt1_alt8.nit:34,22: Type error: expected B[Int], got T
--- /dev/null
+alt/base_upcast2_1alt1_alt9.nit:35,22: Type error: expected B[Bool], got T
--- /dev/null
+alt/base_upcast2_1alt2_alt1.nit:27,21--22: Type error: expected T, got A[Int]
--- /dev/null
+alt/base_upcast2_1alt2_alt10.nit:36,21: Type error: expected C, got T
--- /dev/null
+alt/base_upcast2_1alt2_alt3.nit:29,21--22: Type error: expected T, got B[Int]
--- /dev/null
+alt/base_upcast2_1alt2_alt4.nit:30,21--22: Type error: expected T, got B[Bool]
--- /dev/null
+alt/base_upcast2_1alt2_alt5.nit:31,21: Type error: expected T, got C
--- /dev/null
+alt/base_upcast2_1alt2_alt6.nit:32,22: Type error: expected A[Int], got T
--- /dev/null
+alt/base_upcast2_1alt2_alt8.nit:34,22: Type error: expected B[Int], got T
--- /dev/null
+alt/base_upcast2_1alt2_alt9.nit:35,22: Type error: expected B[Bool], got T
--- /dev/null
+alt/base_upcast2_1alt3_alt1.nit:27,21--22: Type error: expected T, got A[Int]
--- /dev/null
+alt/base_upcast2_1alt3_alt10.nit:36,21: Type error: expected C, got T
--- /dev/null
+alt/base_upcast2_1alt3_alt2.nit:28,21--22: Type error: expected T, got A[Bool]
--- /dev/null
+alt/base_upcast2_1alt3_alt4.nit:30,21--22: Type error: expected T, got B[Bool]
--- /dev/null
+alt/base_upcast2_1alt3_alt5.nit:31,21: Type error: expected T, got C
--- /dev/null
+alt/base_upcast2_1alt3_alt7.nit:33,22: Type error: expected A[Bool], got T
--- /dev/null
+alt/base_upcast2_1alt3_alt9.nit:35,22: Type error: expected B[Bool], got T
--- /dev/null
+alt/base_upcast2_1alt4_alt1.nit:27,21--22: Type error: expected T, got A[Int]
--- /dev/null
+alt/base_upcast2_1alt4_alt10.nit:36,21: Type error: expected C, got T
--- /dev/null
+alt/base_upcast2_1alt4_alt2.nit:28,21--22: Type error: expected T, got A[Bool]
--- /dev/null
+alt/base_upcast2_1alt4_alt3.nit:29,21--22: Type error: expected T, got B[Int]
--- /dev/null
+alt/base_upcast2_1alt4_alt7.nit:33,22: Type error: expected A[Bool], got T
--- /dev/null
+alt/base_upcast2_1alt4_alt8.nit:34,22: Type error: expected B[Int], got T
--- /dev/null
+alt/base_upcast2_1alt5_alt1.nit:27,21--22: Type error: expected T, got A[Int]
--- /dev/null
+alt/base_upcast2_1alt5_alt2.nit:28,21--22: Type error: expected T, got A[Bool]
--- /dev/null
+alt/base_upcast2_1alt5_alt3.nit:29,21--22: Type error: expected T, got B[Int]
--- /dev/null
+alt/base_upcast2_1alt5_alt4.nit:30,21--22: Type error: expected T, got B[Bool]
--- /dev/null
+alt/base_upcast2_1alt5_alt7.nit:33,22: Type error: expected A[Bool], got T
--- /dev/null
+alt/base_upcast2_1alt5_alt8.nit:34,22: Type error: expected B[Int], got T
--- /dev/null
+alt/base_upcast2_alt1.nit:26,10: Type error: class T not found in module base_upcast2_alt1.
+alt/base_upcast2_alt1.nit:26,19: Type error: class T not found in module base_upcast2_alt1.
--- /dev/null
+alt/base_upcast2_alt10.nit:26,10: Type error: class T not found in module base_upcast2_alt10.
+alt/base_upcast2_alt10.nit:26,19: Type error: class T not found in module base_upcast2_alt10.
--- /dev/null
+alt/base_upcast2_alt2.nit:26,10: Type error: class T not found in module base_upcast2_alt2.
+alt/base_upcast2_alt2.nit:26,19: Type error: class T not found in module base_upcast2_alt2.
--- /dev/null
+alt/base_upcast2_alt3.nit:26,10: Type error: class T not found in module base_upcast2_alt3.
+alt/base_upcast2_alt3.nit:26,19: Type error: class T not found in module base_upcast2_alt3.
--- /dev/null
+alt/base_upcast2_alt4.nit:26,10: Type error: class T not found in module base_upcast2_alt4.
+alt/base_upcast2_alt4.nit:26,19: Type error: class T not found in module base_upcast2_alt4.
--- /dev/null
+alt/base_upcast2_alt5.nit:26,10: Type error: class T not found in module base_upcast2_alt5.
+alt/base_upcast2_alt5.nit:26,19: Type error: class T not found in module base_upcast2_alt5.
--- /dev/null
+alt/base_upcast2_alt6.nit:26,10: Type error: class T not found in module base_upcast2_alt6.
+alt/base_upcast2_alt6.nit:26,19: Type error: class T not found in module base_upcast2_alt6.
--- /dev/null
+alt/base_upcast2_alt7.nit:26,10: Type error: class T not found in module base_upcast2_alt7.
+alt/base_upcast2_alt7.nit:26,19: Type error: class T not found in module base_upcast2_alt7.
--- /dev/null
+alt/base_upcast2_alt8.nit:26,10: Type error: class T not found in module base_upcast2_alt8.
+alt/base_upcast2_alt8.nit:26,19: Type error: class T not found in module base_upcast2_alt8.
--- /dev/null
+alt/base_upcast2_alt9.nit:26,10: Type error: class T not found in module base_upcast2_alt9.
+alt/base_upcast2_alt9.nit:26,19: Type error: class T not found in module base_upcast2_alt9.
--- /dev/null
+alt/base_upcast_alt1.nit:26,20--21: Type error: expected A[Int], got A[Bool]
+alt/base_upcast_alt1.nit:28,20--21: Type error: expected A[Int], got B[Bool]
+alt/base_upcast_alt1.nit:33,20--21: Type error: expected A[Bool], got A[Int]
+alt/base_upcast_alt1.nit:35,20--21: Type error: expected A[Bool], got B[Int]
+alt/base_upcast_alt1.nit:37,20--21: Type error: expected A[Bool], got C[Int]
+alt/base_upcast_alt1.nit:38,20--21: Type error: expected A[Bool], got C[Bool]
+alt/base_upcast_alt1.nit:39,20: Type error: expected A[Bool], got D
+alt/base_upcast_alt1.nit:41,20--21: Type error: expected B[Int], got A[Int]
+alt/base_upcast_alt1.nit:42,20--21: Type error: expected B[Int], got A[Bool]
+alt/base_upcast_alt1.nit:44,20--21: Type error: expected B[Int], got B[Bool]
+alt/base_upcast_alt1.nit:49,20--21: Type error: expected B[Bool], got A[Int]
+alt/base_upcast_alt1.nit:50,20--21: Type error: expected B[Bool], got A[Bool]
+alt/base_upcast_alt1.nit:51,20--21: Type error: expected B[Bool], got B[Int]
+alt/base_upcast_alt1.nit:53,20--21: Type error: expected B[Bool], got C[Int]
+alt/base_upcast_alt1.nit:54,20--21: Type error: expected B[Bool], got C[Bool]
+alt/base_upcast_alt1.nit:55,20: Type error: expected B[Bool], got D
+alt/base_upcast_alt1.nit:57,20--21: Type error: expected C[Bool], got A[Int]
+alt/base_upcast_alt1.nit:58,20--21: Type error: expected C[Int], got A[Bool]
+alt/base_upcast_alt1.nit:59,20--21: Type error: expected C[Int], got B[Int]
+alt/base_upcast_alt1.nit:60,20--21: Type error: expected C[Int], got B[Bool]
+alt/base_upcast_alt1.nit:62,20--21: Type error: expected C[Int], got C[Bool]
+alt/base_upcast_alt1.nit:63,20: Type error: expected C[Int], got D
+alt/base_upcast_alt1.nit:65,20--21: Type error: expected C[Bool], got A[Int]
+alt/base_upcast_alt1.nit:66,20--21: Type error: expected C[Bool], got A[Bool]
+alt/base_upcast_alt1.nit:67,20--21: Type error: expected C[Bool], got B[Int]
+alt/base_upcast_alt1.nit:68,20--21: Type error: expected C[Bool], got B[Bool]
+alt/base_upcast_alt1.nit:69,20--21: Type error: expected C[Bool], got C[Int]
+alt/base_upcast_alt1.nit:73,19--20: Type error: expected D, got A[Int]
+alt/base_upcast_alt1.nit:74,19--20: Type error: expected D, got A[Bool]
+alt/base_upcast_alt1.nit:75,19--20: Type error: expected D, got B[Int]
+alt/base_upcast_alt1.nit:76,19--20: Type error: expected D, got B[Bool]
+alt/base_upcast_alt1.nit:77,19--20: Type error: expected D, got C[Int]
+alt/base_upcast_alt1.nit:78,19--20: Type error: expected D, got C[Bool]