PR# 19413 [er] Full class checking and VGCC-2
Problem Report Summary
Submitter: axarosenberg
Category: Compiler
Priority: High
Date: 2017/11/28
Class: Bug
Severity: Serious
Number: 19413
Release: 17.11
Confidential: No
Status: Open
Responsible:
Environment: win
Synopsis: [er] Full class checking and VGCC-2
Description
When compiling the code below in full_class_checking mode, we get a VGCC-2 error: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ VGCC(2) Creation instruction applies to target of a deferred type. Type error: creation instruction applies to target of a deferred type. What to do: make sure that type of target is effective. Class: DISPOSABLE_HASH_TABLE [G, H -> HASHABLE] Source class: HASH_TABLE [G, K -> HASHABLE] Feature: empty_duplicate Creation of: Result Target type set: [detachable like Current] detachable DISPOSABLE_HASH_TABLE [Generic #1, Generic #2] Deferred classes: DISPOSABLE_HASH_TABLE Line: 1144 do -> create Result.make (n) if object_comparison then ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is unfortunate because 'Result' is declared of type 'like Current' and the current class being deferred, there is no danger to create such thing at run-time. To fix this error, one has to undefined feature `empty_duplicate' in the deferred class DISPOSABLE_HASH_TABLE and then copy/paste it back in all its concrete descendants. This is not attractive and error prone if in the implementation of `empty_duplicate' gets changed in class HASH_TABLE in the future. In the Gobo tools, such error (creation of an entity of type 'like Current' when checked from a deferred descendant class) is not reported when checking the validity of features in the context of descendant classes in full class checking mode. It would be nice if EiffelStudio could do the same. -- Eric Bezault
To Reproduce
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class TEST create make feature make local ht: MY_HASH_TABLE [STRING, STRING] do create ht.make (10) end end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ deferred class DISPOSABLE_HASH_TABLE [G, H -> detachable HASHABLE] inherit HASH_TABLE [G, H] DISPOSABLE undefine copy, is_equal end end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class MY_HASH_TABLE [G, H -> detachable HASHABLE] inherit DISPOSABLE_HASH_TABLE [G, H] create make, make_equal feature dispose do end end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Problem Report Interactions
I just realized that copy/paste is not the only solution. We can just inherit again from HASH_TABLE in MY_HASH_TABLE to bring back the implementation of `empty_duplicate'. -- Eric Bezault