X-Git-Url: http://nitlanguage.org diff --git a/tests/test_variance_param.nit b/tests/test_variance_param.nit index 679fa68..47b6ec1 100644 --- a/tests/test_variance_param.nit +++ b/tests/test_variance_param.nit @@ -17,38 +17,48 @@ class A type T: A type U: B - fun foo(a: T) do a.output - fun bar(b: U) do b.output - fun baz(i: Int) do i.output - redef fun output do 'A'.output + fun foo(a: T) do a.out + fun bar(b: U) do b.out + fun baz(i: C) do i.out + fun out do 'A'.output init do end end class B -special A + super A redef type T: B - redef type U: Int - redef fun foo(a: T) do a.output - redef fun bar(b: U) do b.output - redef fun baz(i: Int) do i.output - redef fun output do 'B'.output + redef type U: C + redef fun foo(a: T) do a.out + redef fun bar(b: U) do b.out + redef fun baz(i: C) do i.out + redef fun out do 'B'.output init do end end -redef class Int -special B - redef type T: Int - redef fun foo(a: T) do a.output - redef fun bar(b: U) do b.output - redef fun output is intern +class C + super B + redef type T: C + redef fun foo(a: T) do a.out + redef fun bar(b: U) do b.out + redef fun output do i.output + redef fun out + do + var i: Object = self + if i isa C then + i.output + else + 'X'.output + end + end + var i: Int + init (i:Int) do self.i = i end - var a = new A var b = new B var ab: A = b -var i = 5 +var i = new C(5) var ai: A = i var bi: B = i