eclipse / epsilon

Epsilon is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that work out of the box with EMF (including Xtext and Sirius), UML (including Cameo/MagicDraw), Simulink, XML and other types of models.
https://eclipse.org/epsilon
Eclipse Public License 2.0
55 stars 11 forks source link

Ambiguous types within a model are not reported #34

Closed agarciadom closed 1 year ago

agarciadom commented 1 year ago

I wrote an EVL script meant to be used within a Sirius diagram, and noticed it wasn't producing the expected errors. I turns out that I had an ambiguous NamedElement type reference in the script, which was being resolved to the Edapt NamedElement instead of my own NamedElement for a toy flowcharts metamodel. We should have issued a warning about this, instead of blindly going on with the first option.

We already have some code to detect ambiguous type references, but they only cover the case where different models have a match for the same name. They don't cover the case where a single model has multiple matches for the same name (quite common when running EVL scripts from Sirius, as the resource set has the full Eclipse package registry).

One issue is that the EMC API right now only has hasType(typeName): there's no checkAmbiguity(typeName) like what we have for the ModelRepository class. We need to extend that API to have its own version of this method for when the type name is ambiguous within a single model. We can provide a default implementation to ensure that existing EMC drivers continue to work without changes.

agarciadom commented 1 year ago

This was fixed with PR #35 .