Node under $COPY_SRCL$ macro should have multiple cardinality
Hello,
I have written the following code in a reduction rule for a swing compoennt:

I use the $COPY_SRCL$ macro in several instances to fill in the body statements from the model. For example, the code for the very first usage of the macro looks like this:

This works fine. However, in the third instance (for the function "getInitValue"), where I use the very same principle as above, I get the error message: "Node under $COPY_SRCL$ macro should have multiple cardinality"

Notice that in both cases the "body.statement" part is the statement child from StatementList from the baseLanguage.
I do not understand why this is happening.
Robert
Please sign in to leave a comment.
So, I guess one way to get rid of this error message is to use the "body" instead of its "statements" to replace the return statement:
The generated code looks the same, but the error message goes away.
It may be that you selected the function body (StatementList[1]) instead of body.statements (Statement[0..n]) as the target of $COPY_SRC$. It's normally not easily doable* but apparently you managed to do it somehow. It looks the same in the editor so the difference is hard to tell.
*It's doable if you configure the project pane (Logical View) to show node contents and double-click the StatementList node to select it.
I certainly didn't do anything like that to select the StatementList explicitly, but thanks for the hint.