Skip to content

Commit 86cc7f8

Browse files
Merge pull request #9380 from dotty-staging/rename-Reporing-to-report
Rename `scala.quoted.Reporting` to `report`
2 parents 03aa171 + 1bfc467 commit 86cc7f8

File tree

25 files changed

+44
-44
lines changed

25 files changed

+44
-44
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object Splicer {
5454
catch {
5555
case ex: CompilationUnit.SuspendException =>
5656
throw ex
57-
case ex: scala.quoted.Reporting.StopQuotedContext if ctx.reporter.hasErrors =>
57+
case ex: scala.quoted.report.StopQuotedContext if ctx.reporter.hasErrors =>
5858
// errors have been emitted
5959
EmptyTree
6060
case ex: StopInterpretation =>
@@ -391,7 +391,7 @@ object Splicer {
391391
throw new StopInterpretation(sw.toString, pos)
392392
case ex: InvocationTargetException =>
393393
ex.getTargetException match {
394-
case ex: scala.quoted.Reporting.StopQuotedContext =>
394+
case ex: scala.quoted.report.StopQuotedContext =>
395395
throw ex
396396
case MissingClassDefinedInCurrentRun(sym) if ctx.compilationUnit.isSuspendable =>
397397
if (ctx.settings.XprintSuspension.value)

library/src-bootstrapped/dotty/internal/CompileTimeMacros.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ object CompileTimeMacros:
88
case (Expr.StringContext(Consts(parts)), Varargs(args2)) =>
99
Expr(StringContext(parts: _*).s(args2.map(_.show): _*))
1010
case _ =>
11-
Reporting.throwError("compiletime.code must be used as a string interpolator `code\"...\"`")
11+
report.throwError("compiletime.code must be used as a string interpolator `code\"...\"`")

library/src-bootstrapped/dotty/internal/StringContextMacro.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ object StringContextMacro {
6363

6464
val (partsExpr, parts) = strCtxExpr match {
6565
case Expr.StringContext(p1 @ Consts(p2)) => (p1.toList, p2.toList)
66-
case _ => Reporting.throwError("Expected statically known String Context", strCtxExpr)
66+
case _ => report.throwError("Expected statically known String Context", strCtxExpr)
6767
}
6868

6969
val args = argsExpr match {
7070
case Varargs(args) => args
71-
case _ => Reporting.throwError("Expected statically known argument list", argsExpr)
71+
case _ => report.throwError("Expected statically known argument list", argsExpr)
7272
}
7373

7474
val reporter = new Reporter{

library/src-bootstrapped/scala/quoted/Expr.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class Expr[+T] private[scala] {
2727
* Otherwise returns the value.
2828
*/
2929
final def unliftOrError[U >: T](using qctx: QuoteContext, unlift: Unliftable[U]): U =
30-
unlift(this).getOrElse(Reporting.throwError(s"Expected a known value. \n\nThe value of: $show\ncould not be unlifted using $unlift", this))
30+
unlift(this).getOrElse(report.throwError(s"Expected a known value. \n\nThe value of: $show\ncould not be unlifted using $unlift", this))
3131

3232
/** Pattern matches `this` against `that`. Effectively performing a deep equality check.
3333
* It does the equivalent of

library/src-bootstrapped/scala/quoted/Reporting.scala renamed to library/src-bootstrapped/scala/quoted/report.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package scala.quoted
22

3-
object Reporting {
3+
object report:
44

55
/** Report an error at the position of the macro expansion */
66
def error(msg: => String)(using qctx: QuoteContext): Unit =
@@ -32,4 +32,7 @@ object Reporting {
3232
/** Throwable used to stop the expansion of a macro after an error was reported */
3333
class StopQuotedContext extends Throwable
3434

35-
}
35+
end report
36+
37+
@deprecated("Use scala.quoted.report", "")
38+
def Reporting: report.type = report
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package scala.quoted
22

3-
object Reporting {
4-
3+
object report:
54
/** Throwable used to stop the expansion of a macro after an error was reported */
65
class StopQuotedContext extends Throwable
7-
8-
}

tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object BigFloatFromDigitsImpl:
1010
val BigFloat(m, e) = BigFloat(ds)
1111
'{BigFloat(${Expr(m)}, ${Expr(e)})}
1212
catch case ex: FromDigits.FromDigitsException =>
13-
Reporting.error(ex.getMessage)
13+
report.error(ex.getMessage)
1414
'{BigFloat(0, 0)}
1515
case digits =>
1616
'{BigFloat($digits)}

tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object EvenFromDigitsImpl:
99
try evenFromDigits(ds)
1010
catch {
1111
case ex: FromDigits.FromDigitsException =>
12-
Reporting.error(ex.getMessage)
12+
report.error(ex.getMessage)
1313
Even(0)
1414
}
1515
'{Even(${Expr(ev.n)})}

tests/neg-macros/i9014/Macros_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import scala.quoted._
22
trait Bar
33
inline given as Bar = ${ impl }
4-
def impl(using qctx: QuoteContext): Expr[Bar] = Reporting.throwError("Failed to expand!")
4+
def impl(using qctx: QuoteContext): Expr[Bar] = report.throwError("Failed to expand!")

tests/neg-macros/quote-error-2/Macro_1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ object Macro_1 {
77

88
def msg(b: Boolean)(using qctx: QuoteContext): Expr[String] =
99
if (b) '{"foo(true)"}
10-
else { Reporting.error("foo cannot be called with false"); '{ ??? } }
10+
else { report.error("foo cannot be called with false"); '{ ??? } }
1111

1212
}

0 commit comments

Comments
 (0)