Hi, the old smartzilla insn't still available then i can't check the
following encountered problem fully described by the 4 classes A, B, C
and M below. When compiled with assertion (for example: compile -clean
-o m m) i have a crash. Stack follows. It seems to be a conceptual
problem when mixing contract and inherited features. A hack is possible
but i would like to open a bug in the bug system.
a+ josé
class A
inherit
ANY
redefine is_equal end
feature
is_equal(other: like Current): BOOLEAN is
do
Result := Current = other
end
end
class B
inherit
ANY
redefine is_equal end
feature
is_equal(other: like Current): BOOLEAN is
do
Result := True
end
end
class C
inherit
A
redefine is_equal end
B
redefine is_equal end
feature
is_equal(other: like Current): BOOLEAN is
do
Result := Precursor{B}(other)
and then Precursor{A}(other)
end
end
class M
creation
make
feature
c1, c2: C
make is
do
create c1
create c2
if c1.is_equal(c2) then
print("equality%N")
else
print("inequality%N")
end
end
end
*** Error at Run Time ***: Ensure Assertion Violated.
*** Error at Run Time ***: commutative
4 frames in current stack.
===== Bottom of run-time stack =====
<system root>
Current = M#0x9f19038
[ c2 = #0x9f1b048
c1 = #0x9f1b040
]
line 7 column 2 file /home/jose/m.e
======================================
make M
Current = M#0x9f19038
[ c2 = #0x9f1b048
c1 = #0x9f1b040
]
line 11 column 10 file /home/jose/m.e
======================================
is_equal C
Current = C#0x9f1b040
other = C#0x9f1b048
Result = False
line 10 column 4 file /home/jose/c.e
======================================
is_equal C
Current = C#0x9f1b040
other = C#0x9f1b048
Result = True
line 63 column 57 file /home/jose/SmartEiffel/lib/kernel/any.e
===== Top of run-time stack =====
*** Error at Run Time ***: Ensure Assertion Violated.
*** Error at Run Time ***: commutative