update NOTICE and LICENSE
[nit.git] / tests / base_closure6.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2009 Jean Privat <jean@pryen.org>
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 import kernel
18
19 class A
20 fun foo: U
21 !bar
22 do
23 return new U
24 end
25 end
26
27 class T
28 end
29
30 class U
31 super T
32 end
33
34 class V
35 super T
36 end
37
38 class W
39 super U
40 super V
41 end
42
43 fun maybe: Bool do return true
44
45 var a = new A
46
47 var t: T = new T
48 var u: U = new U
49 var v: V = new V
50 var w: W = new W
51
52 var y: Object#!alt1#
53 #alt1#var y: U
54 y = a.foo !bar do 0.output
55 y = a.foo !bar do break t
56 y = a.foo !bar do break u
57 y = a.foo !bar do break v
58 y = a.foo !bar do break w
59 y = a.foo !bar do
60 if maybe then
61 break t
62 else if maybe then
63 break u
64 else if maybe then
65 break v
66 else if maybe then
67 break w
68 end
69 end
70 y = a.foo !bar do
71 if maybe then
72 break u
73 else if maybe then
74 break v
75 else if maybe then
76 break w
77 end
78 end