viatra / EMF-IncQuery

This repository is only kept for historic reasons. All development happens on eclipse.org
http://eclipse.org/viatra
13 stars 4 forks source link

incorrect "inconsistent variable type definition" error on EString #298

Closed abelhegedus closed 11 years ago

abelhegedus commented 11 years ago

The editor places an error in the Id variable in the following pattern definition:

pattern test(This : SomeType, Target : OtherType){
    SomeType.otherId(This, Id); // otherId is EString
    OtherType.id(Target, Id); // id is EString
}
ujhelyiz commented 11 years ago

It would be nice to also have a parser test case for this issue. Added the corresponding tag.

abelhegedus commented 11 years ago

The following query definition should produce the error but it seems that the issue only occurs with eiqgen referenced metamodels and not installed ones.

import "http://www.eclipse.org/viatra2/patternlanguage/core/PatternLanguage"

pattern inconsistentDataType(PM, P) {
    Pattern.name(P, Name);
    PatternModel.packageName(PM, Name);
    PatternModel.patterns(PM, P);
}
abelhegedus commented 11 years ago

The problem occurs when for some obscure reason (e.g. using Ecore.ecore elements in anothe ecore) there are two instances of EString in the resourceSet. In this case it happened when some features used the nsUri to refer to their type and others used the platformURI to Ecore.

According to @ujhelyiz we don't want to handle such extremeties, although we could add a last check to see if the two data types are semi-equal and return a different error message (e.g. "duplicate EDataType definition for EString")

istvanrath commented 11 years ago

@abelhegedus could you please check whether the new validation message is better?

abelhegedus commented 11 years ago

Yes, the updated message is more helpful.