I am not sure what you mean with "different behavior with and without scalac optimization enabled". I added inline annotation just for optimization purposes. Important is, that I changed method call from n.nodeType to n.nodePeekType in  the message. So if you want skip logging or use macro here, just do it :-).