--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A
+ var obj: nullable A
+
+ init(a: nullable A) do
+ self.obj = a
+ end
+
+ fun a1: Bool do
+ return self.obj.toto
+ end
+
+ fun toto: Bool do
+ return true
+ end
+end
+
+class B
+ super A
+
+ redef fun toto do
+ return false
+ end
+end
+
+var a = new A(null)
+var b = new B(a)
+var c = new B(b)
+
+assert b.a1
+assert not c.a1
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A
+end
+
+class B
+ super A
+end
+
+class C
+ super A
+end
+
+class D
+ super B
+ super C
+end
+
+class E
+ super D
+end
+
+class F
+ super D
+end
+
+class G
+ super F
+end
+
+
+var a = new A
+var b = new B
+var c = new C
+var d = new D
+var e = new E
+var f = new F
+var g = new G
+
+assert (g isa A) # true
+assert not (a isa G) # false
+assert (d isa B) # true
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A
+ fun foo: Bool do
+ return self isa A
+ end
+end
+
+class B
+ super A
+end
+
+var a = new A
+var b = new B
+
+assert a.foo # true
+assert b.foo # true
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A end
+
+class B
+ super A
+end
+
+class C
+ super A
+end
+
+class E
+ super A
+end
+
+class G
+ super A
+end
+
+class D
+ super C
+ super E
+end
+
+class F
+ super E
+ super G
+end
+
+var a = new A
+var b = new B
+var c = new C
+var d = new D
+var e = new E
+var f = new F
+var g = new G
+
+# A
+assert not a isa B
+
+# B
+assert b isa A
+assert b isa B
+assert not b isa C
+
+# C
+assert c isa A
+assert not c isa B
+assert c isa C
+
+# D
+assert d isa A
+assert not d isa B
+assert d isa C
+assert d isa D
+assert d isa E
+assert d isa E
+assert d isa E
+assert d isa E
+
+# E
+assert e isa A
+assert not e isa B
+assert e isa E
+
+# F
+assert f isa A
+assert f isa E
+assert f isa F
+assert f isa G
+assert not f isa D
+
+# G
+assert g isa A
+assert not g isa B
+assert g isa G
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A[T]
+ fun test(t: nullable Object): Bool do
+ return t isa T
+ end
+end
+
+var a = new A[nullable Object]
+assert a.test(true)
+assert a.test(null)
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A[E]
+
+ fun foo(obj: Object): Bool do
+ return obj isa A[E]
+ end
+
+ fun bar(obj: Object): Bool do
+ return obj isa A[nullable Object]
+ end
+end
+
+class B
+end
+
+var a = new A[Object]
+
+assert not a.foo(new B)
+assert a.foo(new A[Bool])
+
+true.output
+
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A end
+
+class B[T]
+ super A
+end
+
+class C
+ super A
+end
+
+class D[T, U]
+ super B[T]
+ super C
+end
+
+class E[T]
+ super D[T, Object]
+end
+
+class F
+ super D[Object, Object]
+end
+
+class G[T: Object]
+ super F
+end
+
+class H
+end
+
+
+
+
+var a = new A
+var b = new B[Object]
+var b2 = new B[H]
+var b3 = new B[F]
+var c = new C
+var d = new D[Object, Object]
+var e = new E[F]
+var f = new F
+var g = new G[Object]
+
+assert f isa A
+assert f isa C
+assert not f isa G[Object]
+assert g isa D[Object, Object]
+assert e isa D[Object, Object]
+assert e isa D[A, Object]
+assert not e isa D[H, Object]
+assert e isa D[F, Object]
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A[T] end
+
+class B[U]
+ super A[U]
+end
+
+class C[V]
+ super A[V]
+end
+
+class D[T, U]
+ super B[T]
+ super C[T]
+end
+
+var a = new A[Object]
+var b = new B[Object]
+var c = new C[Object]
+var d = new D[Object, Object]
+
+assert a isa A[Object] # true
+assert not a isa B[Object] # false
+assert b isa A[Object] # true
+assert b isa B[Object] # true
+assert not b isa C[Object] # false
+assert c isa A[Object] # true
+assert not c isa B[Object] # false
+assert c isa C[Object] # true
+assert not c isa D[Object, Object] # false
+assert d isa A[Object] # true
+assert d isa B[Object] # true
+assert d isa C[Object] # true
+assert d isa D[Object, Object] # false
+
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A[T]
+ fun foo(o: Object): Bool do return o isa Object
+end
+
+var a = new A[Object]
+
+assert a.foo(a) # true
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Animal end
+
+class Canard
+ super Animal
+end
+
+class A end
+
+class B[T]
+ super A
+end
+
+var b1 = new B[Canard]
+var b2 = new B[B[Canard]]
+
+assert b1 isa A # true
+assert b1 isa B[Canard] # true
+assert b1 isa B[Animal] # true
+assert not b1 isa B[Bool] # false
+
+assert not b2 isa B[Bool] # false
+assert b2 isa B[B[Canard]] # true
+assert not b2 isa B[B[Bool]] # false
+assert b2 isa B[B[Animal]] # true
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Animal end
+
+class Canard
+ super Animal
+end
+
+class A
+end
+
+class B[T]
+ super A
+end
+
+class C[T]
+ super B[T]
+end
+
+var b1 = new B[Canard]
+var b2 = new B[B[Canard]]
+
+assert b1 isa A
+assert b1 isa B[Canard]
+assert b1 isa B[Animal]
+assert not b1 isa B[Bool]
+assert not b2 isa C[Animal]
+
+assert not b2 isa B[Bool]
+assert b2 isa B[B[Canard]]
+assert not b2 isa B[B[Bool]]
+assert b2 isa B[B[Animal]]
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Animal end
+
+class A[T]
+
+ fun foo(o: Object): Bool do
+ return o isa T
+ end
+end
+
+class B[U] super A[Animal] end
+
+var x = new Animal
+var a = new A[Object]
+var b = new B[Object]
+
+assert a.foo(x) # true
+
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Ferme[V]
+end
+
+class Animal end
+class Canard super Animal end
+
+class A[T, U]
+ fun foo(o: Object): Bool do
+ return o isa T
+ end
+
+ fun bar(o: Object): Bool do
+ return o isa U
+ end
+end
+
+class B[U]
+ super A[U, Object]
+end
+
+class C end
+
+var x = new Canard
+var y = new Ferme[Canard]
+
+var a = new A[Animal, C]
+var b = new B[Canard]
+var c = new B[Ferme[Canard]]
+
+assert a.foo(x) # true
+assert not a.bar(x) # false
+assert not a.foo(y) # false
+assert not a.bar(y) # false
+assert a.bar(new C) # true
+assert b.foo(x) # true
+assert b.bar(x) # true
+assert not b.foo(y) # false
+assert b.bar(y) # true
+assert b.bar(new C) # true
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class X end
+class Y end
+class Z end
+
+class A[T]
+ fun foo: B[T] do
+ return new B[T]
+ end
+end
+
+class B[U]
+end
+
+class C[V, W] end
+class D[T, U, V] end
+class E[T, U, V, W] end
+
+var ax = new A[X]
+var ay = new A[Y]
+var az = new A[Z]
+
+var b = ax.foo
+
+var cxx = new C[X, X]
+var cxy = new C[X, Y]
+var cxz = new C[X, Z]
+
+var d = new D[X, Y, Z]
+var e = new E[X, Y, Z, Bool]
+
+assert ax isa A[X]
+assert ay isa A[Y]
+assert az isa A[Z]
+
+assert b isa B[Object]
+
+assert cxx isa C[X, X]
+assert cxy isa C[X, Y]
+assert cxz isa C[X, Z]
+
+assert d isa D[X, Y, Z]
+assert e isa E[X, Y, Z, Bool]
+
+
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Discrete end
+
+class Integer
+ super Discrete
+end
+
+class A
+end
+
+class B[T]
+ super A
+end
+
+class C[T]
+ super B[T]
+end
+
+var b1 = new B[Integer]
+var b2 = new B[B[Integer]]
+
+assert b1 isa A
+assert b1 isa B[Integer]
+assert b1 isa B[Discrete]
+assert not b1 isa B[Bool]
+assert not b2 isa C[Discrete]
+
+assert not b2 isa B[Bool]
+assert b2 isa B[B[Integer]]
+assert not b2 isa B[B[Bool]]
+assert b2 isa B[B[Discrete]]
+
+assert b1 isa B[nullable Discrete]
+assert not b2 isa B[nullable Discrete]
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A end
+class B[T] end
+class C[T] end
+
+var a = new A
+var b = new B[Object]
+var c = new C[nullable Object]
+
+assert a isa nullable A # true
+
+assert b isa nullable B[Object] # true
+assert b isa nullable B[nullable Object] # true
+
+assert not c isa C[Object] # false
+assert c isa C[nullable Object] # true
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Something end
+
+class A[T]
+ type U: Object
+
+ fun test(t: nullable T): Bool do
+ return t isa U
+ end
+end
+
+class B[T]
+ super A[T]
+
+ redef type U: Bool
+end
+
+class C[T]
+ super A[T]
+
+ redef type U: nullable Bool
+end
+
+var a = new A[Object]
+assert a.test(true)
+assert not a.test(null)
+
+a = new A[Bool]
+assert a.test(true)
+assert not a.test(null)
+
+var b = new B[Object]
+assert not b.test(new Something)
+assert b.test(false)
+assert not b.test(null)
+
+var c = new C[Object]
+assert not c.test(new Something)
+assert c.test(false)
+assert c.test(null)
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Something end
+
+class A[T]
+ type U: nullable Object
+
+ fun test(t: nullable T): Bool do
+ return t isa U
+ end
+end
+
+class B[T]
+ super A[T]
+
+ redef type U: Bool
+end
+
+class C[T]
+ super A[T]
+
+ redef type U: nullable Bool
+end
+
+var a = new A[Object]
+assert a.test(true)
+assert a.test(null)
+
+a = new A[Bool]
+assert a.test(true)
+assert a.test(null)
+
+var b = new B[Object]
+assert not b.test(new Something)
+assert b.test(false)
+assert not b.test(null)
+
+var c = new C[Object]
+assert not c.test(new Something)
+assert c.test(false)
+assert c.test(null)
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A
+ type T: Object
+
+ fun foo(o: Object): Bool do
+ return o isa T
+ end
+end
+
+class B
+ super A
+ redef type T: B
+ type U: Bool
+
+ fun bar(o: Object): Bool do
+ return o isa U
+ end
+end
+
+class C
+ super B
+ redef type T: C
+end
+
+var a = new A
+assert a.foo(new A)
+
+var b = new B
+assert not b.foo(new A)
+assert b.foo(new B)
+assert b.foo(new C)
+assert not b.bar(new B)
+assert b.bar(true)
+
+var c = new C
+assert not c.foo(new A)
+assert not c.foo(new B)
+assert c.foo(new C)
+assert not c.bar(new B)
+assert c.bar(true)
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import end
+
+interface Object
+end
+
+enum Bool
+ fun output is intern
+end
+
+class A[X]
+ type T: Object
+
+ fun foo(o: Object): Bool do
+ return o isa T
+ end
+end
+
+class B[X]
+ super A[X]
+ redef type T: X
+ type U: Bool
+
+ fun bar(o: Object): Bool do
+ return o isa U
+ end
+end
+
+class C[X, Y]
+ super B[X]
+ redef type T: Y
+end
+
+var a = new A[Object]
+assert a.foo(new A[Object])
+
+var b = new B[A[Object]]
+assert b.foo(new A[Object])
+assert b.foo(new B[Object])
+assert not b.foo(true)
+assert not b.bar(new B[Object])
+assert b.bar(true)
+
+var c = new C[Object, B[Object]]
+assert not c.foo(new A[Object])
+assert c.foo(new B[Object])
+assert c.foo(new C[Object, B[Object]])
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class Int end
+class String end
+
+class Triple[X, Y, Z]
+end
+
+class A[T, U]
+ type V: Object
+
+ fun foo: Triple[T, U, V] do
+ var triple = new Triple[T, U, V]
+ assert triple isa Triple[T, U, V] # true
+ return triple
+ end
+
+ fun bar(e: T) do
+ assert e isa V
+ end
+end
+
+class B[E] super A[E, E]
+ redef type V: E
+end
+
+class C[E] super A[E, E]
+ redef type V: B[E]
+end
+
+class D[E] super A[E, E]
+ type W: E
+ redef type V: W
+end
+
+
+var a = new A[String, Int]
+assert a.foo isa Triple[String, Int, Object]
+
+var b = new B[String]
+assert b.foo isa Triple[String, String, String]
+
+var c = new C[String]
+assert c.foo isa Triple[String, String, B[String]]
+
+var d = new D[String]
+assert d.foo isa Triple[String, String, String]
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A[X]
+ type T: Object
+
+ fun foo(o: Object): Bool do
+ return o isa T
+ end
+end
+
+class B[X]
+ super A[X]
+ redef type T: B[Object]
+ type U: Bool
+
+ fun bar(o: Object): Bool do
+ return o isa U
+ end
+end
+
+class C[X]
+ super B[X]
+ redef type T: C[Object]
+end
+
+var a = new A[Object]
+assert a.foo(new A[Object])
+
+var b = new B[Object]
+assert not b.foo(new A[Object])
+assert b.foo(new B[Object])
+assert b.foo(new C[Object])
+assert not b.bar(new B[Object])
+assert b.bar(true)
+
+var c = new C[Object]
+assert not c.foo(new A[Object])
+assert not c.foo(new B[Object])
+assert c.foo(new C[Object])
+assert not c.bar(new B[Object])
+assert c.bar(true)
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_minimal
+
+class A[X]
+ type T: Object
+
+ fun foo(o: Object): Bool do
+ return o isa T
+ end
+end
+
+class B[X]
+ super A[X]
+ redef type T: B[X]
+end
+
+class C[X]
+ super B[X]
+ redef type T: C[B[X]]
+end
+
+var a = new A[Object]
+assert a.foo(new A[Object])
+
+var b = new B[Object]
+assert not b.foo(new A[Object])
+assert b.foo(new B[Object])
+assert b.foo(new C[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[B[Object]])
+assert c.foo(new C[B[Bool]])
+
+true.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2012 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import end
+
+interface Object
+end
+
+enum Bool
+ fun output is intern
+end
+
+true.output
--- /dev/null
+base_isa1.nit:56,9--15: Warning: Expression is already a A since it is a G.
+base_isa1.nit:56,8--16: Warning: superfluous parentheses.
+base_isa1.nit:58,9--15: Warning: Expression is already a B since it is a D.
+base_isa1.nit:58,8--16: Warning: superfluous parentheses.
+true
--- /dev/null
+base_isa2.nit:21,10--19: Warning: Expression is already a A.
+true
--- /dev/null
+base_isa3.nit:59,8--14: Warning: Expression is already a A since it is a B.
+base_isa3.nit:64,8--14: Warning: Expression is already a A since it is a C.
+base_isa3.nit:69,8--14: Warning: Expression is already a A since it is a D.
+base_isa3.nit:73,8--14: Warning: Expression is already a E since it is a D.
+base_isa3.nit:74,8--14: Warning: Expression is already a E.
+base_isa3.nit:75,8--14: Warning: Expression is already a E.
+base_isa3.nit:76,8--14: Warning: Expression is already a E.
+base_isa3.nit:79,8--14: Warning: Expression is already a A since it is a E.
+base_isa3.nit:84,8--14: Warning: Expression is already a A since it is a F.
+base_isa3.nit:87,8--14: Warning: Expression is already a G since it is a F.
+base_isa3.nit:91,8--14: Warning: Expression is already a A since it is a G.
+true
--- /dev/null
+base_isa_gen1.nit:62,8--14: Warning: Expression is already a A since it is a F.
+base_isa_gen1.nit:65,8--29: Warning: Expression is already a D[Object, Object] since it is a G[Object].
+base_isa_gen1.nit:66,8--29: Warning: Expression is already a D[Object, Object] since it is a E[F].
+true
--- /dev/null
+base_isa_gen2.nit:39,8--21: Warning: Expression is already a A[Object].
+base_isa_gen2.nit:41,8--21: Warning: Expression is already a A[Object] since it is a B[Object].
+base_isa_gen2.nit:44,8--21: Warning: Expression is already a A[Object] since it is a C[Object].
+base_isa_gen2.nit:48,8--21: Warning: Expression is already a A[Object] since it is a D[Object, Object].
+true
--- /dev/null
+base_isa_gen3.nit:20,37--48: Warning: Expression is already a Object.
+true
--- /dev/null
+base_isa_gen4.nit:34,8--15: Warning: Expression is already a A since it is a B[Canard].
+base_isa_gen4.nit:36,8--22: Warning: Expression is already a B[Animal] since it is a B[Canard].
+base_isa_gen4.nit:40,8--24: Warning: Expression is already a B[B[Canard]].
+base_isa_gen4.nit:42,8--24: Warning: Expression is already a B[B[Animal]] since it is a B[B[Canard]].
+true
--- /dev/null
+base_isa_gen5.nit:39,8--15: Warning: Expression is already a A since it is a B[Canard].
+base_isa_gen5.nit:41,8--22: Warning: Expression is already a B[Animal] since it is a B[Canard].
+base_isa_gen5.nit:46,8--24: Warning: Expression is already a B[B[Canard]].
+base_isa_gen5.nit:48,8--24: Warning: Expression is already a B[B[Animal]] since it is a B[B[Canard]].
+true
--- /dev/null
+base_isa_gen8.nit:49,8--17: Warning: Expression is already a A[X].
+base_isa_gen8.nit:50,8--17: Warning: Expression is already a A[Y].
+base_isa_gen8.nit:51,8--17: Warning: Expression is already a A[Z].
+base_isa_gen8.nit:53,8--21: Warning: Expression is already a B[Object] since it is a B[X].
+base_isa_gen8.nit:55,8--21: Warning: Expression is already a C[X, X].
+base_isa_gen8.nit:56,8--21: Warning: Expression is already a C[X, Y].
+base_isa_gen8.nit:57,8--21: Warning: Expression is already a C[X, Z].
+base_isa_gen8.nit:59,8--22: Warning: Expression is already a D[X, Y, Z].
+base_isa_gen8.nit:60,8--28: Warning: Expression is already a E[X, Y, Z, Bool].
+true
--- /dev/null
+base_isa_nullable1.nit:39,8--15: Warning: Expression is already a A since it is a B[Integer].
+base_isa_nullable1.nit:41,8--24: Warning: Expression is already a B[Discrete] since it is a B[Integer].
+base_isa_nullable1.nit:46,8--25: Warning: Expression is already a B[B[Integer]].
+base_isa_nullable1.nit:48,8--26: Warning: Expression is already a B[B[Discrete]] since it is a B[B[Integer]].
+base_isa_nullable1.nit:50,8--33: Warning: Expression is already a B[nullable Discrete] since it is a B[Discrete].
+true
--- /dev/null
+base_isa_nullable2.nit:27,8--23: Warning: Expression is already a nullable A since it is a A.
+base_isa_nullable2.nit:29,8--30: Warning: Expression is already a nullable B[Object] since it is a B[Object].
+base_isa_nullable2.nit:30,8--39: Warning: Expression is already a nullable B[nullable Object] since it is a nullable B[Object].
+base_isa_nullable2.nit:33,8--30: Warning: Expression is already a C[nullable Object].
+true
--- /dev/null
+base_isa_nullable_vt.nit:38,16--28: Redef error: Expected Object, as in A::U.
--- /dev/null
+base_isa_vt_gen1.nit:30,10--34: Warning: Expression is already a Triple[T, U, V].
+base_isa_vt_gen1.nit:54,8--43: Warning: Expression is already a Triple[String, Int, Object] since it is a Triple[String, Int, V].
+base_isa_vt_gen1.nit:57,8--46: Warning: Expression is already a Triple[String, String, String] since it is a Triple[String, String, V].
+base_isa_vt_gen1.nit:60,8--48: Warning: Expression is already a Triple[String, String, B[String]] since it is a Triple[String, String, V].
+base_isa_vt_gen1.nit:63,8--46: Warning: Expression is already a Triple[String, String, String] since it is a Triple[String, String, V].
+true
--- /dev/null
+base_isa_gen1.nit:62,8--14: Warning: Expression is already a A since it is a F.
+base_isa_gen1.nit:65,8--29: Warning: Expression is already a D[Object, Object] since it is a G[Object].
+base_isa_gen1.nit:66,8--29: Warning: Expression is already a D[Object, Object] since it is a E[F].
+Runtime error: Assert failed (base_isa_gen1.nit:68)
--- /dev/null
+base_isa_gen4.nit:34,8--15: Warning: Expression is already a A since it is a B[Canard].
+base_isa_gen4.nit:36,8--22: Warning: Expression is already a B[Animal] since it is a B[Canard].
+base_isa_gen4.nit:40,8--24: Warning: Expression is already a B[B[Canard]].
+base_isa_gen4.nit:42,8--24: Warning: Expression is already a B[B[Animal]] since it is a B[B[Canard]].
+Runtime error: Assert failed (base_isa_gen4.nit:37)
--- /dev/null
+base_isa_gen5.nit:39,8--15: Warning: Expression is already a A since it is a B[Canard].
+base_isa_gen5.nit:41,8--22: Warning: Expression is already a B[Animal] since it is a B[Canard].
+base_isa_gen5.nit:46,8--24: Warning: Expression is already a B[B[Canard]].
+base_isa_gen5.nit:48,8--24: Warning: Expression is already a B[B[Animal]] since it is a B[B[Canard]].
+Runtime error: Assert failed (base_isa_gen5.nit:42)
--- /dev/null
+Runtime error: Assert failed (base_isa_gen7.nit:49)
--- /dev/null
+base_isa_nullable1.nit:39,8--15: Warning: Expression is already a A since it is a B[Integer].
+base_isa_nullable1.nit:41,8--24: Warning: Expression is already a B[Discrete] since it is a B[Integer].
+base_isa_nullable1.nit:46,8--25: Warning: Expression is already a B[B[Integer]].
+base_isa_nullable1.nit:48,8--26: Warning: Expression is already a B[B[Discrete]] since it is a B[B[Integer]].
+base_isa_nullable1.nit:50,8--33: Warning: Expression is already a B[nullable Discrete] since it is a B[Discrete].
+Runtime error: Assert failed (base_isa_nullable1.nit:42)
--- /dev/null
+base_isa_nullable2.nit:27,8--23: Warning: Expression is already a nullable A since it is a A.
+base_isa_nullable2.nit:29,8--30: Warning: Expression is already a nullable B[Object] since it is a B[Object].
+base_isa_nullable2.nit:30,8--39: Warning: Expression is already a nullable B[nullable Object] since it is a nullable B[Object].
+base_isa_nullable2.nit:33,8--30: Warning: Expression is already a C[nullable Object].
+Runtime error: Assert failed (base_isa_nullable2.nit:32)
--- /dev/null
+Runtime error: Assert failed (base_isa_nullable_vt2.nit:52)
--- /dev/null
+Runtime error: Assert failed (base_isa_vt_ft.nit:55)
--- /dev/null
+Runtime error: Assert failed (base_isa_vt_gen2.nit:48)
--- /dev/null
+Runtime error: Assert failed (base_isa_vt_gen3.nit:48)
--- /dev/null
+base_isa1.nit:56,9--15: Warning: Expression is already a A since it is a G.
+base_isa1.nit:58,9--15: Warning: Expression is already a B since it is a D.
+true
--- /dev/null
+base_isa_gen1.nit:62,8--14: Warning: Expression is already a A since it is a F.
+base_isa_gen1.nit:65,8--29: Warning: Expression is already a D[Object, Object] since it is a G[Object].
+base_isa_gen1.nit:66,8--29: Warning: Expression is already a D[Object, Object] since it is a E[F].
+Runtime error: Assert failed (base_isa_gen1.nit:68)
--- /dev/null
+base_isa_gen4.nit:34,8--15: Warning: Expression is already a A since it is a B[Canard].
+base_isa_gen4.nit:36,8--22: Warning: Expression is already a B[Animal] since it is a B[Canard].
+base_isa_gen4.nit:40,8--24: Warning: Expression is already a B[B[Canard]].
+base_isa_gen4.nit:42,8--24: Warning: Expression is already a B[B[Animal]] since it is a B[B[Canard]].
+Runtime error: Assert failed (base_isa_gen4.nit:37)
--- /dev/null
+base_isa_gen5.nit:39,8--15: Warning: Expression is already a A since it is a B[Canard].
+base_isa_gen5.nit:41,8--22: Warning: Expression is already a B[Animal] since it is a B[Canard].
+base_isa_gen5.nit:46,8--24: Warning: Expression is already a B[B[Canard]].
+base_isa_gen5.nit:48,8--24: Warning: Expression is already a B[B[Animal]] since it is a B[B[Canard]].
+Runtime error: Assert failed (base_isa_gen5.nit:42)
--- /dev/null
+Runtime error: Assert failed (base_isa_gen7.nit:49)
--- /dev/null
+base_isa_nullable1.nit:39,8--15: Warning: Expression is already a A since it is a B[Integer].
+base_isa_nullable1.nit:41,8--24: Warning: Expression is already a B[Discrete] since it is a B[Integer].
+base_isa_nullable1.nit:46,8--25: Warning: Expression is already a B[B[Integer]].
+base_isa_nullable1.nit:48,8--26: Warning: Expression is already a B[B[Discrete]] since it is a B[B[Integer]].
+base_isa_nullable1.nit:50,8--33: Warning: Expression is already a B[nullable Discrete] since it is a B[Discrete].
+Runtime error: Assert failed (base_isa_nullable1.nit:42)
--- /dev/null
+base_isa_nullable2.nit:27,8--23: Warning: Expression is already a nullable A since it is a A.
+base_isa_nullable2.nit:29,8--30: Warning: Expression is already a nullable B[Object] since it is a B[Object].
+base_isa_nullable2.nit:30,8--39: Warning: Expression is already a nullable B[nullable Object] since it is a nullable B[Object].
+base_isa_nullable2.nit:33,8--30: Warning: Expression is already a C[nullable Object].
+Runtime error: Assert failed (base_isa_nullable2.nit:32)
--- /dev/null
+base_isa1.nit:56,9--15: Warning: Expression is already a A since it is a G.
+base_isa1.nit:58,9--15: Warning: Expression is already a B since it is a D.
+true
--- /dev/null
+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: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].
+true
--- /dev/null
+base_isa1.nit:56,9--15: Warning: Expression is already a A since it is a G.
+base_isa1.nit:58,9--15: Warning: Expression is already a B since it is a D.
+true
--- /dev/null
+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: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].
+true
--- /dev/null
+base_isa1.nit:56,9--15: Warning: Expression is already a A since it is a G.
+base_isa1.nit:58,9--15: Warning: Expression is already a B since it is a D.
+true
--- /dev/null
+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: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].
+true