|
|
|
|
|
|
|
Re: [Acceleo] eClass().name comparison not working .. [message #677779 is a reply to message #677746] |
Thu, 09 June 2011 07:27   |
Eclipse User |
|
|
|
As I Thought : you're not comparing "String"s, but a Sequence with a String. Acceleo has its own pretty printer for Collections so that we do not print the starting "[", the "," separator and the trailing "]" of the "normal" collection.toString(). That is why you have things that "seem" equals when printed, even though they are not. As for why it works with ".toString()", I won't enter in the details, but that, too, should fail. It works because of a parser shortcoming that's been highlighted in Acceleo 3.1 (i.e : in 3.1, you'd have at least two warnings with this module).
The problem is that we did not check for the validity of Queries return types. You could have a query returning a boolean value, yet declared as "[query public query() : String = true]". Your "getAKType(ModulePort)" query really returns a Sequence of Strings, not a String. "eInverse" returns a Sequence; all subsequent calls are implicit collect operations. You should rewrite it like this :
[query public getAKType(port : ModulePort) : String
= port.eInverse(Channel)->first().akType.oclAsType(AKTypeLiteral).value.eClass().name /]
On the contrary, "getAKType(port : VHDLPort)" properly returns a single String.
Laurent Goubet
Obeo
|
|
|
|
Powered by
FUDForum. Page generated in 0.05171 seconds