diff --git a/community-build/community-projects/scalatest b/community-build/community-projects/scalatest index 7c3e2b698e17..c92adfa20535 160000 --- a/community-build/community-projects/scalatest +++ b/community-build/community-projects/scalatest @@ -1 +1 @@ -Subproject commit 7c3e2b698e172c19267303fce0118f29d5c2ac78 +Subproject commit c92adfa20535ff22f58a8d2f6f18f8db67d9383f diff --git a/community-build/community-projects/scodec-bits b/community-build/community-projects/scodec-bits index 9ed683efcfd8..490b9b6957c0 160000 --- a/community-build/community-projects/scodec-bits +++ b/community-build/community-projects/scodec-bits @@ -1 +1 @@ -Subproject commit 9ed683efcfd8bcae8cfe484224c1b0da18d409a4 +Subproject commit 490b9b6957c06e55909456b9d06736e7e678fe5a diff --git a/community-build/community-projects/xml-interpolator b/community-build/community-projects/xml-interpolator index 1b7f7dd96338..ed4255ab9446 160000 --- a/community-build/community-projects/xml-interpolator +++ b/community-build/community-projects/xml-interpolator @@ -1 +1 @@ -Subproject commit 1b7f7dd9633886a8a633516a6310680c2a273d58 +Subproject commit ed4255ab94462ee21e8c07f0fb8e4d9c7e6bf24e diff --git a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala index f03b22a10fbf..1d02f27a78c6 100644 --- a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala +++ b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala @@ -2541,19 +2541,49 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler def path: java.nio.file.Path = ctx.compilationUnit.source.file.jpath end Source - object Reporting extends ReportingModule: - def error(msg: => String, pos: Position): Unit = + object report extends ReportModule: + + def error(msg: String): Unit = + dotc.report.error(msg, Position.ofMacroExpansion) + + def error(msg: String, expr: Expr[Any]): Unit = + dotc.report.error(msg, Term.of(expr).pos) + + def error(msg: String, pos: Position): Unit = dotc.report.error(msg, pos) - def error(msg: => String, sourceFile: SourceFile, start: Int, end: Int): Unit = + def error(msg: String, sourceFile: SourceFile, start: Int, end: Int): Unit = dotc.report.error(msg, dotc.util.SourcePosition(sourceFile, dotc.util.Spans.Span(start, end))) - def warning(msg: => String, pos: Position): Unit = + def throwError(msg: String): Nothing = + error(msg) + throw new scala.quoted.runtime.StopMacroExpansion + + def throwError(msg: String, expr: Expr[Any]): Nothing = + error(msg, expr) + throw new scala.quoted.runtime.StopMacroExpansion + + def throwError(msg: String, pos: Position): Nothing = + error(msg, pos) + throw new scala.quoted.runtime.StopMacroExpansion + + def throwError(msg: String, sourceFile: SourceFile, start: Int, end: Int): Nothing = + error(msg, sourceFile, start, end) + throw new scala.quoted.runtime.StopMacroExpansion + + def warning(msg: String): Unit = + dotc.report.warning(msg, Position.ofMacroExpansion) + + def warning(msg: String, expr: Expr[Any]): Unit = + dotc.report.warning(msg, Term.of(expr).pos) + + def warning(msg: String, pos: Position): Unit = dotc.report.warning(msg, pos) - def warning(msg: => String, sourceFile: SourceFile, start: Int, end: Int): Unit = + def warning(msg: String, sourceFile: SourceFile, start: Int, end: Int): Unit = dotc.report.error(msg, dotc.util.SourcePosition(sourceFile, dotc.util.Spans.Span(start, end))) - end Reporting + + end report type Documentation = dotc.core.Comments.Comment diff --git a/library/src/scala/quoted/Quotes.scala b/library/src/scala/quoted/Quotes.scala index a443caf47051..ec9b1890dc1b 100644 --- a/library/src/scala/quoted/Quotes.scala +++ b/library/src/scala/quoted/Quotes.scala @@ -49,7 +49,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching => def unliftOrError(using Unliftable[T]): T = def reportError = val msg = s"Expected a known value. \n\nThe value of: ${self.show}\ncould not be unlifted using $unlift" - report.throwError(msg, self)(using Quotes.this) + reflect.report.throwError(msg, self) summon[Unliftable[T]].fromExpr(self)(using Quotes.this).getOrElse(reportError) end extension @@ -3381,24 +3381,47 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching => // REPORTING // /////////////// - val Reporting: ReportingModule + val report: ReportModule - /** Module containg error and waring reporiting. - * - * Also see scala.quoted.report - */ - trait ReportingModule { self: Reporting.type => - /** Emits an error message */ - def error(msg: => String, pos: Position): Unit + /** Module containg error and waring reporiting. */ + trait ReportModule { self: report.type => + + /** Report an error at the position of the macro expansion */ + def error(msg: String): Unit + + /** Report an error at the position of `expr` */ + def error(msg: String, expr: Expr[Any]): Unit + + /** Report an error message at the given position */ + def error(msg: String, pos: Position): Unit + + /** Report an error at a specific range of a file. The positions must be contained in the file. */ + def error(msg: String, source: SourceFile, start: Int, end: Int): Unit + + /** Report an error at the position of the macro expansion and throws a StopMacroExpansion */ + def throwError(msg: String): Nothing + + /** Report an error at the position of `expr` */ + def throwError(msg: String, expr: Expr[Any]): Nothing + + /** Report an error message at the given position and throws a StopMacroExpansion */ + def throwError(msg: String, pos: Position): Nothing + + /** Report an error at a specific range of a file and throws a StopMacroExpansion. The positions must be contained in the file. */ + def throwError(msg: String, source: SourceFile, start: Int, end: Int): Nothing + + /** Report a warning at the position of the macro expansion */ + def warning(msg: String): Unit + + /** Report a warning at the on the position of `expr` */ + def warning(msg: String, expr: Expr[Any]): Unit - /** Emits an error at a specific range of a file */ - def error(msg: => String, source: SourceFile, start: Int, end: Int): Unit + /** Report an warning message at the given position */ + def warning(msg: String, pos: Position): Unit - /** Emits an error message */ - def warning(msg: => String, pos: Position): Unit + /** Emits a warning at a specific range of a file. The positions must be contained in the file. */ + def warning(msg: String, source: SourceFile, start: Int, end: Int): Unit - /** Emits a warning at a specific range of a file */ - def warning(msg: => String, source: SourceFile, start: Int, end: Int): Unit } diff --git a/library/src/scala/quoted/report.scala b/library/src/scala/quoted/report.scala deleted file mode 100644 index f2f5e299790b..000000000000 --- a/library/src/scala/quoted/report.scala +++ /dev/null @@ -1,36 +0,0 @@ -package scala.quoted - -object report: - - /** Report an error at the position of the macro expansion */ - def error(msg: => String)(using Quotes): Unit = - import quotes.reflect._ - Reporting.error(msg, Position.ofMacroExpansion) - - /** Report an error at the on the position of `expr` */ - def error(msg: => String, expr: Expr[Any])(using Quotes): Unit = - import quotes.reflect._ - Reporting.error(msg, Term.of(expr).pos) - - /** Report an error at the position of the macro expansion and throws a StopMacroExpansion */ - def throwError(msg: => String)(using Quotes): Nothing = { - error(msg) - throw new runtime.StopMacroExpansion - } - /** Report an error at the on the position of `expr` and throws a StopMacroExpansion */ - def throwError(msg: => String, expr: Expr[Any])(using Quotes): Nothing = { - error(msg, expr) - throw new runtime.StopMacroExpansion - } - - /** Report a warning */ - def warning(msg: => String)(using Quotes): Unit = - import quotes.reflect._ - Reporting.warning(msg, Position.ofMacroExpansion) - - /** Report a warning at the on the position of `expr` */ - def warning(msg: => String, expr: Expr[Any])(using Quotes): Unit = - import quotes.reflect._ - Reporting.warning(msg, Term.of(expr).pos) - -end report diff --git a/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala b/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala index 5eb0a288e6b3..1cddede1bc93 100644 --- a/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala +++ b/tests/neg-macros/BigFloat/BigFloatFromDigitsImpl_1.scala @@ -11,7 +11,7 @@ object BigFloatFromDigitsImpl: val BigFloat(m, e) = BigFloat(ds) '{BigFloat(${Expr(m)}, ${Expr(e)})} catch case ex: FromDigits.FromDigitsException => - report.error(ex.getMessage) + quotes.reflect.report.error(ex.getMessage) '{BigFloat(0, 0)} case digits => '{BigFloat($digits)} diff --git a/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala b/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala index 2ab330d46b2c..22fb66a3f2d1 100644 --- a/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala +++ b/tests/neg-macros/GenericNumLits/EvenFromDigitsImpl_1.scala @@ -10,7 +10,7 @@ object EvenFromDigitsImpl: try evenFromDigits(ds) catch { case ex: FromDigits.FromDigitsException => - report.error(ex.getMessage) + quotes.reflect.report.error(ex.getMessage) Even(0) } '{Even(${Expr(ev.n)})} diff --git a/tests/neg-macros/delegate-match-1/Macro_1.scala b/tests/neg-macros/delegate-match-1/Macro_1.scala index c678660b6824..b6b87f2939cb 100644 --- a/tests/neg-macros/delegate-match-1/Macro_1.scala +++ b/tests/neg-macros/delegate-match-1/Macro_1.scala @@ -9,13 +9,13 @@ private def fImpl(using Quotes): Expr[Unit] = { case x: ImplicitSearchSuccess => '{} case x: DivergingImplicit => '{} - Reporting.error("DivergingImplicit\n" + x.explanation, Position.ofMacroExpansion) + report.error("DivergingImplicit\n" + x.explanation, Position.ofMacroExpansion) '{} case x: NoMatchingImplicits => - Reporting.error("NoMatchingImplicits\n" + x.explanation, Position.ofMacroExpansion) + report.error("NoMatchingImplicits\n" + x.explanation, Position.ofMacroExpansion) '{} case x: AmbiguousImplicits => - Reporting.error("AmbiguousImplicits\n" + x.explanation, Position.ofMacroExpansion) + report.error("AmbiguousImplicits\n" + x.explanation, Position.ofMacroExpansion) '{} } } diff --git a/tests/neg-macros/delegate-match-2/Macro_1.scala b/tests/neg-macros/delegate-match-2/Macro_1.scala index 2452304d04a5..4583fbf336d8 100644 --- a/tests/neg-macros/delegate-match-2/Macro_1.scala +++ b/tests/neg-macros/delegate-match-2/Macro_1.scala @@ -9,13 +9,13 @@ private def fImpl (using Quotes) : Expr[Unit] = { case x: ImplicitSearchSuccess => '{} case x: DivergingImplicit => '{} - Reporting.error("DivergingImplicit\n" + x.explanation, Position.ofMacroExpansion) + report.error("DivergingImplicit\n" + x.explanation, Position.ofMacroExpansion) '{} case x: NoMatchingImplicits => - Reporting.error("NoMatchingImplicits\n" + x.explanation, Position.ofMacroExpansion) + report.error("NoMatchingImplicits\n" + x.explanation, Position.ofMacroExpansion) '{} case x: AmbiguousImplicits => - Reporting.error("AmbiguousImplicits\n" + x.explanation, Position.ofMacroExpansion) + report.error("AmbiguousImplicits\n" + x.explanation, Position.ofMacroExpansion) '{} } } diff --git a/tests/neg-macros/delegate-match-3/Macro_1.scala b/tests/neg-macros/delegate-match-3/Macro_1.scala index 43e97e17fdcb..11fb28aba16a 100644 --- a/tests/neg-macros/delegate-match-3/Macro_1.scala +++ b/tests/neg-macros/delegate-match-3/Macro_1.scala @@ -9,13 +9,13 @@ private def fImpl(using Quotes) : Expr[Unit] = { case x: ImplicitSearchSuccess => '{} case x: DivergingImplicit => '{} - Reporting.error("DivergingImplicit\n" + x.explanation, Position.ofMacroExpansion) + report.error("DivergingImplicit\n" + x.explanation, Position.ofMacroExpansion) '{} case x: NoMatchingImplicits => - Reporting.error("NoMatchingImplicits\n" + x.explanation, Position.ofMacroExpansion) + report.error("NoMatchingImplicits\n" + x.explanation, Position.ofMacroExpansion) '{} case x: AmbiguousImplicits => - Reporting.error("AmbiguousImplicits\n" + x.explanation, Position.ofMacroExpansion) + report.error("AmbiguousImplicits\n" + x.explanation, Position.ofMacroExpansion) '{} } } diff --git a/tests/neg-macros/i6432/Macro_1.scala b/tests/neg-macros/i6432/Macro_1.scala index 4c03768d3e1d..dfb26889fd44 100644 --- a/tests/neg-macros/i6432/Macro_1.scala +++ b/tests/neg-macros/i6432/Macro_1.scala @@ -10,7 +10,7 @@ object Macro { sc match { case '{ StringContext(${Varargs(parts)}: _*) } => for (part @ Const(s) <- parts) - Reporting.error(s, Term.of(part).pos) + report.error(s, Term.of(part).pos) } '{} } diff --git a/tests/neg-macros/i6432b/Macro_1.scala b/tests/neg-macros/i6432b/Macro_1.scala index 4c03768d3e1d..dfb26889fd44 100644 --- a/tests/neg-macros/i6432b/Macro_1.scala +++ b/tests/neg-macros/i6432b/Macro_1.scala @@ -10,7 +10,7 @@ object Macro { sc match { case '{ StringContext(${Varargs(parts)}: _*) } => for (part @ Const(s) <- parts) - Reporting.error(s, Term.of(part).pos) + report.error(s, Term.of(part).pos) } '{} } diff --git a/tests/neg-macros/i9014/Macros_1.scala b/tests/neg-macros/i9014/Macros_1.scala index f546cc4d6a44..599214e3bfc2 100644 --- a/tests/neg-macros/i9014/Macros_1.scala +++ b/tests/neg-macros/i9014/Macros_1.scala @@ -1,4 +1,4 @@ import scala.quoted._ trait Bar inline given Bar = ${ impl } -def impl(using Quotes): Expr[Bar] = report.throwError("Failed to expand!") +def impl(using Quotes): Expr[Bar] = quotes.reflect.report.throwError("Failed to expand!") diff --git a/tests/neg-macros/i9801/Macro_1.scala b/tests/neg-macros/i9801/Macro_1.scala index c5a447be6d06..c9b93838b91a 100644 --- a/tests/neg-macros/i9801/Macro_1.scala +++ b/tests/neg-macros/i9801/Macro_1.scala @@ -16,6 +16,6 @@ def impl(prog: Expr[Double])(using Quotes) : Expr[Double] = triggerStackOverflow(0) } catch { case e => - quotes.reflect.Reporting.error(e.getMessage, Term.of(prog).pos) + quotes.reflect.report.error(e.getMessage, Term.of(prog).pos) '{ 42.0 } } diff --git a/tests/neg-macros/macros-in-same-project-6/Foo.scala b/tests/neg-macros/macros-in-same-project-6/Foo.scala index e988c300bb05..e538f2aff51d 100644 --- a/tests/neg-macros/macros-in-same-project-6/Foo.scala +++ b/tests/neg-macros/macros-in-same-project-6/Foo.scala @@ -6,7 +6,7 @@ object Foo { def aMacroImplementation(using Quotes) : Expr[Unit] = { import quotes.reflect._ - Reporting.error("some error", Position.ofMacroExpansion) + report.error("some error", Position.ofMacroExpansion) throw new NoClassDefFoundError("Bar$") } } diff --git a/tests/neg-macros/quote-error-2/Macro_1.scala b/tests/neg-macros/quote-error-2/Macro_1.scala index a1ee53e3e80c..cf24b02ada36 100644 --- a/tests/neg-macros/quote-error-2/Macro_1.scala +++ b/tests/neg-macros/quote-error-2/Macro_1.scala @@ -7,6 +7,6 @@ object Macro_1 { def msg(b: Boolean)(using Quotes): Expr[String] = if (b) '{"foo(true)"} - else { report.error("foo cannot be called with false"); '{ ??? } } + else { quotes.reflect.report.error("foo cannot be called with false"); '{ ??? } } } diff --git a/tests/neg-macros/quote-error/Macro_1.scala b/tests/neg-macros/quote-error/Macro_1.scala index 586138d07eb0..bc5c3042fd64 100644 --- a/tests/neg-macros/quote-error/Macro_1.scala +++ b/tests/neg-macros/quote-error/Macro_1.scala @@ -4,5 +4,5 @@ object Macro_1 { inline def foo(inline b: Boolean): Unit = ${fooImpl('b)} def fooImpl(b: Expr[Boolean])(using Quotes) : Expr[Unit] = if (b.unliftOrError) '{println("foo(true)")} - else { report.error("foo cannot be called with false"); '{ ??? } } + else { quotes.reflect.report.error("foo cannot be called with false"); '{ ??? } } } diff --git a/tests/neg-macros/tasty-macro-error/quoted_1.scala b/tests/neg-macros/tasty-macro-error/quoted_1.scala index e842ec2858da..444500928364 100644 --- a/tests/neg-macros/tasty-macro-error/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-error/quoted_1.scala @@ -6,7 +6,7 @@ object Macros { def impl(x: Expr[Any])(using Quotes) : Expr[Unit] = { import quotes.reflect._ - Reporting.error("here is the the argument is " + Term.of(x).underlyingArgument.show, Term.of(x).underlyingArgument.pos) + report.error("here is the the argument is " + Term.of(x).underlyingArgument.show, Term.of(x).underlyingArgument.pos) '{} } diff --git a/tests/neg-macros/tasty-macro-positions/quoted_1.scala b/tests/neg-macros/tasty-macro-positions/quoted_1.scala index 9861342fca2b..f70603b0e0ec 100644 --- a/tests/neg-macros/tasty-macro-positions/quoted_1.scala +++ b/tests/neg-macros/tasty-macro-positions/quoted_1.scala @@ -7,8 +7,8 @@ object Macros { def impl(x: Expr[Any])(using Quotes) : Expr[Unit] = { import quotes.reflect._ val pos = Term.of(x).underlyingArgument.pos - Reporting.error("here is the the argument is " + Term.of(x).underlyingArgument.show, pos) - Reporting.error("here (+5) is the the argument is " + Term.of(x).underlyingArgument.show, pos.sourceFile, pos.start + 5, pos.end + 5) + report.error("here is the the argument is " + Term.of(x).underlyingArgument.show, pos) + report.error("here (+5) is the the argument is " + Term.of(x).underlyingArgument.show, pos.sourceFile, pos.start + 5, pos.end + 5) '{} } diff --git a/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala b/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala index be39b7273da9..8d94a4fe9304 100644 --- a/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala +++ b/tests/neg-macros/tasty-string-interpolator-position-a/Macro_1.scala @@ -11,7 +11,7 @@ object FIntepolator { def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[String] = { import quotes.reflect._ - Reporting.error("there are no parts", Term.of(strCtxExpr).underlyingArgument.pos) + report.error("there are no parts", Term.of(strCtxExpr).underlyingArgument.pos) '{ ($strCtxExpr).s($argsExpr: _*) } } diff --git a/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala b/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala index 2ff30cec9855..7bb1cd5d5341 100644 --- a/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala +++ b/tests/neg-macros/tasty-string-interpolator-position-b/Macro_1.scala @@ -10,7 +10,7 @@ object Macro { object FIntepolator { def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[String] = { import quotes.reflect._ - Reporting.error("there are no args", Term.of(argsExpr).underlyingArgument.pos) + report.error("there are no args", Term.of(argsExpr).underlyingArgument.pos) '{ ($strCtxExpr).s($argsExpr: _*) } } diff --git a/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala b/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala index 2ab330d46b2c..22fb66a3f2d1 100644 --- a/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala +++ b/tests/neg-with-compiler/GenericNumLits/EvenFromDigitsImpl_1.scala @@ -10,7 +10,7 @@ object EvenFromDigitsImpl: try evenFromDigits(ds) catch { case ex: FromDigits.FromDigitsException => - report.error(ex.getMessage) + quotes.reflect.report.error(ex.getMessage) Even(0) } '{Even(${Expr(ev.n)})} diff --git a/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala b/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala index 5eb0a288e6b3..013a19365085 100644 --- a/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala +++ b/tests/run-macros/BigFloat/BigFloatFromDigitsImpl_1.scala @@ -11,6 +11,7 @@ object BigFloatFromDigitsImpl: val BigFloat(m, e) = BigFloat(ds) '{BigFloat(${Expr(m)}, ${Expr(e)})} catch case ex: FromDigits.FromDigitsException => + import quotes.reflect.report report.error(ex.getMessage) '{BigFloat(0, 0)} case digits => diff --git a/tests/run-macros/i8671/Macro_1.scala b/tests/run-macros/i8671/Macro_1.scala index b6c8f0dedeeb..26fe48684d7d 100644 --- a/tests/run-macros/i8671/Macro_1.scala +++ b/tests/run-macros/i8671/Macro_1.scala @@ -12,6 +12,7 @@ object FileName { Right(FileName.unsafe(s)) def createFileName(fileName: Expr[String])(using Quotes): Expr[FileName] = + import quotes.reflect.report fileName match { case e@Const(s) => fileNameFromString(s) match { @@ -25,4 +26,3 @@ object FileName { report.throwError(s"$fileName is not a valid file name. It must be a literal string", fileName) } } - diff --git a/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala index a4e5b08bbe7b..3859f395866b 100644 --- a/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-1/quoted_1.scala @@ -21,7 +21,7 @@ object Macros { case _ => import quotes.reflect._ - Reporting.error("Expected explicit DSL", Term.of(e).pos) + report.error("Expected explicit DSL", Term.of(e).pos) '{ ??? } } diff --git a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala index fbea88861f91..1211f35f42e4 100644 --- a/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-2/quoted_1.scala @@ -39,7 +39,7 @@ object Macros { case _ => import quotes.reflect._ - Reporting.error("Expected explicit DSL " + e.show, Term.of(e).pos) + report.error("Expected explicit DSL " + e.show, Term.of(e).pos) ??? } @@ -53,7 +53,7 @@ object Macros { ) case _ => import quotes.reflect._ - Reporting.error("Expected explicit DSL => DSL " + e.show, Term.of(e).pos) + report.error("Expected explicit DSL => DSL " + e.show, Term.of(e).pos) ??? } diff --git a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala index 0d50d171eea7..38915b73c66e 100644 --- a/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala +++ b/tests/run-macros/quote-matcher-symantics-3/quoted_1.scala @@ -64,6 +64,7 @@ object Macros { case FromEnv(expr) => expr.asInstanceOf[Expr[R[T]]] case _ => + import quotes.reflect.report report.error("Expected explicit value but got: " + e.show, e) '{ ??? } diff --git a/tests/run-macros/string-context-implicits/Macro_1.scala b/tests/run-macros/string-context-implicits/Macro_1.scala index 98c0bf918f7f..0764e0d4ddad 100644 --- a/tests/run-macros/string-context-implicits/Macro_1.scala +++ b/tests/run-macros/string-context-implicits/Macro_1.scala @@ -4,6 +4,7 @@ import scala.quoted._ extension (sc: StringContext) inline def showMe(inline args: Any*): String = ${ showMeExpr('sc, 'args) } private def showMeExpr(sc: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes): Expr[String] = { + import quotes.reflect.report argsExpr match { case Varargs(argExprs) => val argShowedExprs = argExprs.map { diff --git a/tests/run-macros/tasty-interpolation-1/Macro.scala b/tests/run-macros/tasty-interpolation-1/Macro.scala index a1aca858b68b..180d7687abdb 100644 --- a/tests/run-macros/tasty-interpolation-1/Macro.scala +++ b/tests/run-macros/tasty-interpolation-1/Macro.scala @@ -1,7 +1,6 @@ import scala.quoted._ import scala.language.implicitConversions -import scala.quoted.report.error object Macro { @@ -32,6 +31,7 @@ object FooIntepolator extends MacroStringInterpolator[String] { abstract class MacroStringInterpolator[T] { final def apply(strCtxExpr: Expr[StringContext], argsExpr: Expr[Seq[Any]])(using Quotes) : Expr[T] = { + import quotes.reflect.report.error try interpolate(strCtxExpr, argsExpr) catch { case ex: NotStaticlyKnownError => diff --git a/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala b/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala index 4eae0964fee4..29c3e5bd2fc0 100644 --- a/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala +++ b/tests/run-macros/tasty-string-interpolation-reporter-test/Macros_1.scala @@ -24,7 +24,7 @@ object Macro { val reporter = new Reporter { def errorOnPart(msg: String, partIdx: Int): Unit = { import quotes.reflect._ - Reporting.error(msg, Term.of(parts(partIdx)).pos) + report.error(msg, Term.of(parts(partIdx)).pos) } } fooCore(parts, args, reporter) diff --git a/tests/run-staging/staged-tuples/StagedTuple.scala b/tests/run-staging/staged-tuples/StagedTuple.scala index 9cc4f045abe5..74933f6ace69 100644 --- a/tests/run-staging/staged-tuples/StagedTuple.scala +++ b/tests/run-staging/staged-tuples/StagedTuple.scala @@ -132,7 +132,7 @@ object StagedTuple { else { def fallbackApply(): Expr[Elem[Tup, N]] = nValue match { case Some(n) => - report.error("index out of bounds: " + n, tup) + quotes.reflect.report.error("index out of bounds: " + n, tup) '{ throw new IndexOutOfBoundsException(${Expr(n.toString)}) } case None => '{scala.runtime.Tuple.apply($tup, $n)}.as[Elem[Tup, N]] }