Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive validation error on untyped query parameters #118

Open
eclipse-viatra-bot opened this issue Mar 12, 2024 · 1 comment
Open
Labels
bugzilla Issues migrated from Eclipse bugzilla. Query Issues related to the query component of VIATRA, including runtime or pattern language issues.

Comments

@eclipse-viatra-bot
Copy link

| --- | --- |
| 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'\

  • Type not defined for variable test, inferred type http://www.eclipse.org/emf/2002/Ecore::EObject\
    is used instead.
  • Variable type cannot be calculated unambiguously, the types
    [hu.qgears.viatra.bug.base1::OtherClass, hu.qgears.viatra.bug.base1::Base1]
    have no unique common supertype. The list of possible supertypes
    found are [EObject], specify one as the intended supertype.

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 eclipse-viatra-bot added bugzilla Issues migrated from Eclipse bugzilla. legacy Query Issues related to the query component of VIATRA, including runtime or pattern language issues. labels Mar 12, 2024
@eclipse-viatra-bot
Copy link
Author

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.

@ujhelyiz ujhelyiz removed the legacy label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from Eclipse bugzilla. Query Issues related to the query component of VIATRA, including runtime or pattern language issues.
Projects
None yet
Development

No branches or pull requests

2 participants