You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Detect macro dependencies that are missing from the classloader (#20139)
So the situation is basically that `DFiant` and `html.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 a more actionable error.
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
Copy file name to clipboardExpand all lines: compiler/src/dotty/tools/dotc/transform/MacroAnnotations.scala
+2-2
Original file line number
Diff line number
Diff line change
@@ -107,8 +107,8 @@ class MacroAnnotations(phase: IdentityDenotTransformer):
107
107
if!ctx.reporter.hasErrors then
108
108
report.error("Macro expansion was aborted by the macro without any errors reported. Macros should issue errors to end-users when aborting a macro expansion with StopMacroExpansion.", annot.tree)
0 commit comments