--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.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 kernel
+
+class A
+ meth foo
+ with bar do
+ #alt1# return
+ #alt2# return 1
+ #alt3# abort
+ #alt4# continue
+ #alt5# continue 20
+ 20.output
+ end
+ do
+ 1.output
+ bar
+ 3.output
+ end
+end
+
+var a = new A
+0.output
+a.foo with do 2.output
+0.output
+a.foo
+0.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.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 kernel
+
+class A
+ meth foo
+ with bar(i: Int) do
+ #alt1# return
+ #alt2# return 1
+ #alt3# abort
+ #alt4# continue
+ #alt5# continue 20
+ (i * 10).output
+ end
+ do
+ 1.output
+ bar(2)
+ #alt6#i.output
+ 3.output
+ end
+end
+
+var a = new A
+0.output
+a.foo with j do j.output
+0.output
+a.foo
+0.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.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 kernel
+
+class A
+ meth foo
+ with bar: Int do
+ #alt1# return
+ #alt2# return 1
+ #alt3# abort
+ #alt4# continue
+ continue 20 #!alt5#
+ end
+ do
+ 1.output
+ bar.output
+ 3.output
+ end
+end
+
+var a = new A
+0.output
+a.foo with do continue 2
+0.output
+a.foo
+0.output
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.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 kernel
+
+class A
+ meth foo
+ with bar(i: Int): Int do
+ #alt1# return
+ #alt2# return -1
+ #alt3# abort
+ #alt4# continue
+ continue (i * 10) #!alt5#
+ end
+ do
+ 1.output
+ bar(2).output
+ 3.output
+ end
+end
+
+var a = new A
+0.output
+a.foo with j do continue j
+0.output
+a.foo
+0.output
--- /dev/null
+0
+1
+2
+3
+0
+1
+20
+3
+0
--- /dev/null
+0
+1
+2
+3
+0
+1
+0
--- /dev/null
+alt/base_closure_default1_alt2.nit:23,5--12: Error: Return with value in a procedure.
--- /dev/null
+0
+1
+2
+3
+0
+1
+Aborted in base_closure_default1_alt3::A::foo (alt/base_closure_default1_alt3.nit:24)
+,---- Stack trace -- - - -
+| base_closure_default1_alt3::A::foo (alt/base_closure_default1_alt3.nit:20)
+| base_closure_default1_alt3::Sys::(kernel::Sys::main) (alt/base_closure_default1_alt3.nit:36)
+`------------------- - - -
--- /dev/null
+0
+1
+2
+3
+0
+1
+3
+0
--- /dev/null
+alt/base_closure_default1_alt5.nit:26,5--15: Error: continue without value required in this bloc.
--- /dev/null
+0
+1
+2
+3
+0
+1
+20
+3
+0
--- /dev/null
+0
+1
+2
+3
+0
+1
+0
--- /dev/null
+alt/base_closure_default2_alt2.nit:23,5--12: Error: Return with value in a procedure.
--- /dev/null
+0
+1
+2
+3
+0
+1
+Aborted in base_closure_default2_alt3::A::foo (alt/base_closure_default2_alt3.nit:24)
+,---- Stack trace -- - - -
+| base_closure_default2_alt3::A::foo (alt/base_closure_default2_alt3.nit:20)
+| base_closure_default2_alt3::Sys::(kernel::Sys::main) (alt/base_closure_default2_alt3.nit:37)
+`------------------- - - -
--- /dev/null
+0
+1
+2
+3
+0
+1
+3
+0
--- /dev/null
+alt/base_closure_default2_alt5.nit:26,5--15: Error: continue without value required in this bloc.
--- /dev/null
+alt/base_closure_default2_alt6.nit:32,3--3: Error: Method or variable 'i' unknown in A.
--- /dev/null
+0
+1
+2
+3
+0
+1
+20
+3
+0
--- /dev/null
+0
+1
+2
+3
+0
+1
+0
--- /dev/null
+alt/base_closure_default3_alt2.nit:23,5--12: Error: Return with value in a procedure.
--- /dev/null
+0
+1
+2
+3
+0
+1
+Aborted in base_closure_default3_alt3::A::foo (alt/base_closure_default3_alt3.nit:24)
+,---- Stack trace -- - - -
+| base_closure_default3_alt3::A::foo (alt/base_closure_default3_alt3.nit:20)
+| base_closure_default3_alt3::Sys::(kernel::Sys::main) (alt/base_closure_default3_alt3.nit:35)
+`------------------- - - -
--- /dev/null
+alt/base_closure_default3_alt4.nit:25,5--12: Error: continue with a value required in this bloc.
--- /dev/null
+alt/base_closure_default3_alt5.nit:21,3--15: Control error: Reached end of bloc (a 'continue' with a value was expected).
--- /dev/null
+0
+1
+2
+3
+0
+1
+20
+3
+0
--- /dev/null
+0
+1
+2
+3
+0
+1
+0
--- /dev/null
+alt/base_closure_default4_alt2.nit:23,5--13: Error: Return with value in a procedure.
--- /dev/null
+0
+1
+2
+3
+0
+1
+Aborted in base_closure_default4_alt3::A::foo (alt/base_closure_default4_alt3.nit:24)
+,---- Stack trace -- - - -
+| base_closure_default4_alt3::A::foo (alt/base_closure_default4_alt3.nit:20)
+| base_closure_default4_alt3::Sys::(kernel::Sys::main) (alt/base_closure_default4_alt3.nit:35)
+`------------------- - - -
--- /dev/null
+alt/base_closure_default4_alt4.nit:25,5--12: Error: continue with a value required in this bloc.
--- /dev/null
+alt/base_closure_default4_alt5.nit:21,3--23: Control error: Reached end of bloc (a 'continue' with a value was expected).
--- /dev/null
+B:
+true
+blue
+R:
+false
+red
+true
+red
+N:
+false
+black
+false
--- /dev/null
+B:
+true
+blue
+R:
+false
+red
+true
+red
+N:
+false
+black
+false
+Aborted in test_map_closure_default_alt1::Map::get (alt/test_map_closure_default_alt1.nit:19)
+,---- Stack trace -- - - -
+| test_map_closure_default_alt1::Map::get (alt/test_map_closure_default_alt1.nit:18)
+| test_map_closure_default_alt1::Sys::(kernel::Sys::main) (alt/test_map_closure_default_alt1.nit:28)
+`------------------- - - -
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 Jean Privat <jean@pryen.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.
+
+redef class Map[K, V]
+ meth get(k: K): V
+ with default: V do abort
+ do
+ if has_key(k) then return self[k]
+ var d = default
+ self[k] = d
+ return d
+ end
+end
+
+var h = new HashMap[String, String]
+h["bleu"] = "blue"
+
+print "B:"
+
+print h.has_key("bleu")
+var v = h.get("bleu") with do
+ print "Error"
+ abort
+end
+print v
+
+print "R:"
+
+print h.has_key("rouge")
+v = h.get("rouge") with do continue "red"
+print v
+print h.has_key("rouge")
+v = h.get("rouge")
+print v
+
+print "N:"
+
+print h.has_key("noir")
+v = h.get("noir") with do break "black"
+print v
+print h.has_key("noir")
+
+#alt1#v = h.get("noir")