When making a mistake when coding and including import zio.macros.accessible into a file twice, the error can be very misleading. Yes, this is a stupid mistake, but can be common with refactoring/newbies/etc. The issue was that the compilation error was enable macro paradise to expand macro annotations. After triple checking, I can confirm that macro paradise was already enabled and active. If I remove the double import, everything works. Eventually I found out that this is the message from zio, not Scalac with compileTimeOnly on the accessible macro.
There is one clear change that can be made, to provide a more specific error that leaves the possibility for other causes of this error.
Further questions remain. It would be useful to be able to answer:
I try and recreate in a simple reproducer by duplicating the import in AccessibleMacroExample in zio, the error is different. The macro runs, but doesn't generate the accessors. This is going to be equally as confusing for newbies.
Why is the simple reproducer different? The scala version was the same, but perhaps some other compiler flags or structure of the code make a difference.
What is the underlying mechanism that causes the accessible macro to remain in my example, and compileTimeOnly to cause the error message?
I will try and make another reproducer if I get some more spare time, but perhaps someone with superior knowledge of the compiler may be able to identify the problem from the information in this issue report.
When making a mistake when coding and including
import zio.macros.accessible
into a file twice, the error can be very misleading. Yes, this is a stupid mistake, but can be common with refactoring/newbies/etc. The issue was that the compilation error wasenable macro paradise to expand macro annotations
. After triple checking, I can confirm that macro paradise was already enabled and active. If I remove the double import, everything works. Eventually I found out that this is the message from zio, not Scalac with compileTimeOnly on the accessible macro.There is one clear change that can be made, to provide a more specific error that leaves the possibility for other causes of this error.
Further questions remain. It would be useful to be able to answer:
I will try and make another reproducer if I get some more spare time, but perhaps someone with superior knowledge of the compiler may be able to identify the problem from the information in this issue report.