summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-04-25 16:19:50 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-04-25 16:22:39 +0200
commitef48117f4e408da8e62624e4f3efebf7233fb741 (patch)
tree69fcede35dc6e7e5d36878f8af4faf49ebb23b5d /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentedc7071d3b284fcf82bd17c7a1cf83f23e32788f (diff)
downloadscala-ef48117f4e408da8e62624e4f3efebf7233fb741.tar.gz
scala-ef48117f4e408da8e62624e4f3efebf7233fb741.tar.bz2
scala-ef48117f4e408da8e62624e4f3efebf7233fb741.zip
don't translate matches in the IDE
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1414424a0b..5c40576559 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -83,6 +83,9 @@ trait Typers extends Modes with Adaptations with Taggings with PatMatVirtualiser
private def isPastTyper = phase.id > currentRun.typerPhase.id
+ // don't translate matches in presentation compiler: it loses vital symbols that are needed to do hyperlinking
+ @inline private def doMatchTranslation = !forInteractive && opt.virtPatmat && (phase.id < currentRun.uncurryPhase.id)
+
abstract class Typer(context0: Context) extends TyperDiagnostics with Adaptation with Tagging with TyperContextErrors {
import context0.unit
import typeDebug.{ ptTree, ptBlock, ptLine }
@@ -2436,7 +2439,7 @@ trait Typers extends Modes with Adaptations with Taggings with PatMatVirtualiser
fun.body match {
// later phase indicates scaladoc is calling (where shit is messed up, I tell you)
// -- so fall back to old patmat, which is more forgiving
- case Match(sel, cases) if opt.virtPatmat && (phase.id < currentRun.uncurryPhase.id) =>
+ case Match(sel, cases) if doMatchTranslation =>
// 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)
@@ -3830,7 +3833,7 @@ trait Typers extends Modes with Adaptations with Taggings with PatMatVirtualiser
}
def typedTranslatedMatch(tree: Tree, selector: Tree, cases: List[CaseDef]): Tree = {
- if (opt.virtPatmat && (phase.id < currentRun.uncurryPhase.id)) {
+ if (doMatchTranslation) {
if (selector ne EmptyTree) {
val (selector1, selectorTp, casesAdapted, ownType, doTranslation) = typedMatch(selector, cases, mode, pt)
typed(translatedMatch(selector1, selectorTp, casesAdapted, ownType, doTranslation), mode, pt)
@@ -4734,9 +4737,8 @@ trait Typers extends Modes with Adaptations with Taggings with PatMatVirtualiser
catches1 = catches1 map (adaptCase(_, mode, owntype))
}
- if((phase.id < currentRun.uncurryPhase.id) && opt.virtPatmat) {
+ if (doMatchTranslation)
catches1 = (MatchTranslator(this)).translateTry(catches1, owntype, tree.pos)
- }
treeCopy.Try(tree, block1, catches1, finalizer1) setType owntype