Odd behavior or bug in deep assignments statements

I recently found either a bug in deep assignments or at least an odd side effect.

In my case I have a queue with a sub group.

MyGroup GROUP,TYPE
Field1 LONG
END
MyQueue QUEUE,Type
Field1 LONG
Field2 LONG
MG LIKE(MyGroup)
END
MyQ1 QUEUE(MyQueue)
END
MyQ2 QUEUE(MyQueue)
END

MyQ1 :=: MyQ2

If you have 2 of MyQueues and do a deep assignment from one to the other, the Field1 in MyQueue ends up with the values from the MyQueue.MG.Field1.
Something to be aware of. I’ve submitted to SV Support to see if this is a bug or just the way deep assignment works. This was tested in Clarion 9.1.11529.

Reading the LRM[Deep Assignment] it says (in part)

The :=: sign executes a deep assignment statement which performs multiple individual component variable assignments from one data structure to another. The assignments are only performed between the variables within each structure that have exactly matching labels, ignoring all prefixes. The compiler looks within nested GROUP structures to find matching labels.

So while it talks about prefixes, since there are none, that doesn’t apply here. (congrats - IMO prefixes should be avoided, except on files - where they are required for keys)

It does say it looks within nested GROUP structures to find matching labels but it doesn’t talk about labels that would be duplicates were it not for dot notations. Which is the crux of the issue you’re reporting. My guess is that documentation was written before we had dot notations (which is to say a very long time ago)

Lastly, given the example you showed, where both MyQ1 and MyQ2 have identical structures, it bears repeating the last narrative of the LRM[Deep Assignment]

Finally, whenever possible is it always more efficient to use a direct assignment of two matching structures in lieu of deep assignments.

IOW, please avoid using deep assignment whenever you can use a simple assignment instead.