Community
Participate
Working Groups
Build Identifier: Build id: I20100608-0911 If someone creates a template which takes a sequence or an orderedset (or I think any type of collection) and if inside that sequence you have some invocation of templates, the result of the invocation will be considered as an "ocl invalid result". See: http://www.eclipse.org/forums/index.php?t=rview&goto=545350#msg_545350 Reproducible: Always
Created attachment 173747 [details] Templates which reproduce the problem When tested with that file, there seems to be a problem with the resolution of [args->first()/]. It seems that someone (Acceleo ?, ocl ?) is not able to link correctly the content of the sequence with the result of the template evaluation. the problem must be somewhere in org.eclipse.acceleo.engine.AcceleoEvaluationException when we visit the invocation of the template generateList, the parameter "args" is not resolved correctly.
As noted in the newsgroup, I think the problem is solely in the quality of the diagnostic; the user model is wrong, since it creates a Sequence of template return values, which are only valid for serialisation to the output. A query has to be used to get a value. So; either diagnose use of a template return as a value, or convert a template return to a string so that a template call is an OperationCallExp returning a String. If you choose to do the latter, I would wait until you want to use the new MDT/OCL evaluator, since adding functionality to the EvaluationVisitorImpl for an OperationCallExp is not easy.
Created attachment 180445 [details] Patch v1.0 This patch will solve the problem for the template on the bugzilla but I cannot say if it would be enough to solve all cases in which that bug may appear. I will need to create some unit test to identify all cases in which the problem can appear and to see if that fix works in all cases (I dont think so). More infos here: http://www.eclipse.org/forums/index.php?t=msg&S=10bea96b36b94d6d3a37df7e84421fc8&th=171462&goto=631500#msg_631500
Created attachment 183670 [details] Patch v2.0 This patch is an improved version of the first one. Now the correction will be applied recursively on each variables. So it works for something like this: someTemplate(Bag{Set{OrderedSet{Sequence{myTemplate(myVariable)}}}}).
Contributed on head and maintenance. The fix will be available in Acceleo 3.1.0M4 and in Acceleo 3.0.2.