Skip to content

Remove report.StopQuotedContext #10336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/Splicer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions library/src/scala/quoted/internal/StopMacroExpansion.scala
Original file line number Diff line number Diff line change
@@ -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
11 changes: 4 additions & 7 deletions library/src/scala/quoted/report.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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