PR# 3707 VTCG: LINKED_LIST [expanded B], TUPLE [expanded B]

Problem Report Summary
Submitter: gobobe
Category: Compiler
Priority: Medium
Date: 2004/03/20
Class: Bug
Severity: Non-critical
Number: 3707
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: VTCG: LINKED_LIST [expanded B], TUPLE [expanded B]

Description
ISE Eiffel 5.5.0409 (just to make sure the Eiffel version appears in the bug report).

Consider that we have the following expanded class:

-------------------------
expanded class B

inherit

	ANY
		redefine
			default_create
		end

create

	default_create,
	make_from_reference

--convert
--	make_from_reference ({reference B}),
--	to_reference: {reference B}

feature

	default_create is
			-- 
		do
			i := 45
		end

	make_from_reference (b: reference B) is
		do
			i := 46
		end

	to_reference: reference B is
		do
			create Result.default_create
		end

	i: INTEGER

end
-------------------------

Then when I try to compile:

-------------------------
class A

create

	make

feature

	make is
		local
			l: LINKED_LIST [B]
		do
			create l.make
		end

end
-------------------------

I get the following error:

-------------------------------------------------------------------------------
Error code: VTCG
Error: actual generic parameter does not conform to constraint.
What to do: make sure that actual parameter is a type conforming to the
  constraint (the type appearing after `->' for the corresponding formal).

Class: A
Feature: make
Entity name: l

For type: LINKED_LIST [B]
Argument number: 1:
Actual generic parameter: B
Type to which it should conform: ANY
Line: 11
      local
->      l: LINKED_LIST [B]
      do
-------------------------------------------------------------------------------

I understand that 'expanded B' does not conform to ANY anymore, but I thought that the rule in ECMA was to say that the reference version of the actual generic parameter had to conform to the constraint. Anyway, this has to be discussed at ECMA because I guess that what you have in mind is also to make sense out of such instructions:

  a: ANY
  g: G
  a := g

which may appear in the text of the generic class.

Anyway, what I wanted to point out in this bug report is that when uncommenting the convert clause in class B, everything compiles fine. This is inconsistent with the error message that I got above. Indeed, B still does not conform to ANY, it converts to it (indirectly). So the error message should have probably said:

----
For type: LINKED_LIST [B]
Argument number: 1:
Actual generic parameter: B
Type to which it should conform OR CONVERT: ANY
----


And to add more inconsistency to all that, note that the following code compiles fine:

-----------------
class A

create

	make

feature

	make is
		local
			t: TUPLE [B]
		do
			create t
		end

end
-----------------

even when the convert clause in class B has been removed.
To Reproduce

										
Problem Report Interactions
From:gobobe    Date:2004/03/20    Download