diff --git a/compiler/src/dotty/tools/dotc/transform/Splicer.scala b/compiler/src/dotty/tools/dotc/transform/Splicer.scala index 58212e46f241..2970f21ac594 100644 --- a/compiler/src/dotty/tools/dotc/transform/Splicer.scala +++ b/compiler/src/dotty/tools/dotc/transform/Splicer.scala @@ -62,7 +62,7 @@ object Splicer { catch { case ex: CompilationUnit.SuspendException => throw ex - case ex: scala.quoted.report.StopQuotedContext if ctx.reporter.hasErrors => + case ex: scala.quoted.internal.StopMacroExpansion if ctx.reporter.hasErrors => // errors have been emitted EmptyTree case ex: StopInterpretation => @@ -419,7 +419,7 @@ object Splicer { throw new StopInterpretation(sw.toString, pos) case ex: InvocationTargetException => ex.getTargetException match { - case ex: scala.quoted.report.StopQuotedContext => + case ex: scala.quoted.internal.StopMacroExpansion => throw ex case MissingClassDefinedInCurrentRun(sym) if ctx.compilationUnit.isSuspendable => if (ctx.settings.XprintSuspension.value) diff --git a/library/src/scala/quoted/internal/StopMacroExpansion.scala b/library/src/scala/quoted/internal/StopMacroExpansion.scala new file mode 100644 index 000000000000..198651841c9e --- /dev/null +++ b/library/src/scala/quoted/internal/StopMacroExpansion.scala @@ -0,0 +1,4 @@ +package scala.quoted.internal + +/** Throwable used to stop the expansion of a macro after an error was reported */ +class StopMacroExpansion extends Throwable diff --git a/library/src/scala/quoted/report.scala b/library/src/scala/quoted/report.scala index 6ea786d4d7bd..d269a4d774a5 100644 --- a/library/src/scala/quoted/report.scala +++ b/library/src/scala/quoted/report.scala @@ -10,15 +10,15 @@ object report: def error(msg: => String, expr: Expr[Any])(using qctx: QuoteContext): Unit = qctx.reflect.Reporting.error(msg, expr.unseal.pos) - /** Report an error at the position of the macro expansion and throws a StopQuotedContext */ + /** Report an error at the position of the macro expansion and throws a StopMacroExpansion */ def throwError(msg: => String)(using qctx: QuoteContext): Nothing = { error(msg) - throw new StopQuotedContext + throw new internal.StopMacroExpansion } - /** Report an error at the on the position of `expr` and throws a StopQuotedContext */ + /** Report an error at the on the position of `expr` and throws a StopMacroExpansion */ def throwError(msg: => String, expr: Expr[Any])(using qctx: QuoteContext): Nothing = { error(msg, expr) - throw new StopQuotedContext + throw new internal.StopMacroExpansion } /** Report a warning */ @@ -29,7 +29,4 @@ object report: def warning(msg: => String, expr: Expr[_])(using qctx: QuoteContext): Unit = qctx.reflect.Reporting.warning(msg, expr.unseal.pos) - /** Throwable used to stop the expansion of a macro after an error was reported */ - class StopQuotedContext extends Throwable - end report