Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / base_attr_boxing.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2004-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 A
20 var f: Float = 1.0
21 var nf: nullable Float = 2.0
22 var o: Object = 3.0
23
24 var f_f: Float = f
25 var nf_f: nullable Float = f
26 var o_f: Object = f
27
28 var f_nf: Float = nf.as(not null)
29 var nf_nf: nullable Float = nf.as(not null)
30 var o_nf: Object = nf.as(not null)
31
32 var f_o: Float = o.as(Float)
33 var nf_o: nullable Float = o.as(Float)
34 var o_o: Object = o.as(Float)
35
36 redef fun output
37 do
38 f.output
39 nf.output
40 o.output
41 '\n'.output
42
43 f_f.output
44 nf_f.output
45 o_f.output
46 '\n'.output
47
48 f_nf.output
49 nf_nf.output
50 o_nf.output
51 '\n'.output
52
53 f_o.output
54 nf_o.output
55 o_o.output
56 end
57 end
58
59 var a = new A
60 a.output