diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2015-04-07 14:12:02 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2015-04-07 14:12:02 +1000 |
commit | a72eeb953b738ba0f0b7a9024f16bca3009f23dc (patch) | |
tree | 68d33154bac82ba85fe9c2de3170a4c5510f2dd0 | |
parent | 214d79841970be29bac126eb48f955c8f082e1bc (diff) | |
download | scala-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.
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 7 |
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 } } |