I suppose I have no problem with this, but it does contradict behavior
mentioned in workers/54224.
I'm not sure it contradicts any behavior mentioned in workers/54224. It would rather enable some of the corner cases I had in mind. As I (have now) replied there, I will try to write some tests for these corner cases. The proposed patch should in principle already handle them correctly.
> + # The only purpose of this test is to define the helper functions
> + # needed by the tests below about assigning and typesetting named
> + # references in different contexts.
Is there a reason these shouldn't go in the %prep section?
Mainly locality. I find it easier/more convenient to define the functions in the context where they are used. But, if you prefer that we stick with the %prep section, I can move them there.
Philippe