summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-07-05 21:47:05 +0000
committerPaul Phillips <paulp@improving.org>2009-07-05 21:47:05 +0000
commit129cdce82583a07a7b18f850c287553134054867 (patch)
treefb32d7a75241d7f6a963b99b40b2ab5f2debc63b
parent64e41b43cc2f000ecbccb527d17425d9f0ce7f98 (diff)
downloadscala-129cdce82583a07a7b18f850c287553134054867.tar.gz
scala-129cdce82583a07a7b18f850c287553134054867.tar.bz2
scala-129cdce82583a07a7b18f850c287553134054867.zip
Made #576 output an error rather than crashing.
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index d6b0592989..7f7b492b79 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -930,16 +930,27 @@ trait ParallelMatching extends ast.TreeDSL {
Branch(casted, nmatrix, nmatrixFail)
}
+ // temporary checks so we're less crashy while we determine what to implement.
+ def checkErroneous(scrut: Scrutinee): Type = {
+ scrut.tpe match {
+ case tpe @ ThisType(_) if tpe.termSymbol == NoSymbol =>
+ cunit.error(scrut.pos, "self type test in anonymous class forbidden by implementation.")
+ ErrorType
+ case x => x
+ }
+ }
+
final def tree(): Tree = {
val Branch(casted, srep, frep) = this.getTransition
- val cond = condition(casted.tpe, scrut)
+ val castedTpe = checkErroneous(casted)
+ val cond = condition(castedTpe, scrut)
val succ = srep.toTree
val fail = frep map (_.toTree) getOrElse (failTree)
// dig out case field accessors that were buried in (***)
val cfa = if (!pats.isCaseHead) Nil else casted.accessors
val caseTemps = srep.temp match { case x :: xs if x == casted.sym => xs ; case x => x }
- def needCast = if (casted.sym ne scrut.sym) List(VAL(casted.sym) === (scrut.id AS_ANY casted.tpe)) else Nil
+ def needCast = if (casted.sym ne scrut.sym) List(VAL(casted.sym) === (scrut.id AS_ANY castedTpe)) else Nil
val vdefs = needCast ::: (
for ((tmp, accessor) <- caseTemps zip cfa) yield
typedValDef(tmp, typer typed fn(casted.id, accessor))