summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-03-23 16:34:55 +0100
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-03-23 18:27:58 +0100
commit63c96595efb3f863c53efcad89466c0411617c25 (patch)
tree140b460196ec560d673167251cdcf746b98bc515 /src/compiler
parente54eb1a14945eb289159d202be63830d243ab723 (diff)
downloadscala-63c96595efb3f863c53efcad89466c0411617c25.tar.gz
scala-63c96595efb3f863c53efcad89466c0411617c25.tar.bz2
scala-63c96595efb3f863c53efcad89466c0411617c25.zip
[vpm] need cast in one for GADT magic
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
index 5452d13ef0..2091221916 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
@@ -1643,7 +1643,7 @@ class Foo(x: Other) { x._1 } // no error in this order
def caseDef(mkCase: Casegen => Tree): Tree = {
val currCase = nextCase
nextCase = newCaseSym
- val casegen = new OptimizedCasegen(matchEnd, nextCase)
+ val casegen = new OptimizedCasegen(matchEnd, nextCase, restpe)
LabelDef(currCase, Nil, mkCase(casegen))
}
@@ -1667,14 +1667,14 @@ class Foo(x: Other) { x._1 } // no error in this order
)
}
- class OptimizedCasegen(matchEnd: Symbol, nextCase: Symbol) extends CommonCodegen with Casegen {
+ class OptimizedCasegen(matchEnd: Symbol, nextCase: Symbol, restpe: Type) extends CommonCodegen with Casegen {
def matcher(scrut: Tree, scrutSym: Symbol, restpe: Type)(cases: List[Casegen => Tree], matchFailGen: Option[Tree => Tree]): Tree =
optimizedCodegen.matcher(scrut, scrutSym, restpe)(cases, matchFailGen)
// only used to wrap the RHS of a body
// res: T
// returns MatchMonad[T]
- def one(res: Tree): Tree = matchEnd APPLY (res)
+ def one(res: Tree): Tree = matchEnd APPLY (_asInstanceOf(res, restpe)) // need cast for GADT magic
protected def zero: Tree = nextCase APPLY ()
// prev: MatchMonad[T]