Serialization requires names to be "more unique" than other parts of the language implemen [message #1821237] |
Fri, 07 February 2020 17:40 |
Stephan Herrmann Messages: 1853 Registered: July 2009 |
Senior Member |
|
|
In one of our DSLs, some root object may contain children of different types, and scoping is set up such that cross references to those children are type aware. As a result the following structure is legal (assume that these are keywords: model, elemA, elemB, refA):
model M1 {
elemA x
elemB x
}
model M2 {
refA M1.x
}
We have two distinct EObjects with qualified name M1.x but different types. Resolving M2.refA is not ambiguous because scoping for feature refA only looks for elements of type ElemA, not ElemB. So, resolving of cross references works. Similarly also NamesAreUnique validation is silent, because EClasses ElemA and ElemB belong to different clusters.
As you can see all is fine, until ... until I try to serialize such a model.
I found this to go awry at the first "return false;" inside org.eclipse.xtext.scoping.impl.SimpleScope.getLocalElementsByEObject(...).new Predicate() {...}.canBeFoundByNameAndShadowingKey(IEObjectDescription). This return false causes serialization to fail because the given link target cannot be found in the scope.
I experimentally fixed this for my case by guarding the return with
if (input.getEClass().equals(other.getEClass()))
This naively mimics the clustering of NamesAreUnique validation, but probably for a real solution we'd need to access the actual clustering used during validation.
I'm I barking up some wrong tree or is this worth an issue in github?
thanks,
Stephan
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04618 seconds