zio / zio

ZIO — A type-safe, composable library for async and concurrent programming in Scala
https://zio.dev
Apache License 2.0
4.07k stars 1.28k forks source link

Accessible macro generates misleading error message #5485

Open ollyw opened 3 years ago

ollyw commented 3 years ago

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 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.

vasiliy-bout commented 12 months ago

I have just come across this bug. Thanks to this issue on GitHub, I have been able to find the root cause quickly :)