Detect macro dependencies that are missing from the classloader #20139
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So the situation is basically that
DFiant
andhtml.scala
projects do not work "out of the box" with pipelining, and will need to tune their builds if they want some pipelining.However, the compiler reports an error that is not helpful to the user, so in this PR we report a better one.
Previously, it was assumed that a missing class (that is valid in current run)
during macro evaluation was due to the symbol being defined in the same project.
If this condition is met, then compilation is suspended.
This assumption breaks when the symbol comes from the classpath, but without a
corresponding class file, leading a situation where the same file is always suspended,
until it is the only one left, leading to the "cyclic macro dependencies" error.
In this case we should assume that the class file will never become available because class path entries
are supposed to be immutable. Therefore we should not suspend in this case.
This commit therefore detects this situation. Instead of suspending the unit,
the compiler aborts the macro expansion, reporting an error that
the user will have to deal with - likely by changing the build definition/
In the end, users will see something like:
and
which is more actionable.
Note that sbt already automatically disables pipelining on projects that define macros, but this is not useful if the macro itself depends on upstream projects that do not define macros. This is probably a hard problem to detect automatically - so this is good compromise.
We also fix
-Xprint-suspension
, which appeared to swallow a lot of diagnostic information.Also make
-Yno-suspended-units
behave better.fixes #20119