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

Type checking mistakes EDataType declarations #354

Closed ujhelyiz closed 11 years ago

ujhelyiz commented 11 years ago

UML introduces its own String datatype described in the hover help as:

EMF Type: String (http://www.eclipse.org/uml2/4.0.0/Types)
Java Type: java.lang.String

If I want to use a String literal to check the name of an UML property such as the following code

pattern classWithID(C) {
    find hasProperty(C, IDProperty);
    find hasName(IDProperty, "ID");
}

pattern hasName(Named : NamedElement, Name) {
    NamedElement.name(Named, Name);
}

I get a type error: The type infered from the called pattern (String) is different from the input literal/computational value (EString)

The issue seems erroneous, as the literals are compatible with all datatypes that refer to the same Java class. On the other hand, two different datatypes (e.g. EString and the UML String) are still not compatible.

Another, less serious issue with the error message is, that the type of the literal is considered EString, that was in this case a bit misleading (especially because UML used the same String name as Java :) ).

I don't know the exact priority of this issue, but it might worth looking at. The example code is available in https://github.com/ujhelyiz/EMF-IncQuery-Examples/blob/master/papyrus-uml/hu.bme.mit.examples.uml.incquery/src/uml/umltest.eiq - it was used with the Papyrus UML tool.

okrosa commented 11 years ago

@ujhelyiz I changed the logic and the error message as well. The testfile is working now, so I recommend that we should set this issue resolved (+ possibly move it to the maintenance branch as well).

okrosa commented 11 years ago

The master validator is refactored into the 0.6.10 branch, this issue should be fixed.