eclipse-viatra / org.eclipse.viatra

Main components of the VIATRA framework
https://eclipse.dev/viatra
Eclipse Public License 2.0
1 stars 1 forks source link

False positive validation error on untyped query parameters #118

Open eclipse-viatra-bot opened 6 months ago

eclipse-viatra-bot commented 6 months ago

| --- | --- | | Bugzilla Link | 561652 | | Status | UNCONFIRMED | | Importance | P3 normal | | Reported | Apr 01, 2020 10:54 EDT | | Modified | Apr 03, 2020 11:56 EDT | | Version | 2.3.1 | | Reporter | István Ágoston |

Description

I got an error (not warning, which would be ok) message on the following query:

pattern bug1_(test ){\ find matchingBase1(test);\ } or {\ find matchingOther(test);\ }

private pattern matchingOther(o : OtherClass){\ OtherClass.ref(o,"test");\ }\ private pattern matchingBase1(b : Base1){\ Base1.b1Prop(b,1);\ }

The error says: Multiple errors on 'test'\

Workaround:

pattern bug1Workaround(test : EObject){\ find matchingBase1(test);\ } or {\ find matchingOther(test);\ }

I'm not sure this is a bug, but the mentioned syntax worked with earlier versions (1.6.0). And also works, if I do not call other patterns (with 'find' keyword) from pattern body.

The full example project is available on github : https://github.com/agostoni/bugreports/tree/master/viatra/hu.qgears.viatra.bug.patterns

eclipse-viatra-bot commented 6 months ago

By Zoltan Ujhelyi on Apr 03, 2020 11:56

Sorry for the late response, I did not have time to respond before.

In general, we strongly recommend always defining the types of pattern parameters, as that helps both with the parsing times and providing better feedback - so I suggest going with the workaround as a stable solution.

Regardless, the issue you have seen is truly misleading and should be fixed in our end. It is most likely related to the fact that the inferred parameter is EObject that we have already received reports we are not handling correctly, e.g. bug 506471 and bug 541567 also point at similar issues.