update NOTICE and LICENSE
[nit.git] / tests / base_var.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 fun foo: Int do return 1
20 fun bar do end
21
22 var a1: Int
23 var b1: Float
24 a1 = 5
25 b1 = 5.5
26 #alt1#a1 = b1
27 #alt2#b1 = a1
28 a1.output
29 b1.output
30
31 var a2: Int = 1
32 var b2: Float = 1.0
33 a2 = 5
34 b2 = 5.5
35 #alt3#a2 = b2
36 #alt4#b2 = a2
37 a2.output
38 b2.output
39
40 var a3 = 1
41 var b3 = 1.0
42 a3 = 5
43 b3 = 5.5
44 #alt5#a3 = b3
45 #alt6#b3 = a3
46 a3.output
47 b3.output
48
49 var a4: Int = foo
50 a4.output
51 var a5 = foo
52 a5.output
53 #alt7#var a6: Int = bar
54 #alt8#var a7 = bar