PR# 3426 VTCG-6 not checked
Problem Report Summary
Submitter: ericbe
Category: Compiler
Priority: Low
Date: 2003/05/18
Class: Bug
Severity: Non-critical
Number: 3426
Release: 5.4.0229
Confidential: No
Status: Open
Responsible:
Environment: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2
Synopsis: VTCG-6 not checked
Description
It seems to me that VTCG-6, described in ETL3 4.82-00-00 page 262 (chapter 12) is not enforced by ISE Eiffel. This rule says that the actual generic parameters should have as creation procedures the procedures listed in the Constraint_creators clause of the constraint associated with their corresponding formal parameters. So in the example below: ------------------------ class AA creation make feature make is do create foo foo.f end foo: FOO [COMPARABLE] end ------------------------ class FOO [G -> COMPARABLE create default_create end] feature f is local a: G do create a print (a.generating_type) end end ------------------------ the compiler should have complained because in class A `foo' is declared of type FOO[COMPARABLE], but `default_create' is not a creation procedure of the actual generic parameter COMPARABLE (indeed, this class is deferred). Instead of that, the program crashed at runtime when attempting to create an instance of the deferred class COMPARABLE. Note that I didn't check yet what effect fixing this bug would have on AXA's source code. I will implement the checking of VTCG-6 in my Gobo lint tool and run it on AXA's source code to see if any of our classes violates this rule. I'll let you know the result. Also, I noticed that ISE Eiffel reports a syntax error when compiling: class A [G -> B create end] end But, although not very useful, ETL3 seems to allow empty Constraint_creators clauses. Indeed, Feature_list used in ETL3 4.82-00-00 page 261 (chapter 12) is declared in page 136 (chapter 7) as a list of zero or more Feature_name.
To Reproduce
Problem Report Interactions
From: Eric Bezault <ebezault@axarosenberg.com> To: "'bugs@berkeley.eiffel.com'" <bugs@berkeley.eiffel.com> Cc: "'manus@eiffel.com'" <manus@eiffel.com>, RC_Tools <RC_Tools@axarosenberg.com> Subject: RE: Compiler/3426 Date: Sun, 18 May 2003 18:29:09 -0700 I guess I got too much sun on my head this afternoon. The rule I was talking about is not VTCG-6 but VTCG-4. Furthermore it seems that this rule is actually enforced when the actual generic parameter is not deferred: ------------------------------ class AA creation make feature make is do create foo foo.f end foo: FOO [STRING] end ------------------------------ although the error message is quite confusing: ------------------------------ 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: AA In declaration: FOO [ .... Output truncated, Click download to get the full message