PR# 19293 [er] Non-conforming inheritance: VMRC-1
Problem Report Summary
Submitter: axarosenberg
Category: Compiler
Priority: Low
Date: 2016/11/17
Class: Bug
Severity: Non-critical
Number: 19293
Release: 16.05
Confidential: No
Status: Suspended
Responsible: alexk_es
Environment: win
Synopsis: [er] Non-conforming inheritance: VMRC-1
Description
EiffelStudio compiles this code without complaining:
~~~~~~~~~~~~~~~~~
class AA
feature
f
do
end
end
~~~~~~~~~~~~~~~~~
class BB
inherit {NONE}
AA
rename
f as f1
end
AA
rename
f as f2
end
end
~~~~~~~~~~~~~~~~~
But it reports a VMRC-2 error in class EE when compiling this code:
~~~~~~~~~~~~~~~~~
class CC
inherit {NONE}
AA
rename
f as f1
end
end
~~~~~~~~~~~~~~~~~
class DD
inherit {NONE}
AA
rename
f as f2
end
end
~~~~~~~~~~~~~~~~~
class EE
inherit
CC
DD
end
~~~~~~~~~~~~~~~~~
But in the ECMA document, we have:
~~~~~~~~~~~~~~~~~
8.16.10Â Validity: Repeated Inheritance Consistency constraint
Code: VMRC
It is valid for a class D to have two or more versions of a feature f of a proper ancestor A if and only if it satisfies one of the following conditions:
1. There is at most one conformance path from D to A.
2. There are two or more conformance paths, and the Parent clause for exactly one of them in D has a Select clause listing the name of the version of f from the corresponding parent.
~~~~~~~~~~~~~~~~~
So, there is no conformance path between class EE and class AA, so we are in case VMRC-1 and the code should be accepted, as it is in the first example.
--
Eric Bezault
To Reproduce
Problem Report Interactions
Our current implementation of non-conforming inheritance is not complete at the moment. There is a hidden switch that follows the standard better but it was a breaking changes for existing library. We should have disabled the support as well instead of relying on this hidden option. For the time being, we would recommend not using it.