diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index bd4289f8d502..985dd512fa15 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2809,8 +2809,10 @@ class Typer extends Namer } else if (tree.symbol.isScala2Macro) { if (ctx.settings.XignoreScala2Macros.value) { - ctx.warning("Scala 2 macro cannot be used in Dotty, this call will crash at runtime. See http://dotty.epfl.ch/docs/reference/dropped-features/macros.html", tree.sourcePos) - Throw(New(defn.MatchErrorType, Literal(Constant(s"Reached unexpanded Scala 2 macro call to ${tree.symbol.showFullName} compiled with -Xignore-scala2-macros.")) :: Nil)).withSpan(tree.span) + ctx.warning("Scala 2 macro cannot be used in Dotty, this call will crash at runtime. See http://dotty.epfl.ch/docs/reference/dropped-features/macros.html", tree.sourcePos.startPos) + Throw(New(defn.MatchErrorType, Literal(Constant(s"Reached unexpanded Scala 2 macro call to ${tree.symbol.showFullName} compiled with -Xignore-scala2-macros.")) :: Nil)) + .withType(tree.tpe) + .withSpan(tree.span) } else if (tree.symbol eq defn.StringContext_f) { // As scala.StringContext.f is defined in the standard library which // we currently do not bootstrap we cannot implement the macro the library. @@ -2821,7 +2823,9 @@ class Typer extends Namer val newCall = ref(defn.InternalStringContextMacroModule_f).appliedTo(sc).appliedToArgs(args) readaptSimplified(Inliner.inlineCall(newCall)) } else { - ctx.error("Scala 2 macro cannot be used in Dotty. See http://dotty.epfl.ch/docs/reference/dropped-features/macros.html", tree.sourcePos) + ctx.error( + """Scala 2 macro cannot be used in Dotty. See http://dotty.epfl.ch/docs/reference/dropped-features/macros.html\n" + |To turn this error into a warning, pass -Xignore-scala2-macros to the compiler""".stripMargin, tree.sourcePos.startPos) tree } }