metamodel: rename 'universal' to 'enum'
[nit.git] / tests / base_attr5.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import kernel
16
17 class A
18 fun foo: Int do return 1
19 fun bar=(i: Int)
20 do
21 '#'.output
22 i.output
23 end
24 fun baz: Int do return 3
25 fun baz=(i: Int)
26 do
27 '#'.output
28 i.output
29 end
30 end
31
32 class B
33 super A
34 #alt1#var foo: Int = 10
35 #alt2#redef var foo: Int = 10
36 #alt3#var foo: Int writable = 10
37 #alt4#redef var foo: Int writable = 10
38 #alt5#var foo: Int redef writable = 10
39 #alt6#redef var foo: Int redef writable = 10
40
41 #alt11#var bar: Int = 20
42 #alt12#redef var bar: Int = 20
43 #alt13#var bar: Int writable = 20
44 #alt14#redef var bar: Int writable = 20
45 #alt15#var bar: Int redef writable = 20
46 #alt16#redef var bar: Int redef writable = 20
47
48 #alt21#var baz: Int = 30
49 #alt22#redef var baz: Int = 30
50 #alt23#var baz: Int writable = 30
51 #alt24#redef var baz: Int writable = 30
52 #alt25#var baz: Int redef writable = 30
53 #alt26#redef var baz: Int redef writable = 30
54 end
55
56 var b = new B
57 b.foo.output
58 #alt2#b.foo = 100
59 #alt4#b.foo = 100
60 b.foo.output
61 '\n'.output
62 #alt15#b.bar.output
63 b.bar = 200
64 #alt15#b.bar.output
65 '\n'.output
66 b.baz.output
67 b.baz = 300
68 b.baz.output