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

Erroneous patterns can be loaded into Query Explorer #362

Closed istvanrath closed 11 years ago

istvanrath commented 11 years ago

It is possible to load an erroneous pattern into the Query Explorer, e.g. by referring a non-existent type in the body.

For instance,

pattern schoolsNames(SchName) {
    School.names(_Sch, SchName);
}

can be loaded (even though School.names is non-existent), and the Query Explorer will display "no matches". Is this the intended behaviour? (Note: the pattern editor correctly displays the error.)

@ujhelyiz or @szabta89 please take a look at this.

ujhelyiz commented 11 years ago

The short-term solution is to validate linker errors before executed by the matcher.

ujhelyiz commented 11 years ago

I updated the code in the master branch to look for linker/parser errors as well.

Sadly, because of the internals of Xtext/EMF there is no way to look for linker issues without checking the corresponding Resource - if there is no Resource for the selected pattern, this validation will not and cannot run. The other problem with this approach is that it might be more Resource-intensive.

@bergmanngabor Can you please review the code I attached to the issue?

@istvanrath Can you please review that this changes the behaviour, while does not cause too much slowdown?

bergmanngabor commented 11 years ago

@bergmanngabor Can you please review the code I attached to the issue?

I believe it is OK.

istvanrath commented 11 years ago

@ujhelyiz I did not notice slowdown, but my computer might not be the best choice to identify performance problems :P

istvanrath commented 11 years ago

also, the behavior seems to be correct

ujhelyiz commented 11 years ago

Changes cherry picked into maintenance branch.