Community
Participate
Working Groups
Build Identifier: Helios I have a class containing an attribute 'collect'. When referencing that in a DEFINE, Xpand gets confused. This is actually part of my template: «DEFINE download FOR Download-» «IF collect != null-» «name»|COLLECT|«collect.value.toString()» «ENDIF-» ... When using auto-completion, Xpand correctly offers the collect-attribute from Download. The interpreter anyway recognizes 'collect' as the 'collect()' Xtend built-in function and throws an error hinting that a '(' is missing behind 'collect'. I was really confused, especially since I did not know the Xtend function 'collect'. The error message was somehow misleading. After some time I was happy to find out that a had to escape the attribute's name by ^. Anyway, the error message needs to be improved. Reproducible: Always
I'm afraid that this can't be fixed easily, since 'collect' is a keyword and the only possible occurrence is in front of a '('. Also we cannot mark the property in your meta model since it is not defined within Xpand... Sorry. Thanks for posting anyway.
Maybe it is possible to automatically add the escape character (^) to the attribute's name when using the auto completion mechanism if the name conflicts with a keyword?
Yes, that's a good solution. Still a bit complicated, since the built-in function collect is also proposed.
Created attachment 177365 [details] Patch
Xpand and Extension SyntaxConstants are escaped
I've rejected the changes since they would add a '^' in every case. There are a lot of cases (select, collect, etc.) where the keyword is meant to be a keyword not an identifier. These cases need to be handled.
This is a batch close of open M2T Xpand bugs. It is not planned work on this component in the foreseeable future. If you think this issue needs to be solved and you plan to contribute a fix then feel free to reopen it.