| Summary: | [typeInference] bug when combining alternatives and assigned actions | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Moritz Eysholdt <moritz.eysholdt> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sebastian.zarnekow, sqctrd |
| Version: | unspecified | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
Ouch. for the grammar
----
Model:
A ({Me.a = current} b = B)? c=C? ;
A :
{A} 'a';
B :
{B} 'b';
C :
{C} 'c';
----
the editor will meet an error when the input is like this,
---
a c
---
an exception is thrown.
An internal error occurred during: "XtextReconcilerJob".
java.lang.IllegalArgumentException: A.c does not exist.
Pushed to master. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
From the grammar --- TypeA: 'TA' TypeD ({TypeB.x=current} 'x' | {TypeC.x=current} 'y')? name+=STRING; TypeD: name+=ID; --- the folowing types are infered: class TypeA {} class TypeB extends TypeA { ref x; } class TypeC extends TypeA { ref x; } class TypeD extends TypeA { attr name; } this is wrong, because TypeB and TypeC can also have the attribute 'name'. Therefore, the attribute should have been pulled up to TypeA When removing the alternative from the grammar --- TypeA: 'TA' TypeD ({TypeB.x=current} 'x')? name+=STRING; TypeD: name+=ID; --- attribute 'name' is member of TypeA, as expected. This is actually the cause for bug 345521.