diff options
-rw-r--r-- | src/dotty/tools/dotc/reporting/MessageRendering.scala | 8 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Inliner.scala | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/reporting/MessageRendering.scala b/src/dotty/tools/dotc/reporting/MessageRendering.scala index 6d9e45a6e..79632c965 100644 --- a/src/dotty/tools/dotc/reporting/MessageRendering.scala +++ b/src/dotty/tools/dotc/reporting/MessageRendering.scala @@ -15,6 +15,12 @@ trait MessageRendering { def stripColor(str: String): String = str.replaceAll("\u001B\\[[;\\d]*m", "") + def outer(pos: SourcePosition, prefix: String)(implicit ctx: Context): List[String] = + if (pos.outer.exists) { + s"$prefix| This location is in code that was inlined at ${pos.outer}" :: + outer(pos.outer, prefix) + } else Nil + def sourceLines(pos: SourcePosition)(implicit ctx: Context): (List[String], List[String], Int) = { var maxLen = Int.MinValue def render(xs: List[Int]) = @@ -92,7 +98,7 @@ trait MessageRendering { val (srcBefore, srcAfter, offset) = sourceLines(pos) val marker = columnMarker(pos, offset) val err = errorMsg(pos, msg.msg, offset) - sb.append((srcBefore ::: marker :: err :: srcAfter).mkString("\n")) + sb.append((srcBefore ::: marker :: err :: outer(pos, " " * (offset - 1)) ::: srcAfter).mkString("\n")) } else sb.append(msg.msg) sb.toString } diff --git a/src/dotty/tools/dotc/typer/Inliner.scala b/src/dotty/tools/dotc/typer/Inliner.scala index 40c1ca350..4869b5e16 100644 --- a/src/dotty/tools/dotc/typer/Inliner.scala +++ b/src/dotty/tools/dotc/typer/Inliner.scala @@ -236,10 +236,12 @@ object Inliner { def inlineCall(tree: Tree, pt: Type)(implicit ctx: Context): Tree = if (enclosingInlineds.length < ctx.settings.xmaxInlines.value) new Inliner(tree, bodyToInline(tree.symbol)).inlined(pt) - else errorTree(tree, - i"""Maximal number of successive inlines (${ctx.settings.xmaxInlines.value}) exceeded, - | Maybe this is caused by a recursive inline method? - | You can use -Xmax:inlines to change the limit.""") + else errorTree( + tree, + i"""|Maximal number of successive inlines (${ctx.settings.xmaxInlines.value}) exceeded, + |Maybe this is caused by a recursive inline method? + |You can use -Xmax:inlines to change the limit.""" + ) /** Replace `Inlined` node by a block that contains its bindings and expansion */ def dropInlined(inlined: tpd.Inlined)(implicit ctx: Context): Tree = { |