summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-01-14 15:43:43 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-01-14 15:43:43 -0800
commitfdca5081fd5e9bdefba04ab015ba7f81f79bf6b9 (patch)
tree458654a1533a56bba6f1f8d812b228b7d4d7f293
parentbd4bfface0581041d27c5d243723e39dd99c28fc (diff)
downloadscala-fdca5081fd5e9bdefba04ab015ba7f81f79bf6b9.tar.gz
scala-fdca5081fd5e9bdefba04ab015ba7f81f79bf6b9.tar.bz2
scala-fdca5081fd5e9bdefba04ab015ba7f81f79bf6b9.zip
remove hack for old patmat unnecessary in 2.11
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 57053e81ce..20907979e9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2436,16 +2436,6 @@ trait Typers extends Adaptations with Tags {
treeCopy.CaseDef(cdef, pat1, guard1, body1) setType body1.tpe
}
- // undo adaptConstrPattern's evil deeds, as they confuse the old pattern matcher
- // the flags are used to avoid accidentally deskolemizing unrelated skolems of skolems
- object deskolemizeGADTSkolems extends TypeMap {
- def apply(tp: Type): Type = mapOver(tp) match {
- case TypeRef(pre, sym, args) if sym.isGADTSkolem =>
- typeRef(NoPrefix, sym.deSkolemize, args)
- case tp1 => tp1
- }
- }
-
def typedCases(cases: List[CaseDef], pattp: Type, pt: Type): List[CaseDef] =
cases mapConserve { cdef =>
newTyper(context.makeNewScope(cdef, context.owner)).typedCase(cdef, pattp, pt)
@@ -2466,10 +2456,7 @@ trait Typers extends Adaptations with Tags {
val casesAdapted = if (!needAdapt) casesTyped else casesTyped map (adaptCase(_, mode, resTp))
- val matchTyped = treeCopy.Match(tree, selector1, casesAdapted) setType resTp
- if (!newPatternMatching) // TODO: remove this in 2.11 -- only needed for old pattern matcher
- new TypeMapTreeSubstituter(deskolemizeGADTSkolems).traverse(matchTyped)
- matchTyped
+ treeCopy.Match(tree, selector1, casesAdapted) setType resTp
}
// match has been typed -- virtualize it during type checking so the full context is available
@@ -2491,12 +2478,11 @@ trait Typers extends Adaptations with Tags {
// Match(EmptyTree, cases) ==> new PartialFunction { def apply<OrElse>(params) = `translateMatch('`(param1,...,paramN)` match { cases }')` }
// for fresh params, the selector of the match we'll translated simply gathers those in a tuple
// NOTE: restricted to PartialFunction -- leave Function trees if the expected type does not demand a partial function
- class MatchFunTyper(tree: Tree, cases: List[CaseDef], mode: Mode, pt0: Type) {
+ class MatchFunTyper(tree: Tree, cases: List[CaseDef], mode: Mode, pt: Type) {
// TODO: remove FunctionN support -- this is currently designed so that it can emit FunctionN and PartialFunction subclasses
// however, we should leave Function nodes until Uncurry so phases after typer can still detect normal Function trees
// we need to synthesize PartialFunction impls, though, to avoid nastiness in Uncurry in transforming&duplicating generated pattern matcher trees
// TODO: remove PartialFunction support from UnCurry
- private val pt = deskolemizeGADTSkolems(pt0)
private val targs = pt.normalize.typeArgs
private val arity = if (isFunctionType(pt)) targs.length - 1 else 1 // TODO pt should always be a (Partial)Function, right?
private val ptRes = if (targs.isEmpty) WildcardType else targs.last // may not be fully defined