1 # This file is part of NIT ( http://www.nitlanguage.org ).
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
25 redef fun toto
(x
) do return x
+ self
27 fun mult_by
(x
: Int): Int do return x
* self
56 return "x is {x.as(not null)}"
66 print f1
.call
# "in A::fun1"
69 print f2
.call
# "in B::fun1"
72 print f3
.call
(10) # 100
75 print f4
.call
# "in B::fun1"
77 var f5
: Fun0[Object] = &f4
.call
81 print
((&10.toto
).call
(100)) # 110
82 print
((&"allo".toto
).call
(2)) # 3
86 var ps
= [p1
,p1
,p1
,p1
,p1
]
91 var c1
= new C
[nullable Object](null)
92 var c2
= new C
[nullable Int](null)
97 print f6
.call
# "x is null"
98 print f7
.call
# "x is null"
103 print f6
.call
# "x is test"
104 print f7
.call
# "x is 100"