import kernel
class A[T]
- type U: Object
+ type U: nullable Object
fun testT(o: Object): Bool do return o isa T
fun testU(o: Object): Bool do return o isa U
end
class A[X]
- type T: Object
+ type T: nullable Object
fun foo(o: Object): Bool do
return o isa T
class C[X, Y]
super B[X]
- redef type T: Y
+ redef type T: X
end
var a = new A[Object]
assert b.bar(true)
var c = new C[Object, B[Object]]
-assert not c.foo(new A[Object])
+assert c.foo(new A[Object])
assert c.foo(new B[Object])
assert c.foo(new C[Object, B[Object]])
end
class A[T, U]
- type V: Object
+ type V: nullable Object
fun foo: Triple[T, U, V] do
var triple = new Triple[T, U, V]
var a = new A[String, Int]
-assert a.foo isa Triple[String, Int, Object]
+assert a.foo isa Triple[String, Int, nullable Object]
var b = new B[String]
assert b.foo isa Triple[String, String, String]
import base_minimal
class A[X]
- type T: Object
+ type T: nullable Object
fun foo(o: Object): Bool do
return o isa T
class C[X]
super B[X]
- redef type T: C[B[X]]
+ redef type T: C[X]
end
var a = new A[Object]
var c = new C[Object]
assert not c.foo(new A[Object])
assert not c.foo(new B[Object])
-assert not c.foo(new C[Object])
+assert c.foo(new C[Object])
assert c.foo(new C[B[Object]])
assert c.foo(new C[B[Bool]])
import kernel
interface Number
- type OTHER: Number
+ type OTHE: Number
+ type OTHE2: Int
end
redef class Int
super Number
- redef type OTHER: Int
+ redef type OTHE: Int
+ #alt1#redef type OTHE2: Number
end
base_isa_vt_gen1.nit:30,10--34: Warning: Expression is already a Triple[A#0, A#1, V].
-base_isa_vt_gen1.nit:54,8--43: Warning: Expression is already a Triple[String, Int, Object].
+base_isa_vt_gen1.nit:54,8--52: Warning: Expression is already a Triple[String, Int, nullable Object].
base_isa_vt_gen1.nit:57,8--46: Warning: Expression is already a Triple[String, String, String].
base_isa_vt_gen1.nit:60,8--48: Warning: Expression is already a Triple[String, String, B[String]].
base_isa_vt_gen1.nit:63,8--46: Warning: Expression is already a Triple[String, String, String].
+base_virtual_type4.nit:20,16: Redef Error: a virtual type cannot be refined.
1
+alt/base_virtual_type4_alt1.nit:20,16: Redef Error: a virtual type cannot be refined.
alt/base_virtual_type4_alt1.nit:24,7--11: Type error: expected nullable U, got T
-base_virtual_type_redef.nit:24,13--17: Ambigous property name 'OTHER' for Int; conflict between standard::kernel::Comparable::OTHER and base_virtual_type_redef::Number::OTHER
--- /dev/null
+alt/base_virtual_type_redef_alt1.nit:26,20--25: Redef Error: Wrong bound type. Found Number, expected a subtype of Int, as in base_virtual_type_redef_alt1#Number#OTHE2.
+++ /dev/null
-Runtime error: Assert failed (base_isa_vt_gen3.nit:48)