$\begingroup$When test@1 is executed, at some point a Function is constructed and it appears the argument a$224638 is rewritten in the standard way by adding $; namely the new argument is a$224638$. Thus the value of a fails to be injected into Sow[a$224638]. WRI might consider it a bug, if you report it.$\endgroup$
– Michael E2Jan 12 '18 at 15:20

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.