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.
18 # Redef to avoid unstable `object_id`
19 redef fun inspect_head
do return "{class_name}"
26 super DeriveEqual#alt2#
36 redef fun derive_to_map
39 res
["string"] = s
# drop i
56 var a
= new A
(5, "Hello")
58 print a
.derive_to_map
.join
(" ", "=")
63 var a2
= new A
(5, "Hel" + "lo")
64 var a3
= new A
(6, "Hel" + "lo")
66 print a
.hash
== a2
.hash
71 var b
= new B
(100, "World", a
)
73 print b
.derive_to_map
.join
(" ", "=")
78 var b2
= new B
(100, "World", a2
)
79 var b3
= new B
(100, "World", a3
)
81 print b
.hash
== b2
.hash