From ddc9df7d72887a9a2ae3fa2c899c33ba4afaa940 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Mon, 3 Dec 2012 22:02:50 -0500 Subject: [PATCH] tests: add some tests for covariant genericity. Signed-off-by: Alexandre Terrasa --- tests/base_call1.nit | 50 ++++++++++++ tests/base_isa1.nit | 60 ++++++++++++++ tests/base_isa2.nit | 35 +++++++++ tests/base_isa3.nit | 95 +++++++++++++++++++++++ tests/base_isa_ft.nit | 29 +++++++ tests/base_isa_ft2.nit | 39 ++++++++++ tests/base_isa_gen1.nit | 71 +++++++++++++++++ tests/base_isa_gen2.nit | 54 +++++++++++++ tests/base_isa_gen3.nit | 27 +++++++ tests/base_isa_gen4.nit | 44 +++++++++++ tests/base_isa_gen5.nit | 50 ++++++++++++ tests/base_isa_gen6.nit | 37 +++++++++ tests/base_isa_gen7.nit | 59 ++++++++++++++ tests/base_isa_gen8.nit | 64 +++++++++++++++ tests/base_isa_nullable1.nit | 53 +++++++++++++ tests/base_isa_nullable2.nit | 35 +++++++++ tests/base_isa_nullable_vt.nit | 59 ++++++++++++++ tests/base_isa_nullable_vt2.nit | 59 ++++++++++++++ tests/base_isa_vt_class.nit | 59 ++++++++++++++ tests/base_isa_vt_ft.nit | 64 +++++++++++++++ tests/base_isa_vt_gen1.nit | 65 ++++++++++++++++ tests/base_isa_vt_gen2.nit | 59 ++++++++++++++ tests/base_isa_vt_gen3.nit | 52 +++++++++++++ tests/base_minimal.nit | 26 +++++++ tests/sav/base_call1.sav | 1 + tests/sav/base_isa1.res | 5 ++ tests/sav/base_isa2.res | 2 + tests/sav/base_isa3.res | 12 +++ tests/sav/base_isa_ft.sav | 1 + tests/sav/base_isa_ft2.sav | 1 + tests/sav/base_isa_gen1.res | 4 + tests/sav/base_isa_gen2.res | 5 ++ tests/sav/base_isa_gen3.res | 2 + tests/sav/base_isa_gen4.res | 5 ++ tests/sav/base_isa_gen5.res | 5 ++ tests/sav/base_isa_gen6.res | 1 + tests/sav/base_isa_gen7.res | 1 + tests/sav/base_isa_gen8.res | 10 +++ tests/sav/base_isa_nullable1.res | 6 ++ tests/sav/base_isa_nullable2.res | 5 ++ tests/sav/base_isa_nullable_vt.res | 1 + tests/sav/base_isa_nullable_vt2.res | 1 + tests/sav/base_isa_vt_class.res | 1 + tests/sav/base_isa_vt_ft.res | 1 + tests/sav/base_isa_vt_gen1.res | 6 ++ tests/sav/base_isa_vt_gen2.res | 1 + tests/sav/base_isa_vt_gen3.res | 1 + tests/sav/base_minimal.res | 1 + tests/sav/nitc/fixme/base_isa_gen1.res | 4 + tests/sav/nitc/fixme/base_isa_gen4.res | 5 ++ tests/sav/nitc/fixme/base_isa_gen5.res | 5 ++ tests/sav/nitc/fixme/base_isa_gen7.res | 1 + tests/sav/nitc/fixme/base_isa_nullable1.res | 6 ++ tests/sav/nitc/fixme/base_isa_nullable2.res | 5 ++ tests/sav/nitc/fixme/base_isa_nullable_vt2.res | 1 + tests/sav/nitc/fixme/base_isa_vt_ft.res | 1 + tests/sav/nitc/fixme/base_isa_vt_gen2.res | 1 + tests/sav/nitc/fixme/base_isa_vt_gen3.res | 1 + tests/sav/nitg-e/base_isa1.res | 3 + tests/sav/nitg-e/base_isa_gen1.res | 4 + tests/sav/nitg-e/base_isa_gen4.res | 5 ++ tests/sav/nitg-e/base_isa_gen5.res | 5 ++ tests/sav/nitg-e/base_isa_gen7.res | 1 + tests/sav/nitg-e/base_isa_nullable1.res | 6 ++ tests/sav/nitg-e/base_isa_nullable2.res | 5 ++ tests/sav/nitg-e/fixme/base_isa_nullable_vt.res | 1 + tests/sav/nitg-s/base_isa1.res | 3 + tests/sav/nitg-s/base_isa_vt_gen1.res | 6 ++ tests/sav/nitg-s/fixme/base_isa_nullable_vt.res | 1 + tests/sav/nitg/base_isa1.res | 3 + tests/sav/nitg/base_isa_gen1.sav | 1 + tests/sav/nitg/base_isa_vt_gen1.res | 6 ++ tests/sav/nitg/fixme/base_isa_nullable_vt.res | 1 + tests/sav/niti/base_isa1.res | 3 + tests/sav/niti/base_isa_vt_gen1.res | 6 ++ tests/sav/niti/fixme/base_isa_nullable_vt.res | 1 + 76 files changed, 1415 insertions(+) create mode 100644 tests/base_call1.nit create mode 100644 tests/base_isa1.nit create mode 100644 tests/base_isa2.nit create mode 100644 tests/base_isa3.nit create mode 100644 tests/base_isa_ft.nit create mode 100644 tests/base_isa_ft2.nit create mode 100644 tests/base_isa_gen1.nit create mode 100644 tests/base_isa_gen2.nit create mode 100644 tests/base_isa_gen3.nit create mode 100644 tests/base_isa_gen4.nit create mode 100644 tests/base_isa_gen5.nit create mode 100644 tests/base_isa_gen6.nit create mode 100644 tests/base_isa_gen7.nit create mode 100644 tests/base_isa_gen8.nit create mode 100644 tests/base_isa_nullable1.nit create mode 100644 tests/base_isa_nullable2.nit create mode 100644 tests/base_isa_nullable_vt.nit create mode 100644 tests/base_isa_nullable_vt2.nit create mode 100644 tests/base_isa_vt_class.nit create mode 100644 tests/base_isa_vt_ft.nit create mode 100644 tests/base_isa_vt_gen1.nit create mode 100644 tests/base_isa_vt_gen2.nit create mode 100644 tests/base_isa_vt_gen3.nit create mode 100644 tests/base_minimal.nit create mode 100644 tests/sav/base_call1.sav create mode 100644 tests/sav/base_isa1.res create mode 100644 tests/sav/base_isa2.res create mode 100644 tests/sav/base_isa3.res create mode 100644 tests/sav/base_isa_ft.sav create mode 100644 tests/sav/base_isa_ft2.sav create mode 100644 tests/sav/base_isa_gen1.res create mode 100644 tests/sav/base_isa_gen2.res create mode 100644 tests/sav/base_isa_gen3.res create mode 100644 tests/sav/base_isa_gen4.res create mode 100644 tests/sav/base_isa_gen5.res create mode 100644 tests/sav/base_isa_gen6.res create mode 100644 tests/sav/base_isa_gen7.res create mode 100644 tests/sav/base_isa_gen8.res create mode 100644 tests/sav/base_isa_nullable1.res create mode 100644 tests/sav/base_isa_nullable2.res create mode 100644 tests/sav/base_isa_nullable_vt.res create mode 100644 tests/sav/base_isa_nullable_vt2.res create mode 100644 tests/sav/base_isa_vt_class.res create mode 100644 tests/sav/base_isa_vt_ft.res create mode 100644 tests/sav/base_isa_vt_gen1.res create mode 100644 tests/sav/base_isa_vt_gen2.res create mode 100644 tests/sav/base_isa_vt_gen3.res create mode 100644 tests/sav/base_minimal.res create mode 100644 tests/sav/nitc/fixme/base_isa_gen1.res create mode 100644 tests/sav/nitc/fixme/base_isa_gen4.res create mode 100644 tests/sav/nitc/fixme/base_isa_gen5.res create mode 100644 tests/sav/nitc/fixme/base_isa_gen7.res create mode 100644 tests/sav/nitc/fixme/base_isa_nullable1.res create mode 100644 tests/sav/nitc/fixme/base_isa_nullable2.res create mode 100644 tests/sav/nitc/fixme/base_isa_nullable_vt2.res create mode 100644 tests/sav/nitc/fixme/base_isa_vt_ft.res create mode 100644 tests/sav/nitc/fixme/base_isa_vt_gen2.res create mode 100644 tests/sav/nitc/fixme/base_isa_vt_gen3.res create mode 100644 tests/sav/nitg-e/base_isa1.res create mode 100644 tests/sav/nitg-e/base_isa_gen1.res create mode 100644 tests/sav/nitg-e/base_isa_gen4.res create mode 100644 tests/sav/nitg-e/base_isa_gen5.res create mode 100644 tests/sav/nitg-e/base_isa_gen7.res create mode 100644 tests/sav/nitg-e/base_isa_nullable1.res create mode 100644 tests/sav/nitg-e/base_isa_nullable2.res create mode 100644 tests/sav/nitg-e/fixme/base_isa_nullable_vt.res create mode 100644 tests/sav/nitg-s/base_isa1.res create mode 100644 tests/sav/nitg-s/base_isa_vt_gen1.res create mode 100644 tests/sav/nitg-s/fixme/base_isa_nullable_vt.res create mode 100644 tests/sav/nitg/base_isa1.res create mode 100644 tests/sav/nitg/base_isa_gen1.sav create mode 100644 tests/sav/nitg/base_isa_vt_gen1.res create mode 100644 tests/sav/nitg/fixme/base_isa_nullable_vt.res create mode 100644 tests/sav/niti/base_isa1.res create mode 100644 tests/sav/niti/base_isa_vt_gen1.res create mode 100644 tests/sav/niti/fixme/base_isa_nullable_vt.res diff --git a/tests/base_call1.nit b/tests/base_call1.nit new file mode 100644 index 0000000..7c07d6d --- /dev/null +++ b/tests/base_call1.nit @@ -0,0 +1,50 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa1.nit b/tests/base_isa1.nit new file mode 100644 index 0000000..6de6b46 --- /dev/null +++ b/tests/base_isa1.nit @@ -0,0 +1,60 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa2.nit b/tests/base_isa2.nit new file mode 100644 index 0000000..60941d0 --- /dev/null +++ b/tests/base_isa2.nit @@ -0,0 +1,35 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa3.nit b/tests/base_isa3.nit new file mode 100644 index 0000000..faf49f9 --- /dev/null +++ b/tests/base_isa3.nit @@ -0,0 +1,95 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_ft.nit b/tests/base_isa_ft.nit new file mode 100644 index 0000000..a263899 --- /dev/null +++ b/tests/base_isa_ft.nit @@ -0,0 +1,29 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_ft2.nit b/tests/base_isa_ft2.nit new file mode 100644 index 0000000..b6ba09b --- /dev/null +++ b/tests/base_isa_ft2.nit @@ -0,0 +1,39 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 + diff --git a/tests/base_isa_gen1.nit b/tests/base_isa_gen1.nit new file mode 100644 index 0000000..42bff1a --- /dev/null +++ b/tests/base_isa_gen1.nit @@ -0,0 +1,71 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_gen2.nit b/tests/base_isa_gen2.nit new file mode 100644 index 0000000..4804d29 --- /dev/null +++ b/tests/base_isa_gen2.nit @@ -0,0 +1,54 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_gen3.nit b/tests/base_isa_gen3.nit new file mode 100644 index 0000000..fe97144 --- /dev/null +++ b/tests/base_isa_gen3.nit @@ -0,0 +1,27 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_gen4.nit b/tests/base_isa_gen4.nit new file mode 100644 index 0000000..27fecb4 --- /dev/null +++ b/tests/base_isa_gen4.nit @@ -0,0 +1,44 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_gen5.nit b/tests/base_isa_gen5.nit new file mode 100644 index 0000000..558384e --- /dev/null +++ b/tests/base_isa_gen5.nit @@ -0,0 +1,50 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_gen6.nit b/tests/base_isa_gen6.nit new file mode 100644 index 0000000..5b9f6b3 --- /dev/null +++ b/tests/base_isa_gen6.nit @@ -0,0 +1,37 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_gen7.nit b/tests/base_isa_gen7.nit new file mode 100644 index 0000000..939ca2c --- /dev/null +++ b/tests/base_isa_gen7.nit @@ -0,0 +1,59 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_gen8.nit b/tests/base_isa_gen8.nit new file mode 100644 index 0000000..f3347f0 --- /dev/null +++ b/tests/base_isa_gen8.nit @@ -0,0 +1,64 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_nullable1.nit b/tests/base_isa_nullable1.nit new file mode 100644 index 0000000..6a44174 --- /dev/null +++ b/tests/base_isa_nullable1.nit @@ -0,0 +1,53 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_nullable2.nit b/tests/base_isa_nullable2.nit new file mode 100644 index 0000000..6796055 --- /dev/null +++ b/tests/base_isa_nullable2.nit @@ -0,0 +1,35 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_nullable_vt.nit b/tests/base_isa_nullable_vt.nit new file mode 100644 index 0000000..34179d5 --- /dev/null +++ b/tests/base_isa_nullable_vt.nit @@ -0,0 +1,59 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_nullable_vt2.nit b/tests/base_isa_nullable_vt2.nit new file mode 100644 index 0000000..56cfb61 --- /dev/null +++ b/tests/base_isa_nullable_vt2.nit @@ -0,0 +1,59 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_vt_class.nit b/tests/base_isa_vt_class.nit new file mode 100644 index 0000000..34cb83b --- /dev/null +++ b/tests/base_isa_vt_class.nit @@ -0,0 +1,59 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_vt_ft.nit b/tests/base_isa_vt_ft.nit new file mode 100644 index 0000000..c0de90b --- /dev/null +++ b/tests/base_isa_vt_ft.nit @@ -0,0 +1,64 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_vt_gen1.nit b/tests/base_isa_vt_gen1.nit new file mode 100644 index 0000000..7d823dc --- /dev/null +++ b/tests/base_isa_vt_gen1.nit @@ -0,0 +1,65 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_vt_gen2.nit b/tests/base_isa_vt_gen2.nit new file mode 100644 index 0000000..8703324 --- /dev/null +++ b/tests/base_isa_vt_gen2.nit @@ -0,0 +1,59 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_isa_vt_gen3.nit b/tests/base_isa_vt_gen3.nit new file mode 100644 index 0000000..1aec20d --- /dev/null +++ b/tests/base_isa_vt_gen3.nit @@ -0,0 +1,52 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/base_minimal.nit b/tests/base_minimal.nit new file mode 100644 index 0000000..f1ca6b5 --- /dev/null +++ b/tests/base_minimal.nit @@ -0,0 +1,26 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2012 Alexandre Terrasa +# +# 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 diff --git a/tests/sav/base_call1.sav b/tests/sav/base_call1.sav new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_call1.sav @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa1.res b/tests/sav/base_isa1.res new file mode 100644 index 0000000..48301ef --- /dev/null +++ b/tests/sav/base_isa1.res @@ -0,0 +1,5 @@ +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 diff --git a/tests/sav/base_isa2.res b/tests/sav/base_isa2.res new file mode 100644 index 0000000..eb33097 --- /dev/null +++ b/tests/sav/base_isa2.res @@ -0,0 +1,2 @@ +base_isa2.nit:21,10--19: Warning: Expression is already a A. +true diff --git a/tests/sav/base_isa3.res b/tests/sav/base_isa3.res new file mode 100644 index 0000000..fb8cf07 --- /dev/null +++ b/tests/sav/base_isa3.res @@ -0,0 +1,12 @@ +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 diff --git a/tests/sav/base_isa_ft.sav b/tests/sav/base_isa_ft.sav new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_ft.sav @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_ft2.sav b/tests/sav/base_isa_ft2.sav new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_ft2.sav @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_gen1.res b/tests/sav/base_isa_gen1.res new file mode 100644 index 0000000..c75a7bf --- /dev/null +++ b/tests/sav/base_isa_gen1.res @@ -0,0 +1,4 @@ +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 diff --git a/tests/sav/base_isa_gen2.res b/tests/sav/base_isa_gen2.res new file mode 100644 index 0000000..642140a --- /dev/null +++ b/tests/sav/base_isa_gen2.res @@ -0,0 +1,5 @@ +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 diff --git a/tests/sav/base_isa_gen3.res b/tests/sav/base_isa_gen3.res new file mode 100644 index 0000000..f2f9925 --- /dev/null +++ b/tests/sav/base_isa_gen3.res @@ -0,0 +1,2 @@ +base_isa_gen3.nit:20,37--48: Warning: Expression is already a Object. +true diff --git a/tests/sav/base_isa_gen4.res b/tests/sav/base_isa_gen4.res new file mode 100644 index 0000000..9b5e39d --- /dev/null +++ b/tests/sav/base_isa_gen4.res @@ -0,0 +1,5 @@ +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 diff --git a/tests/sav/base_isa_gen5.res b/tests/sav/base_isa_gen5.res new file mode 100644 index 0000000..7d6532f --- /dev/null +++ b/tests/sav/base_isa_gen5.res @@ -0,0 +1,5 @@ +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 diff --git a/tests/sav/base_isa_gen6.res b/tests/sav/base_isa_gen6.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_gen6.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_gen7.res b/tests/sav/base_isa_gen7.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_gen7.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_gen8.res b/tests/sav/base_isa_gen8.res new file mode 100644 index 0000000..e7cc1c6 --- /dev/null +++ b/tests/sav/base_isa_gen8.res @@ -0,0 +1,10 @@ +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 diff --git a/tests/sav/base_isa_nullable1.res b/tests/sav/base_isa_nullable1.res new file mode 100644 index 0000000..16f5b04 --- /dev/null +++ b/tests/sav/base_isa_nullable1.res @@ -0,0 +1,6 @@ +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 diff --git a/tests/sav/base_isa_nullable2.res b/tests/sav/base_isa_nullable2.res new file mode 100644 index 0000000..3f41608 --- /dev/null +++ b/tests/sav/base_isa_nullable2.res @@ -0,0 +1,5 @@ +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 diff --git a/tests/sav/base_isa_nullable_vt.res b/tests/sav/base_isa_nullable_vt.res new file mode 100644 index 0000000..9e71bdd --- /dev/null +++ b/tests/sav/base_isa_nullable_vt.res @@ -0,0 +1 @@ +base_isa_nullable_vt.nit:38,16--28: Redef error: Expected Object, as in A::U. diff --git a/tests/sav/base_isa_nullable_vt2.res b/tests/sav/base_isa_nullable_vt2.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_nullable_vt2.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_vt_class.res b/tests/sav/base_isa_vt_class.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_vt_class.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_vt_ft.res b/tests/sav/base_isa_vt_ft.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_vt_ft.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_vt_gen1.res b/tests/sav/base_isa_vt_gen1.res new file mode 100644 index 0000000..98fffea --- /dev/null +++ b/tests/sav/base_isa_vt_gen1.res @@ -0,0 +1,6 @@ +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 diff --git a/tests/sav/base_isa_vt_gen2.res b/tests/sav/base_isa_vt_gen2.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_vt_gen2.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_isa_vt_gen3.res b/tests/sav/base_isa_vt_gen3.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_isa_vt_gen3.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/base_minimal.res b/tests/sav/base_minimal.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/base_minimal.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/nitc/fixme/base_isa_gen1.res b/tests/sav/nitc/fixme/base_isa_gen1.res new file mode 100644 index 0000000..879bc6b --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_gen1.res @@ -0,0 +1,4 @@ +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) diff --git a/tests/sav/nitc/fixme/base_isa_gen4.res b/tests/sav/nitc/fixme/base_isa_gen4.res new file mode 100644 index 0000000..a157503 --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_gen4.res @@ -0,0 +1,5 @@ +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) diff --git a/tests/sav/nitc/fixme/base_isa_gen5.res b/tests/sav/nitc/fixme/base_isa_gen5.res new file mode 100644 index 0000000..ec59238 --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_gen5.res @@ -0,0 +1,5 @@ +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) diff --git a/tests/sav/nitc/fixme/base_isa_gen7.res b/tests/sav/nitc/fixme/base_isa_gen7.res new file mode 100644 index 0000000..dc14d35 --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_gen7.res @@ -0,0 +1 @@ +Runtime error: Assert failed (base_isa_gen7.nit:49) diff --git a/tests/sav/nitc/fixme/base_isa_nullable1.res b/tests/sav/nitc/fixme/base_isa_nullable1.res new file mode 100644 index 0000000..4678874 --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_nullable1.res @@ -0,0 +1,6 @@ +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) diff --git a/tests/sav/nitc/fixme/base_isa_nullable2.res b/tests/sav/nitc/fixme/base_isa_nullable2.res new file mode 100644 index 0000000..09b831d --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_nullable2.res @@ -0,0 +1,5 @@ +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) diff --git a/tests/sav/nitc/fixme/base_isa_nullable_vt2.res b/tests/sav/nitc/fixme/base_isa_nullable_vt2.res new file mode 100644 index 0000000..d01b27b --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_nullable_vt2.res @@ -0,0 +1 @@ +Runtime error: Assert failed (base_isa_nullable_vt2.nit:52) diff --git a/tests/sav/nitc/fixme/base_isa_vt_ft.res b/tests/sav/nitc/fixme/base_isa_vt_ft.res new file mode 100644 index 0000000..03110b0 --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_vt_ft.res @@ -0,0 +1 @@ +Runtime error: Assert failed (base_isa_vt_ft.nit:55) diff --git a/tests/sav/nitc/fixme/base_isa_vt_gen2.res b/tests/sav/nitc/fixme/base_isa_vt_gen2.res new file mode 100644 index 0000000..90dfb14 --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_vt_gen2.res @@ -0,0 +1 @@ +Runtime error: Assert failed (base_isa_vt_gen2.nit:48) diff --git a/tests/sav/nitc/fixme/base_isa_vt_gen3.res b/tests/sav/nitc/fixme/base_isa_vt_gen3.res new file mode 100644 index 0000000..4eb1aea --- /dev/null +++ b/tests/sav/nitc/fixme/base_isa_vt_gen3.res @@ -0,0 +1 @@ +Runtime error: Assert failed (base_isa_vt_gen3.nit:48) diff --git a/tests/sav/nitg-e/base_isa1.res b/tests/sav/nitg-e/base_isa1.res new file mode 100644 index 0000000..ba69aa1 --- /dev/null +++ b/tests/sav/nitg-e/base_isa1.res @@ -0,0 +1,3 @@ +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 diff --git a/tests/sav/nitg-e/base_isa_gen1.res b/tests/sav/nitg-e/base_isa_gen1.res new file mode 100644 index 0000000..879bc6b --- /dev/null +++ b/tests/sav/nitg-e/base_isa_gen1.res @@ -0,0 +1,4 @@ +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) diff --git a/tests/sav/nitg-e/base_isa_gen4.res b/tests/sav/nitg-e/base_isa_gen4.res new file mode 100644 index 0000000..a157503 --- /dev/null +++ b/tests/sav/nitg-e/base_isa_gen4.res @@ -0,0 +1,5 @@ +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) diff --git a/tests/sav/nitg-e/base_isa_gen5.res b/tests/sav/nitg-e/base_isa_gen5.res new file mode 100644 index 0000000..ec59238 --- /dev/null +++ b/tests/sav/nitg-e/base_isa_gen5.res @@ -0,0 +1,5 @@ +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) diff --git a/tests/sav/nitg-e/base_isa_gen7.res b/tests/sav/nitg-e/base_isa_gen7.res new file mode 100644 index 0000000..dc14d35 --- /dev/null +++ b/tests/sav/nitg-e/base_isa_gen7.res @@ -0,0 +1 @@ +Runtime error: Assert failed (base_isa_gen7.nit:49) diff --git a/tests/sav/nitg-e/base_isa_nullable1.res b/tests/sav/nitg-e/base_isa_nullable1.res new file mode 100644 index 0000000..4678874 --- /dev/null +++ b/tests/sav/nitg-e/base_isa_nullable1.res @@ -0,0 +1,6 @@ +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) diff --git a/tests/sav/nitg-e/base_isa_nullable2.res b/tests/sav/nitg-e/base_isa_nullable2.res new file mode 100644 index 0000000..09b831d --- /dev/null +++ b/tests/sav/nitg-e/base_isa_nullable2.res @@ -0,0 +1,5 @@ +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) diff --git a/tests/sav/nitg-e/fixme/base_isa_nullable_vt.res b/tests/sav/nitg-e/fixme/base_isa_nullable_vt.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/nitg-e/fixme/base_isa_nullable_vt.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/nitg-s/base_isa1.res b/tests/sav/nitg-s/base_isa1.res new file mode 100644 index 0000000..ba69aa1 --- /dev/null +++ b/tests/sav/nitg-s/base_isa1.res @@ -0,0 +1,3 @@ +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 diff --git a/tests/sav/nitg-s/base_isa_vt_gen1.res b/tests/sav/nitg-s/base_isa_vt_gen1.res new file mode 100644 index 0000000..6aa8394 --- /dev/null +++ b/tests/sav/nitg-s/base_isa_vt_gen1.res @@ -0,0 +1,6 @@ +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 diff --git a/tests/sav/nitg-s/fixme/base_isa_nullable_vt.res b/tests/sav/nitg-s/fixme/base_isa_nullable_vt.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/nitg-s/fixme/base_isa_nullable_vt.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/nitg/base_isa1.res b/tests/sav/nitg/base_isa1.res new file mode 100644 index 0000000..ba69aa1 --- /dev/null +++ b/tests/sav/nitg/base_isa1.res @@ -0,0 +1,3 @@ +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 diff --git a/tests/sav/nitg/base_isa_gen1.sav b/tests/sav/nitg/base_isa_gen1.sav new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/nitg/base_isa_gen1.sav @@ -0,0 +1 @@ +true diff --git a/tests/sav/nitg/base_isa_vt_gen1.res b/tests/sav/nitg/base_isa_vt_gen1.res new file mode 100644 index 0000000..6aa8394 --- /dev/null +++ b/tests/sav/nitg/base_isa_vt_gen1.res @@ -0,0 +1,6 @@ +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 diff --git a/tests/sav/nitg/fixme/base_isa_nullable_vt.res b/tests/sav/nitg/fixme/base_isa_nullable_vt.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/nitg/fixme/base_isa_nullable_vt.res @@ -0,0 +1 @@ +true diff --git a/tests/sav/niti/base_isa1.res b/tests/sav/niti/base_isa1.res new file mode 100644 index 0000000..ba69aa1 --- /dev/null +++ b/tests/sav/niti/base_isa1.res @@ -0,0 +1,3 @@ +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 diff --git a/tests/sav/niti/base_isa_vt_gen1.res b/tests/sav/niti/base_isa_vt_gen1.res new file mode 100644 index 0000000..6aa8394 --- /dev/null +++ b/tests/sav/niti/base_isa_vt_gen1.res @@ -0,0 +1,6 @@ +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 diff --git a/tests/sav/niti/fixme/base_isa_nullable_vt.res b/tests/sav/niti/fixme/base_isa_nullable_vt.res new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/tests/sav/niti/fixme/base_isa_nullable_vt.res @@ -0,0 +1 @@ +true -- 1.7.9.5