diff --git a/compiler/src/dotty/tools/dotc/transform/Splicer.scala b/compiler/src/dotty/tools/dotc/transform/Splicer.scala index e950c125f43d..06162ef513fa 100644 --- a/compiler/src/dotty/tools/dotc/transform/Splicer.scala +++ b/compiler/src/dotty/tools/dotc/transform/Splicer.scala @@ -422,6 +422,10 @@ object Splicer { case _: NoSuchMethodException => val msg = em"Could not find method ${clazz.getCanonicalName}.$name with parameters ($paramClasses%, %)" throw new StopInterpretation(msg, pos) + case MissingClassDefinedInCurrentRun(sym) if ctx.compilationUnit.isSuspendable => + if (ctx.settings.XprintSuspension.value) + report.echo(i"suspension triggered by a dependency on $sym", pos) + ctx.compilationUnit.suspend() // this throws a SuspendException } private def stopIfRuntimeException[T](thunk: => T, method: JLRMethod): T = diff --git a/tests/neg-macros/i13516/Persistance.scala b/tests/neg-macros/i13516/Persistance.scala new file mode 100644 index 000000000000..dbabf59c7267 --- /dev/null +++ b/tests/neg-macros/i13516/Persistance.scala @@ -0,0 +1,5 @@ +import scala.quoted.* +object Persistance: + inline def nameOf(inline e: Any): String = ${ nameOfImpl('e) } + private def nameOfImpl(e: Expr[Any])(using Quotes): Expr[String] = Expr("") + def foo(p: Versioned): Unit = {} diff --git a/tests/neg-macros/i13516/Versioned.scala b/tests/neg-macros/i13516/Versioned.scala new file mode 100644 index 000000000000..a7e10b2c8549 --- /dev/null +++ b/tests/neg-macros/i13516/Versioned.scala @@ -0,0 +1,3 @@ +// nopos-error +class Versioned: + def serialize: String = Persistance.nameOf(0)