@@ -1038,22 +1038,25 @@ class Inliner(val call: tpd.Tree)(using Context):
1038
1038
val inlinedFrom = enclosingInlineds.last
1039
1039
val dependencies = macroDependencies(body)(using spliceContext)
1040
1040
val suspendable = ctx.compilationUnit.isSuspendable
1041
+ val printSuspensions = ctx.settings.XprintSuspension .value
1041
1042
if dependencies.nonEmpty && ! ctx.reporter.errorsReported then
1043
+ val hints : mutable.ListBuffer [String ] | Null =
1044
+ if printSuspensions then mutable.ListBuffer .empty[String ] else null
1042
1045
for sym <- dependencies do
1043
1046
if ctx.compilationUnit.source.file == sym.associatedFile then
1044
1047
report.error(em " Cannot call macro $sym defined in the same source file " , call.srcPos)
1045
1048
else if ctx.settings.YnoSuspendedUnits .value then
1046
1049
val addendum = " , suspension prevented by -Yno-suspended-units"
1047
1050
report.error(em " Cannot call macro $sym defined in the same compilation run $addendum" , call.srcPos)
1048
- if ( suspendable && ctx.settings. XprintSuspension .value)
1049
- report.echo( i " suspension triggered by macro call to ${sym.showLocated} in ${sym.associatedFile}" , call.srcPos)
1051
+ if suspendable && printSuspensions then
1052
+ hints.nn += i " suspension triggered by macro call to ${sym.showLocated} in ${sym.associatedFile}"
1050
1053
if suspendable then
1051
1054
if ctx.settings.YnoSuspendedUnits .value then
1052
1055
return ref(defn.Predef_undefined )
1053
1056
.withType(ErrorType (em " could not expand macro, suspended units are disabled by -Yno-suspended-units " ))
1054
1057
.withSpan(splicePos.span)
1055
1058
else
1056
- ctx.compilationUnit.suspend() // this throws a SuspendException
1059
+ ctx.compilationUnit.suspend(hints.nn.toList.mkString( " , " ) ) // this throws a SuspendException
1057
1060
1058
1061
val evaluatedSplice = inContext(quoted.MacroExpansion .context(inlinedFrom)) {
1059
1062
Splicer .splice(body, splicePos, inlinedFrom.srcPos, MacroClassLoader .fromContext)
0 commit comments