Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 441767

Summary: Improve Acceleo 3 validation and completion by giving it more precise typing information
Product: [Modeling] Sirius Reporter: Pierre-Charles David <pierre-charles.david>
Component: CoreAssignee: Project inbox <sirius.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cedric.brun, esteban.dugueperoux, info
Version: 1.0.0Keywords: triaged
Target Milestone: 3.0.0   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 462481    
Bug Blocks:    

Description Pierre-Charles David CLA 2014-08-14 05:47:36 EDT
The validation of Acceleo 3 expressions inside a VSM require type information for all the expressions' context and available variables. Currently we default to EObject in many cases, but a more precise analysis is technically possible.
In particular:
* We should support "Change Context" operations (and "New Instance" and more generally any operation which changes the context): the expressions which are inside such an element should have a context type corresponding to the result of the "Change Context" expression (as much as can be determined statically anyway).
* Many variables which refer to semantic elements are typed as EObject, but in most cases we know in the VSM the Domain Class of the corresponding mapping, so we should be able to be more precise (so that users do not have to prefix their expressions with filter(ExpectedType).

This impacts the interpreter/query API, which currently provides no way to associate a type to variables. At validation/static time, we default to EObject, and at runtime we use the actual instance type. We should be able to reify the expected type environement from the VSM and user meta-model, use this for validation and completion at sepcification time (inside the VSM), and also at runtime to compile only one variant of each Acceleo expression (currently each combination of concrete types seen by the Acceleo compiler at runtime produces a separate dynamic module).
Comment 1 Pierre-Charles David CLA 2015-06-15 10:43:46 EDT
This was done in a generic way (for all supported query languages) as part of bug #462481 "Leverage type information provided by IInterpreter instances".
Comment 2 Pierre-Charles David CLA 2015-06-16 11:41:26 EDT
See previous comment (forgot to change the state).
Comment 3 Pierre-Charles David CLA 2015-06-24 11:12:49 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.