| Summary: | Wrong ecore model inference | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Mark Christiaens <mark.g.j.christiaens> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | mark.g.j.christiaens, moritz.eysholdt, sebastian.zarnekow |
| Version: | 2.0.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
I'm actually working with something close to the head of the Xtext repo (higher than 2.0.1). Since C extends both G1 and G2 I don't see how the conflict can be avoided by the means of ecore inference.
To avoid that C inherits feature "blub" twice, you'd have to introduce a common super type for G1 and G2. This super type would then own "blub".
G1: B | C;
G2: C | D;
IsNeverCalled: G1 | G2;
B: 'b' blub=ID;
C: 'c' blub=ID;
D: 'd' blub=ID;
terminal ID: ('a'..'z')*;
This would produce an invalid ecore model, IIRC. Since C inherits from G1 and G2, it would end up with two features with the same name. Please reopen if the Ecore editor's validate action does not yield an error for such kind of model. Just tried this myself. You'd end up with
There may not be two features named 'blub' My.ecore /sample.help/src Unknown EMF Problem
for
<eClassifiers xsi:type="ecore:EClass" name="G1">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="G2">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="C" eSuperTypes="#//G1 #//G2"/>
Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
Build Identifier: 20110916-0149 The Xtext editor complains about the following grammar having duplicate features (in pretty much every class). G1: B | C; G2: C | D; B: 'b' blub=ID; C: 'c' blub=ID; D: 'd' blub=ID; terminal ID: ('a'..'z')*; I expect the "blub" feature field to present in G1 and G2 and not conflict. Reproducible: Always