summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-08-10 11:05:36 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-08-14 10:53:48 +0200
commit1125c2f231a341d2b0ca31053105d9ca72030330 (patch)
tree72ce147dca46bb197170c981eae89348bff67277 /src
parent12baa2ea399b4f281c62fd20479c1e626f244d03 (diff)
downloadscala-1125c2f231a341d2b0ca31053105d9ca72030330.tar.gz
scala-1125c2f231a341d2b0ca31053105d9ca72030330.tar.bz2
scala-1125c2f231a341d2b0ca31053105d9ca72030330.zip
don't crash on unsupported pattern -- diagnose
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/Printers.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/Printers.scala b/src/compiler/scala/tools/nsc/ast/Printers.scala
index 8b92f0acd6..885fc3f518 100644
--- a/src/compiler/scala/tools/nsc/ast/Printers.scala
+++ b/src/compiler/scala/tools/nsc/ast/Printers.scala
@@ -278,6 +278,7 @@ trait Printers extends reflect.internal.Printers { this: Global =>
def asString(t: Tree): String = render(t, newStandardTreePrinter, settings.printtypes.value, settings.uniqid.value, settings.Yshowsymkinds.value)
def asCompactString(t: Tree): String = render(t, newCompactTreePrinter, settings.printtypes.value, settings.uniqid.value, settings.Yshowsymkinds.value)
+ def asCompactDebugString(t: Tree): String = render(t, newCompactTreePrinter, true, true, true)
def newStandardTreePrinter(writer: PrintWriter): TreePrinter = new TreePrinter(writer)
def newStandardTreePrinter(stream: OutputStream): TreePrinter = newStandardTreePrinter(new PrintWriter(stream))
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
index 662de79e24..ba0e7305c0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
@@ -521,7 +521,7 @@ trait PatternMatching extends Transform with TypingTransformers with ast.TreeDSL
// case Star(_) | ArrayValue => error("stone age pattern relics encountered!")
case _ =>
- error("unsupported pattern: "+ patTree +"(a "+ patTree.getClass +")")
+ typer.context.unit.error(patTree.pos, s"unsupported pattern: $patTree (a ${patTree.getClass}).\n This is a scalac bug. Tree diagnostics: ${asCompactDebugString(patTree)}.")
noFurtherSubPats()
}