First NIT release and new clean mercurial repository
[nit.git] / tests / base_isa.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2005-2008 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 O
20 end
21
22 class A
23 special O
24 init do end
25 end
26
27 class U
28 end
29
30 class B
31 special A
32 special U
33 redef init do end
34 end
35
36 var a: Object = new A
37 var b: Object = new B
38
39 (a isa Object).output
40 (a isa O).output
41 (a isa A).output
42 (not a isa U).output
43 (not a isa B).output
44 (not a isa Int).output
45 (not a isa Comparable).output
46
47 '\n'.output
48
49 (b isa Object).output
50 (b isa O).output
51 (b isa A).output
52 (b isa U).output
53 (b isa B).output
54 (not b isa Int).output
55 (not b isa Comparable).output