Skip to content

Commit 5a83848

Browse files
committed
Capture missing class when loading methods
Fixes #13516
1 parent 01be968 commit 5a83848

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

compiler/src/dotty/tools/dotc/transform/Splicer.scala

+4
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,10 @@ object Splicer {
422422
case _: NoSuchMethodException =>
423423
val msg = em"Could not find method ${clazz.getCanonicalName}.$name with parameters ($paramClasses%, %)"
424424
throw new StopInterpretation(msg, pos)
425+
case MissingClassDefinedInCurrentRun(sym) if ctx.compilationUnit.isSuspendable =>
426+
if (ctx.settings.XprintSuspension.value)
427+
report.echo(i"suspension triggered by a dependency on $sym", pos)
428+
ctx.compilationUnit.suspend() // this throws a SuspendException
425429
}
426430

427431
private def stopIfRuntimeException[T](thunk: => T, method: JLRMethod): T =
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import scala.quoted.*
2+
object Persistance:
3+
inline def nameOf(inline e: Any): String = ${ nameOfImpl('e) }
4+
private def nameOfImpl(e: Expr[Any])(using Quotes): Expr[String] = Expr("")
5+
def foo(p: Versioned): Unit = {}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// nopos-error
2+
class Versioned:
3+
def serialize: String = Persistance.nameOf(0)

0 commit comments

Comments
 (0)