diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-05 17:04:34 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-06 17:29:21 +0200 |
commit | 3e1631e8f71f73f5275b1595bd85de25625bb2de (patch) | |
tree | e6542f461fc4515a231522bccb7117d5feccc255 /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | a8c05274f738943ae58ecefda4b012b9daf5d8dc (diff) | |
download | scala-3e1631e8f71f73f5275b1595bd85de25625bb2de.tar.gz scala-3e1631e8f71f73f5275b1595bd85de25625bb2de.tar.bz2 scala-3e1631e8f71f73f5275b1595bd85de25625bb2de.zip |
SI-7643 Enable newPatternMatching in interactive.
Without it, the enclosed test fails with:
ArrayBuffer(Problem(RangePosition(partial-fun/src/PartialFun.scala, 62, 62, 77),type mismatch;
found : Int => Int
required: PartialFunction[Int,Int],2))
And with that, we can remove this option altogether.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index dd16b5be85..e9c506374d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2436,7 +2436,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper // TODO: add fallback __match sentinel to predef val matchStrategy: Tree = - if (!(newPatternMatching && settings.Xexperimental && context.isNameInScope(vpmName._match))) null // fast path, avoiding the next line if there's no __match to be seen + if (!(settings.Xexperimental && context.isNameInScope(vpmName._match))) null // fast path, avoiding the next line if there's no __match to be seen else newTyper(context.makeImplicit(reportAmbiguousErrors = false)).silent(_.typed(Ident(vpmName._match)), reportAmbiguousErrors = false) orElse (_ => null) if (matchStrategy ne null) // virtualize @@ -2713,7 +2713,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper fun.body match { // translate `x => x match { <cases> }` : PartialFunction to // `new PartialFunction { def applyOrElse(x, default) = x match { <cases> } def isDefinedAt(x) = ... }` - case Match(sel, cases) if (sel ne EmptyTree) && newPatternMatching && (pt.typeSymbol == PartialFunctionClass) => + case Match(sel, cases) if (sel ne EmptyTree) && (pt.typeSymbol == PartialFunctionClass) => // go to outer context -- must discard the context that was created for the Function since we're discarding the function // thus, its symbol, which serves as the current context.owner, is not the right owner // you won't know you're using the wrong owner until lambda lift crashes (unless you know better than to use the wrong owner) @@ -3997,7 +3997,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val selector = tree.selector val cases = tree.cases if (selector == EmptyTree) { - if (newPatternMatching && (pt.typeSymbol == PartialFunctionClass)) + if (pt.typeSymbol == PartialFunctionClass) synthesizePartialFunction(newTermName(context.unit.fresh.newName("x")), tree.pos, tree, mode, pt) else { val arity = if (isFunctionType(pt)) pt.dealiasWiden.typeArgs.length - 1 else 1 |