Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3.7.7] How to(Acceleo seems having problem of type checking dealing with Sequence(Sequence(...)))
[Acceleo 3.7.7] How to [message #1802807] Sun, 17 February 2019 00:00 Go to next message
Didier Garcin is currently offline Didier GarcinFriend
Messages: 68
Registered: April 2013
Member
This Acceleo code

[query public associationSignatures(ownedEnds : Sequence(Property)) : Sequence(Sequence(Property)) =
if ownedEnds->size() = 0 then
   Sequence(Sequence(Property)){}
else
   let ownedEnd : Property = ownedEnds->first() in
   let last_ownedEnds : Sequence(Property) = ownedEnds->subSequence(2,ownedEnds->size()) in
   let last_signatures : Sequence(Sequence(Property)) = associationSignatures(last_ownedEnds) in
   let signatures_with_ownedEnd : Sequence(Sequence(Property)) 
                                = last_signatures->collect(signature : Sequence(Property)
                                                         | signature->prepend(ownedEnd)) in 
   if ownedEnd.lower = 0 then
      last_signatures->union(signatures_with_ownedEnd)
   else
      signatures_with_ownedEnd
   endif
endif
/]


causes this problem :
Init expression type does not conform to type of variable (signatures_with_ownedEnd).

How to correct it ?

I've tried things like ->asSequence(), convert in Collection, ... don't work.

Thanks for your help

[Updated on: Sun, 17 February 2019 13:01]

Report message to a moderator

Re: How to [message #1802814 is a reply to message #1802807] Sun, 17 February 2019 06:02 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Without a more complete repo it is impossible to see what you are actually seeing, and even less possible to see how / where you tried asSequence().

Both users and Acceleo are sometimes poor at predicting what the actual types are. I forget whether Acceleo's hovertext is useful/trustworthy. Introducing more let variables with explicit typing can help the user see where the expectation and the actuality deviate and decide whether it is the user or Acceleo that is at fault. Once you localize it you can usually workaround an Acceleo limitation.

Regards

Ed Willink
Re: How to [message #1802818 is a reply to message #1802814] Sun, 17 February 2019 08:41 Go to previous messageGo to next message
Didier Garcin is currently offline Didier GarcinFriend
Messages: 68
Registered: April 2013
Member
No Message Body

[Updated on: Sun, 17 February 2019 08:52]

Report message to a moderator

Re: How to [message #1802819 is a reply to message #1802818] Sun, 17 February 2019 08:42 Go to previous messageGo to next message
Didier Garcin is currently offline Didier GarcinFriend
Messages: 68
Registered: April 2013
Member
Didier Garcin wrote on Sun, 17 February 2019 08:41
Ed Willink wrote on Sun, 17 February 2019 06:02
Hi
Without a more complete repo it is impossible to see what you are actually seeing, and even less possible to see how / where you tried asSequence().


Hi Ed

It's at compile-time, it appears. As a result, just need to create an Acceleo project with UML as meta-model.

Right ?

Cheers

[Updated on: Sun, 17 February 2019 08:50]

Report message to a moderator

Re: How to [message #1802821 is a reply to message #1802819] Sun, 17 February 2019 11:34 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
[quote title=Didier Garcin wrote on Sun, 17 February 2019 03:42]Didier Garcin wrote on Sun, 17 February 2019 08:41
Right ?


No idea. It's your question.

See https://wiki.eclipse.org/OCL/ForumNetiquette

Regards

Ed Willink
Previous Topic:Is it possible to generate Java code from a resource only loaded in memory?
Next Topic:Complex query question
Goto Forum:
  


Current Time: Tue Apr 16 06:00:46 GMT 2024

Powered by FUDForum. Page generated in 0.15140 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top