nullable: enforce static and dynamic rules.
[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 meth foo: U
21 with bar
22 do
23 return new U
24 end
25 end
26
27 class T
28 end
29
30 class U
31 special T
32 end
33
34 class V
35 special T
36 end
37
38 class W
39 special U
40 special V
41 end
42
43 var a = new A
44
45 var t: T = new T
46 var u: U = new U
47 var v: V = new V
48 var w: W = new W
49
50 var y: Object
51 #alt1#var y: U
52 y = a.foo with do 0.output
53 y = a.foo with do break t
54 y = a.foo with do break u
55 y = a.foo with do break v
56 y = a.foo with do break w
57 y = a.foo with do
58 break t
59 break u
60 break v
61 break w
62 end
63 y = a.foo with do
64 break u
65 break v
66 break w
67 end