--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.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 standard::kernel
+
+fun foo(i: Int): nullable Int do return i
+fun bar(i: Int) do i.output
+
+var i = 0
+var c = 0
+while i < 10 do
+ i += 1
+
+ var b = foo(i)
+ if b == null then
+ continue#alt1#
+ end
+
+ bar(b)
+ c = b
+end
+bar(c)
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.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 standard::kernel
+
+class A
+ fun foo do 1.output
+end
+
+class B
+ super A
+ fun bar do 2.output
+end
+
+var x: A #alt3# var x
+x = new B
+
+var i = 0
+while i < 3 do
+ i += 1
+ x.bar
+ x = new A
+ x.foo
+ break#alt1#
+end
+x.foo
+#alt2#x.bar
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.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 standard::kernel
+
+redef class Int
+ fun next: nullable Int do if self < 20 then return self + 1 else return null
+end
+
+var t2: nullable Int = 10
+t2.output
+while t2 != null do
+ t2 = t2.next #alt1# t2 = null
+ while t2 != null do
+ t2.output
+ t2 = t2.next #alt2# t2 = null
+ end
+ #alt3#t2 = t2.next
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.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 standard::collection::array
+
+var a #1alt1#var a: Array[Object]
+a = [1]#1alt2#
+#1alt2#a = 1
+var i = 0
+while i < 3 do
+ i += 1
+
+ a = [a]
+ a.length.output
+ #alt1#a.first.length.output
+end
+#alt1#a.length.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.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 standard::kernel
+
+class O
+ fun foo: O do
+ 0.output
+ return new B
+ end
+end
+
+class A
+ super O
+ redef fun foo: B do
+ 1.output
+ return new B
+ end
+ fun bar: B do
+ 10.output
+ return new B
+ end
+end
+
+class B
+ super O
+ redef fun foo: C do
+ 2.output
+ return new C
+ end
+ fun bar: C do
+ 20.output
+ return new C
+ end
+end
+
+class C
+ super O
+end
+
+var a: O #alt1# var a
+
+a = new A
+var i = 0
+while i < 4 do
+ a = a.foo #alt2# a = a.bar
+ i += 1
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.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 standard::kernel
+
+fun foo(i: Int): nullable Int do return i
+fun bar(i: Int) do i.output
+fun baz: nullable Int do return null
+
+bar(0)
+var i = null
+while i == null do
+ i = foo(1) #alt1# exit(1)
+end
+bar(i)
+
+i = foo(2)
+while i != null do
+ bar(i)
+ i = baz
+end
+#alt2#bar(i)
+
+i = null
+loop
+ i = foo(3)
+ if i == null then continue #alt3#
+ bar(i)
+ break
+end
+bar(i)
+
+i = 4
+loop
+ bar(i)
+ i = baz
+ if i != null then
+ bar(i)
+ else
+ break #alt4#
+ end
+end
--- /dev/null
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+10
--- /dev/null
+alt/base_adaptive_loop2_alt1.nit:32,2--6: Error: Method 'bar' doesn't exists in A.
--- /dev/null
+alt/base_adaptive_loop2_alt2.nit:38,1--5: Error: Method 'bar' doesn't exists in A.
--- /dev/null
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
--- /dev/null
+alt/base_adaptive_loop3_alt3.nit:29,7--13: Error: Method 'next' call on 'null'.
--- /dev/null
+alt/base_adaptive_loop_alt1.nit:30,6: Type error: expected Int, got nullable Int
+alt/base_adaptive_loop_alt1.nit:31,6: Type error: expected Int, got nullable Int
--- /dev/null
+1
+1
+1
+1
+1
+1
+1
--- /dev/null
+alt/base_adaptive_loop_array_1alt2_alt1.nit:26,2--15: Error: Method 'length' doesn't exists in Int.
+alt/base_adaptive_loop_array_1alt2_alt1.nit:26,2--15: Error: Method 'length' doesn't exists in nullable Object.
+alt/base_adaptive_loop_array_1alt2_alt1.nit:28,1--8: Error: Method 'length' doesn't exists in nullable Object.
--- /dev/null
+alt/base_adaptive_loop_array_alt1.nit:26,2--15: Error: Method 'length' doesn't exists in nullable Object.
+alt/base_adaptive_loop_array_alt1.nit:28,1--8: Error: Method 'length' doesn't exists in nullable Object.
--- /dev/null
+1
+2
+0
+2
--- /dev/null
+alt/base_adaptive_loop_call_alt1.nit:57,6--10: Error: Method 'foo' doesn't exists in nullable Object.
--- /dev/null
+alt/base_adaptive_loop_call_alt2.nit:57,6--10: Error: Method 'bar' doesn't exists in O.
--- /dev/null
+0
+1
+2
+3
+3
+4
--- /dev/null
+alt/base_adaptive_loop_null_alt2.nit:33,5: Type error: expected Int, got null
--- /dev/null
+alt/base_adaptive_loop_null_alt3.nit:39,6: Type error: expected Int, got nullable Int
+alt/base_adaptive_loop_null_alt3.nit:42,5: Type error: expected Int, got nullable Int
--- /dev/null
+alt/base_adaptive_loop_null_alt4.nit:46,6: Type error: expected Int, got nullable Int