summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-07-20 21:38:13 +0000
committerPaul Phillips <paulp@improving.org>2009-07-20 21:38:13 +0000
commit04ed00053ec03848f3409e090d818418c19a8541 (patch)
tree7123e1cab2042b306a81d83c7a97ea8e6e884503 /src
parent9fcf6dc3c6b32e03c64d340e285e1d7886593d20 (diff)
downloadscala-04ed00053ec03848f3409e090d818418c19a8541.tar.gz
scala-04ed00053ec03848f3409e090d818418c19a8541.tar.bz2
scala-04ed00053ec03848f3409e090d818418c19a8541.zip
Fix and test case for #2168.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeDSL.scala2
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
index 9c12ac6bd5..97869d5ea5 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeDSL.scala
@@ -114,6 +114,8 @@ trait TreeDSL {
/** Casting & type tests -- working our way toward understanding exactly
* what differs between the different forms of IS and AS.
+ *
+ * See ticket #2168 for one illustration of AS vs. AS_ANY.
*/
def AS(tpe: Type) = TypeApply(Select(target, Any_asInstanceOf), List(TypeTree(tpe)))
def AS_ANY(tpe: Type) = gen.mkAsInstanceOf(target, tpe)
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index 22df6d1bda..cd140e7c49 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -988,9 +988,10 @@ trait ParallelMatching extends ast.TreeDSL {
// dig out case field accessors that were buried in (***)
val cfa = if (pats.isCaseHead) casted.accessors else Nil
val caseTemps = srep.tvars match { case x :: xs if x == casted.sym => xs ; case x => x }
- def castedScrut = typedValDef(casted.sym, scrut.id AS castedTpe)
+ def castedScrut = typedValDef(casted.sym, scrut.id AS_ANY castedTpe)
def needCast = if (casted.sym ne scrut.sym) List(castedScrut) else Nil
+
val vdefs = needCast ::: (
for ((tmp, accessor) <- caseTemps zip cfa) yield
typedValDef(tmp, typer typed fn(casted.id, accessor))