PR# 2719 Compiler complains about expanded types in arrays
Problem Report Summary
Submitter:
Category: Compiler
Priority: Medium
Date: 2000/12/14
Class: Bug
Severity: Non-critical
Number: 2719
Release: EiffelBench 4.5 (WIN32)
Confidential: No
Status: Open
Responsible:
Environment: EBench 4.5
Windows NT 5.0 (2000 Professional)
Synopsis: Compiler complains about expanded types in arrays
Description
When using object an object a with an expanded Type (say "expanded A") together with ARRAY[ANY] this generates an error (see below).
E.g. a call like
f(<<a>>)
with a and f declared as:
a : expanded A
f(ar: ARRAY[ANY]) is do ... end
is rejected by the compiler whereas both
f(a) (with f declared as: f(ar: ANY) is do ... end)
and
f(<<a>>) (with f declared as: f(ar: ARRAY[expanded A]) is do ... end)
are compiled as excepted.
I'm not sure wether this is intended by the specification of the Eiffel
language or a bug in the compiler. If it is the first, then (IMHO) this would
seem to be an unnecessary and unintelligible restriction of the language -
I've found other Eiffel compilers do accept expanded typed objects
inside ARRAY[ANY] with no error or warning.
Regards,
Pascal Poncin
Follows: Error message issued by the compiler
-------------------------------------------------------------------------------
Error code: VUAR(2)
Type error: non-conforming actual argument in feature call.
What to do: make sure that type of actual argument conforms to type
of corresponding formal argument.
Class: TEST
Feature: make
Called feature: dmp (ar: ARRAY [ANY]) from TEST
Argument name: ar
Argument position: 1
Actual argument type: <<expanded A>>
Formal argument type: ARRAY [ANY]
Line: 16
!!b
-> dmp(<<a>>)
end
-------------------------------------------------------------------------------
Degree: 3 Processed: 1 To go: 0 Total: 1
To Reproduce
--Version of TEST which generates error------------------------------------
class
TEST
creation
make
feature
make is
local
a: expanded A
b: A
do
!!b
dmp(<<a>>)
end
dmp(ar: ARRAY[ANY]) is -- <-- see Error message
do
-- do something with ar
end
end
--Version of TEST which generates no error-----------------------------------
class
TEST
creation
make
feature
make is
local
a: expanded A
b: A
do
!!b
dmp(<<a>>)
end
dmp(ar: ARRAY[expanded A]) is
do
-- do something with ar
end
end
---class A---------------------
class
A
feature
cookoo : STRING is "Hiih!"
end
Problem Report Interactions