PR# 3709 Initialization of Tuples of expanded
Problem Report Summary
Submitter: gobobe
Category: Runtime
Priority: Medium
Date: 2004/03/20
Class: Bug
Severity: Serious
Number: 3709
Release: 5.5.0409
Confidential: No
Status: Open
Responsible:
Environment: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
Synopsis: Initialization of Tuples of expanded
Description
ISE Eiffel 5.5.0409
Let's consider this class:
---------------------
class B
inherit
ANY
redefine
default_create
end
create
default_create,
make_from_expanded
convert
make_from_expanded ({expanded B}),
to_expanded: {expanded B}
feature
default_create is
--
do
i := 45
end
make_from_expanded (b: expanded B) is
do
i := b.i
end
to_expanded: expanded B is
do
Result.set_i (i)
end
i: INTEGER
set_i (int: INTEGER) is
do
i := int
end
end
---------------------
Now if I write:
---------------------
class A
create
make
feature
make is
local
tb: TUPLE [expanded B]
do
create tb
print (tb.generating_type)
print ("%N")
if tb.item (1) = Void then
print ("Void%N")
else
print (tb.item (1))
print ("%N")
end
end
end
---------------------
it will print:
---------------------
TUPLE [expanded B]
Void
---------------------
Because the item in the Tuple is declared of type 'expanded B', I would have expected to have this item being initialized when creating the Tuple (in the same way it is initialized when creating an ARRAY [expanded B] for example). Note that if I replace 'TUPLE [expanded B]' by 'TUPLE [INTEGER]' then the item is initialized as expected (getting value 0 instead of this erroneous Void).
To Reproduce
Problem Report Interactions