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

Bug 313669

Summary: Query type is not checked
Product: [Modeling] Acceleo Reporter: Mikaël Barbero <mikael.barbero>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P2 CC: jonathan.musset, mikael.barbero, stephane.begaudeau
Version: 3.0.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 294459    

Description Mikaël Barbero CLA 2010-05-20 04:19:35 EDT
The type of a Query is not checked against the type of its expression. 

For instance, the queries

[query public aQuery(e : Class) : String = 
	Set{}
/]

[query public anotherQuery(e : Class) : String = 
	true
/]

[query public anotherQuery2(e : Class) : Set(String) = 
	Sequence{''}
/]

do not throw compilation errors although they should.

The side effect of this bug is that Acceleo queries are typed with the OclExpression's type and not the type of the query.

Regards,

Mikael
Comment 1 Jonathan MUSSET CLA 2010-05-20 09:28:51 EDT
Priority has changed
Comment 2 Jonathan MUSSET CLA 2010-05-21 04:58:33 EDT
We won't fix that for Helios because it is more complicated than we expected.
But, we'll plan to do that for Acceleo 3.1 M1.

The problem is more general when we use OCL expressions in variable declaration, statements or queries.

[myExpr/] -> We should check that myExpr is a String
[protected(myExpr)/] -> We should check that myExpr is a String

[query public myQuery(myClass : Class) : Element = myClass/] must compile because myClass is kind of Element

We also change the priority
Comment 3 Stephane Begaudeau CLA 2010-12-17 09:10:06 EST
Query type will be checked and possible errors will be reported with a warning.
Contributed on head and available in Acceleo 3.1.0 M5.