Bug 486045 - oclAsType() don't merge its NothingType
Summary: oclAsType() don't merge its NothingType
Status: RESOLVED FIXED
Alias: None
Product: Acceleo
Classification: Modeling
Component: Query Language (show other bugs)
Version: 3.6.0   Edit
Hardware: PC Linux
: P3 normal
Target Milestone: ---   Edit
Assignee: Yvan Lussaud CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 483377 486046 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-01-18 10:06 EST by Yvan Lussaud CLA
Modified: 2016-04-20 06:02 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yvan Lussaud CLA 2016-01-18 10:06:29 EST
The service oclAsType() don't merge its NothingType. To fix this we should change the validateAllType() for instance by extending FilterService... or fix the filter index...
Comment 1 Laurent Goubet CLA 2016-01-29 05:19:40 EST
I think we should simply ignore all messages from oclAsType if at least one possibility is correct. For example,

car.eContainer().oclAsType(Garage)

will _never_ validate without errors. As long as Ecore is registered as a package in the environment, "EAnnotation.reference" is a reference that can hold any EObject, so EAnnotation will be seen as a potential eContainer for our car, and of course EAnnotation cannot be cast (oclAsType) into Garage.

However, the user uses "oclAsType" exactly because he knows (or think he knows) what he's doing. We are to assume that he knows the container of his car is a garage, and the validation shouldn't return any error : there exists one possible case in which the cast won't fail.
Comment 2 Yvan Lussaud CLA 2016-02-01 05:40:32 EST
This is correct but a bit trickier than it sounds. Indeed the validation of a service is called many time with different types (different combination can also match different services) so to cope with that I introduced the IService.validateAllType() method. But I called it in the inner validation loop ValidationServices.callType(). At first it seems to work but on some case upper loops already start to trigget many times ValidationServices.callType() leading to many call to IService.validateAllType()... It's no what we want as it could trigger this issue.

What we need to do is move the IService.validateAllType() call to AstValidator.caseCall() to make sure we call is once per call. Due to other review I suggest to delay this fix after we merge:

https://git.eclipse.org/r/65281
https://git.eclipse.org/r/65473

By the way my fist comment is all wrong... Laurent your comment is right but this looks like it's already done at the service level.
Comment 3 Eclipse Genie CLA 2016-02-01 05:55:56 EST
New Gerrit change created: https://git.eclipse.org/r/65546
Comment 4 Yvan Lussaud CLA 2016-02-02 08:59:24 EST
*** Bug 486046 has been marked as a duplicate of this bug. ***
Comment 6 Laurent Goubet CLA 2016-04-20 06:02:44 EDT
*** Bug 483377 has been marked as a duplicate of this bug. ***