summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-04-07 14:12:02 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-04-07 14:12:02 +1000
commita72eeb953b738ba0f0b7a9024f16bca3009f23dc (patch)
tree68d33154bac82ba85fe9c2de3170a4c5510f2dd0 /src/compiler
parent214d79841970be29bac126eb48f955c8f082e1bc (diff)
downloadscala-a72eeb953b738ba0f0b7a9024f16bca3009f23dc.tar.gz
scala-a72eeb953b738ba0f0b7a9024f16bca3009f23dc.tar.bz2
scala-a72eeb953b738ba0f0b7a9024f16bca3009f23dc.zip
SI-9264 An even-better diagnostic for an unexplained crash
We have seen an intermittent crasher in the backend for the last month or so. In https://github.com/scala/scala/pull/4397, I added a diagnostic to show the actual locals in scope in the method. This commit further expands the diagnistic to show the method's tree.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 185fd93501..137954b52d 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -883,7 +883,12 @@ abstract class GenICode extends SubComponent {
case None =>
val saved = settings.uniqid
settings.uniqid.value = true
- try abort(s"symbol $sym does not exist in ${ctx.method}, which contains locals ${ctx.method.locals.mkString(",")}")
+ try {
+ val methodCode = unit.body.collect { case dd: DefDef
+ if dd.symbol == ctx.method.symbol => showCode(dd);
+ }.headOption.getOrElse("<unknown>")
+ abort(s"symbol $sym does not exist in ${ctx.method}, which contains locals ${ctx.method.locals.mkString(",")}. \nMethod code: $methodCode")
+ }
finally settings.uniqid.value = saved
}
}