Make compilable with -Xcheck-macros#278
Make compilable with -Xcheck-macros#278OndrejSpanel wants to merge 4 commits intosoftwaremill:masterfrom
Conversation
|
@OndrejSpanel Do you want to try fixing those or should I take a look at it? |
|
I was trying to fix the second error (Reference to a method must be eta-expanded before it is used as an expression) fixed for default values, but I was not successful so far. I was trying to add the expansion by adding |
|
Out of curiosity - are these bugs in quicklens, or how are the macros checked? |
|
They are macro related. In practice this means, that they break some invariants about the generated code, to it could potentially cause bugs for some edge cases. Though, IMHO it is probably very unlikely for the second one to cause any bugs. |
The trouble is once any macro library used in the project causes -Xcheck-macros failures, it is quite difficult to check the rest of the project. I was motivated to open this by the fact my project is crashing with 3.7.0 because of some macro bug in https://github.com/OpenGrabeso/light-surface/. |
|
|
I guess there's also the non-zero chance that since we are producing working code, the invariants are somehow too strict? :) |
Maybe, or maybe you are in the Undefined Behaviour territory and anything can happen (including working code). This seems to be the case with the crash caused by the https://github.com/OpenGrabeso/light-surface/ - it was also producing a working code (with plenty of -Xcheck-macros violations), but the code is not working anymore with 3.7 compiler. I have tried to understand what exactly is violated in quicklens and how to work around that, but after spending about an hour I did not achieve much. |
|
Ah yes, undefined behavior makes more sense:) |
|
Looks like one of the errors was actually an obvious unsoundness 🙃 |
|
You can use following to add settings for Scala3 only: |
At this moment the PR only enables -Xcheck-macros. The library does not compile, there are 5 errors.
Once there is:
And four times there are variants of:
Hopefully solving those should not be very difficult?