diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-10 11:05:36 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-14 10:53:48 +0200 |
commit | 1125c2f231a341d2b0ca31053105d9ca72030330 (patch) | |
tree | 72ce147dca46bb197170c981eae89348bff67277 | |
parent | 12baa2ea399b4f281c62fd20479c1e626f244d03 (diff) | |
download | scala-1125c2f231a341d2b0ca31053105d9ca72030330.tar.gz scala-1125c2f231a341d2b0ca31053105d9ca72030330.tar.bz2 scala-1125c2f231a341d2b0ca31053105d9ca72030330.zip |
don't crash on unsupported pattern -- diagnose
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/Printers.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala | 2 |
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() } |