Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313669 - Query type is not checked
Summary: Query type is not checked
Status: CLOSED FIXED
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC All
: P2 major
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 294459
  Show dependency tree
 
Reported: 2010-05-20 04:19 EDT by Mikaël Barbero CLA
Modified: 2010-12-17 09:10 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.